[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kget/kf5_port] ui: Port add dialog to QDialog and prettify VerificationDialog a bit (align elements
From:       Lukas Appelhans <l.appelhans () gmx ! de>
Date:       2014-10-27 16:40:13
Message-ID: E1XinL3-0004C2-G0 () scm ! kde ! org
[Download RAW message or body]

Git commit 198eb3724f8d6185d02c0a55eb8b9721d6ce2178 by Lukas Appelhans.
Committed on 27/10/2014 at 16:39.
Pushed by lappelhans into branch 'kf5_port'.

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

M  +14   -7    ui/verificationadddlg.ui
M  +12   -13   ui/verificationdialog.cpp
M  +2    -2    ui/verificationdialog.h
M  +135  -101  ui/verificationdialog.ui

http://commits.kde.org/kget/198eb3724f8d6185d02c0a55eb8b9721d6ce2178

diff --git a/ui/verificationadddlg.ui b/ui/verificationadddlg.ui
index 750abf1..fe140b4 100644
--- a/ui/verificationadddlg.ui
+++ b/ui/verificationadddlg.ui
@@ -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">
@@ -43,6 +43,13 @@
     </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">
       <enum>Qt::Vertical</enum>
@@ -59,15 +66,15 @@
  </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>
diff --git a/ui/verificationdialog.cpp b/ui/verificationdialog.cpp
index d8c18c2..8ae16f7 100644
--- a/ui/verificationdialog.cpp
+++ b/ui/verificationdialog.cpp
@@ -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
diff --git a/ui/verificationdialog.h b/ui/verificationdialog.h
index 162ce90..2f778c0 100644
--- a/ui/verificationdialog.h
+++ b/ui/verificationdialog.h
@@ -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
 
diff --git a/ui/verificationdialog.ui b/ui/verificationdialog.ui
index b7f5e8e..64b60c4 100644
--- a/ui/verificationdialog.ui
+++ b/ui/verificationdialog.ui
@@ -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>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic