-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Confirmation dialog box for delete book and cancel download
Added a new custom dialog box for confirmations. Currently, it popups when a book is deleted or a download has to be cancelled
- Loading branch information
Showing
8 changed files
with
264 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
* { | ||
font-family: 'Selawik'; | ||
background-color: white; | ||
} | ||
|
||
#confirmTitle { | ||
font-size: 18px; | ||
line-height: 44px; | ||
font-weight: bold; | ||
} | ||
|
||
QPushButton { | ||
opacity: 1; | ||
padding: 6px; | ||
outline: 0; | ||
border-radius: 2px; | ||
width: 24px; | ||
border: 1px solid #3366cc; | ||
color: #3366cc; | ||
} | ||
|
||
QPushButton:hover { | ||
background-color: #3366cc; | ||
color: white; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "kiwixconfirmbox.h" | ||
#include "ui_kiwixconfirmbox.h" | ||
#include <QFile> | ||
#include <QDebug> | ||
|
||
KiwixConfirmBox::KiwixConfirmBox(QString confirmTitle, QString confirmText, QWidget *parent) : | ||
QDialog(parent), m_confirmTitle(confirmTitle), m_confirmText(confirmText), | ||
ui(new Ui::kiwixconfirmbox) | ||
{ | ||
ui->setupUi(this); | ||
setWindowFlag(Qt::FramelessWindowHint, true); | ||
|
||
QFile styleFile(":/css/confirmBox.css"); | ||
styleFile.open(QIODevice::ReadOnly); | ||
auto byteContent = styleFile.readAll(); | ||
styleFile.close(); | ||
QString style(byteContent); | ||
setStyleSheet(style); | ||
connect(ui->yesButton, &QPushButton::clicked, [=]() { | ||
emit yesClicked(); | ||
}); | ||
connect(ui->noButton, &QPushButton::clicked, [=]() { | ||
emit noClicked(); | ||
}); | ||
ui->confirmText->setText(confirmText); | ||
ui->confirmTitle->setText(confirmTitle); | ||
} | ||
|
||
KiwixConfirmBox::~KiwixConfirmBox() | ||
{ | ||
delete ui; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef KIWIXCONFIRMBOX_H | ||
#define KIWIXCONFIRMBOX_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class kiwixconfirmbox; | ||
} | ||
|
||
class KiwixConfirmBox : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit KiwixConfirmBox(QString confirmTitle, QString confirmText, QWidget *parent = nullptr); | ||
~KiwixConfirmBox(); | ||
|
||
signals: | ||
void yesClicked(); | ||
void noClicked(); | ||
|
||
private: | ||
QString m_confirmTitle; | ||
QString m_confirmText; | ||
Ui::kiwixconfirmbox *ui; | ||
}; | ||
|
||
#endif // KIWIXCONFIRMBOX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>kiwixconfirmbox</class> | ||
<widget class="QDialog" name="kiwixconfirmbox"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>368</width> | ||
<height>166</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>474</width> | ||
<height>16777215</height> | ||
</size> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="confirmTitle"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>Confirm title</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QLabel" name="confirmText"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>600</width> | ||
<height>16777215</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>Would you like to confirm doing xyz?</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="0"> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeType"> | ||
<enum>QSizePolicy::Expanding</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>250</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="yesButton"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>100</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>Yes</string> | ||
</property> | ||
<property name="flat"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="noButton"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>100</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>No</string> | ||
</property> | ||
<property name="flat"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |