Commit 198eb372 authored by Lukas Appelhans's avatar Lukas Appelhans

Port add dialog to QDialog and prettify VerificationDialog a bit (align elements)

parent 1fbc56a2
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>297</width>
<height>63</height>
<height>119</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -29,7 +29,7 @@
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="newHash">
<property name="clickMessage">
<property name="clickMessage" stdset="0">
<string>Enter a hash key</string>
</property>
<property name="showClearButton" stdset="0">
......@@ -42,6 +42,13 @@
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -58,16 +65,16 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header location="global">kcombobox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>hashTypes</tabstop>
......
......@@ -32,31 +32,31 @@
#include "settings.h"
VerificationAddDlg::VerificationAddDlg(VerificationModel *model, QWidget *parent, Qt::WFlags flags)
: KDialog(parent, flags),
: QDialog(parent, flags),
m_model(model)
{
setCaption(i18n("Add checksum"));
QWidget *widget = new QWidget(this);
ui.setupUi(widget);
setMainWidget(widget);
setWindowTitle(i18n("Add checksum"));
ui.setupUi(this);
QStringList supportedTypes = Verifier::supportedVerficationTypes();
supportedTypes.sort();
ui.hashTypes->addItems(supportedTypes);
setButtons(KDialog::Yes | KDialog::Cancel);
setButtonGuiItem(KDialog::Yes, KStandardGuiItem::add());
KGuiItem::assign(ui.buttonBox->button(QDialogButtonBox::Ok), KStandardGuiItem::add());
updateButton();
connect(ui.newHash, &KLineEdit::textChanged, this, &VerificationAddDlg::updateButton);
connect(ui.hashTypes, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &VerificationAddDlg::updateButton);
connect(this, &VerificationAddDlg::yesClicked, this, &VerificationAddDlg::addChecksum);
connect(this, &QDialog::accepted, this, &VerificationAddDlg::addChecksum);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
QSize VerificationAddDlg::sizeHint() const
{
QSize sh = KDialog::sizeHint();
QSize sh = QDialog::sizeHint();
sh.setHeight(minimumSize().height());
sh.setWidth(sh.width() * 1.5);
return sh;
......@@ -68,8 +68,7 @@ void VerificationAddDlg::updateButton()
const QString hash = ui.newHash->text();
const bool enabled = Verifier::isChecksum(type, hash);
enableButton(KDialog::Yes, enabled);
enableButton(KDialog::User1, enabled);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enabled);
}
void VerificationAddDlg::addChecksum()
......@@ -98,6 +97,7 @@ VerificationDialog::VerificationDialog(QWidget *parent, TransferHandler *transfe
KGuiItem::assign(ui.add, KStandardGuiItem::add());
KGuiItem::assign(ui.remove, KStandardGuiItem::remove());
KGuiItem::assign(ui.closeButton, KStandardGuiItem::close());
ui.verifying->hide();
if (m_model) {
......@@ -128,8 +128,7 @@ VerificationDialog::VerificationDialog(QWidget *parent, TransferHandler *transfe
}
connect(this, &VerificationDialog::finished, this, &VerificationDialog::slotFinished);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui.closeButton, &QPushButton::clicked, this, &QDialog::reject);
}
QSize VerificationDialog::sizeHint() const
......
......@@ -24,7 +24,7 @@
#include "ui_verificationadddlg.h"
#include "../core/basedialog.h"
#include <KDialog>
#include <QDialog>
class FileModel;
class QSortFilterProxyModel;
......@@ -32,7 +32,7 @@ class TransferHandler;
class Verifier;
class VerificationModel;
class VerificationAddDlg : public KDialog
class VerificationAddDlg : public QDialog
{
Q_OBJECT
......
......@@ -10,111 +10,145 @@
<height>300</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0" colspan="2">
<widget class="QWidget" name="verifying" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeView" name="usedHashes">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="verifying" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="text">
<string>Verifying:</string>
<property name="topMargin">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>1</number>
<property name="rightMargin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="add"/>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="verify">
<property name="toolTip">
<string>Verify the finished download with the selected checksum.</string>
</property>
<property name="text">
<string>&amp;Verify</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="remove"/>
</item>
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="4" colspan="2">
<widget class="QTreeView" name="usedHashes">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Verifying:</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="4" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="add">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="remove">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="verify">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Verify the finished download with the selected checksum.</string>
</property>
<property name="text">
<string>&amp;Verify</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment