]> granicus.if.org Git - transmission/commitdiff
Rework about dialog in Qt client to load from .ui
authorMike Gelfand <mikedld@mikedld.com>
Thu, 25 Dec 2014 19:39:45 +0000 (19:39 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Thu, 25 Dec 2014 19:39:45 +0000 (19:39 +0000)
qt/CMakeLists.txt
qt/about.cc
qt/about.h
qt/about.ui [new file with mode: 0644]
qt/qtr.pro

index 2ca17b95d2dd5946862463615c488ea6d3e591f0..5ce3154f5e850939ca55ffbae14144b261a6883e 100644 (file)
@@ -101,6 +101,7 @@ set(${PROJECT_NAME}_HEADERS
 )
 
 tr_qt_wrap_ui(${PROJECT_NAME}_UI_SOURCES
+    about.ui
     details.ui
     mainwin.ui
     session-dialog.ui
index 100211d048fd2c39aed18367ab87fa1770ffb7ab..b8bcd963dc6e1cb680516ef04a93340937706477 100644 (file)
@@ -31,55 +31,22 @@ AboutDialog::AboutDialog (QWidget * parent):
   QDialog (parent, Qt::Dialog),
   myLicenseDialog (new LicenseDialog (this))
 {
-  setWindowTitle (tr ("About Transmission"));
-  QLabel * l;
-  QVBoxLayout * v = new QVBoxLayout (this);
+  ui.setupUi (this);
 
-  l = new QLabel;
-  l->setPixmap (QApplication::windowIcon ().pixmap (48));
-  l->setAlignment (Qt::AlignCenter);
-  v->addWidget (l);
-
-  QFont f (font ());
-  f.setWeight (QFont::Bold);
-  f.setPointSize (int (f.pointSize () * 1.2));
-  l = new QLabel (tr ("<big>Transmission %1</big>").arg (QString::fromUtf8 (LONG_VERSION_STRING)));
-  l->setAlignment (Qt::AlignCenter);
-  l->setFont (f);
-  l->setMargin (8);
-  v->addWidget (l);
-
-  l = new QLabel (tr ("A fast and easy BitTorrent client"));
-  l->setStyleSheet (QString::fromUtf8 ("text-align: center"));
-  l->setAlignment (Qt::AlignCenter);
-  v->addWidget (l);
-
-  l = new QLabel (tr ("Copyright (c) The Transmission Project"));
-  l->setAlignment (Qt::AlignCenter);
-  v->addWidget (l);
-
-  l = new QLabel (QString::fromUtf8 ("<a href=\"http://www.transmissionbt.com/\">http://www.transmissionbt.com/</a>"));
-  l->setOpenExternalLinks (true);
-  l->setAlignment (Qt::AlignCenter);
-  v->addWidget (l);
-
-  v->addSpacing (HIG::PAD_BIG);
+  ui.iconLabel->setPixmap (QApplication::windowIcon ().pixmap (48));
+  ui.titleLabel->setText (tr ("<big><b>Transmission %1</b></big>").arg (QString::fromUtf8 (LONG_VERSION_STRING)));
 
   QPushButton * b;
-  QDialogButtonBox * box = new QDialogButtonBox;
 
   b = new QPushButton (tr ("C&redits"), this);
-  box->addButton (b, QDialogButtonBox::ActionRole);
+  ui.dialogButtons->addButton (b, QDialogButtonBox::ActionRole);
   connect (b, SIGNAL (clicked ()), this, SLOT (showCredits ()));
 
   b = new QPushButton (tr ("&License"), this);
-  box->addButton (b, QDialogButtonBox::ActionRole);
+  ui.dialogButtons->addButton (b, QDialogButtonBox::ActionRole);
   connect (b, SIGNAL (clicked ()), myLicenseDialog, SLOT (show ()));
 
-  box->addButton (QDialogButtonBox::Close);
-  box->setCenterButtons (true);
-  v->addWidget (box);
-  connect (box, SIGNAL (rejected ()), this, SLOT (hide ()));
+  ui.dialogButtons->button (QDialogButtonBox::Close)->setDefault (true);
 }
 
 void
index 8db1b1309afd75866a2310da22367a60b7fca56e..3a914a9022ecd2a1438ec317b8f7588e76edbcef 100644 (file)
 
 #include <QDialog>
 
+#include "ui_about.h"
+
 class AboutDialog: public QDialog
 {
     Q_OBJECT
 
-  private:
-    QDialog * myLicenseDialog;
-
   public:
     AboutDialog (QWidget * parent = 0);
     ~AboutDialog () {}
-    QWidget * createAboutTab ();
-    QWidget * createAuthorsTab ();
-    QWidget * createLicenseTab ();
 
   public slots:
     void showCredits ();
 
+  private:
+    QDialog * myLicenseDialog;
+    Ui::AboutDialog ui;
 };
 
 #endif
diff --git a/qt/about.ui b/qt/about.ui
new file mode 100644 (file)
index 0000000..4545ae1
--- /dev/null
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>249</width>
+    <height>191</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>About Transmission</string>
+  </property>
+  <layout class="QVBoxLayout" name="dialogLayout">
+   <property name="sizeConstraint">
+    <enum>QLayout::SetFixedSize</enum>
+   </property>
+   <item>
+    <widget class="QLabel" name="iconLabel">
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="titleLabel">
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+     <property name="margin">
+      <number>8</number>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="descriptionLabel">
+     <property name="text">
+      <string>A fast and easy BitTorrent client</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="copyrightsLabel">
+     <property name="text">
+      <string>Copyright (c) The Transmission Project</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="linkLabel">
+     <property name="text">
+      <string>&lt;a href=&quot;http://www.transmissionbt.com/&quot;&gt;http://www.transmissionbt.com/&lt;/a&gt;</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+     <property name="openExternalLinks">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="dialogButtonsSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>1</width>
+       <height>6</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="dialogButtons">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Close</set>
+     </property>
+     <property name="centerButtons">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>dialogButtons</sender>
+   <signal>accepted()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>dialogButtons</sender>
+   <signal>rejected()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index 208e3b0613fc0fea486696fa046ed1b57a46adbd..662d63d4f13a9842dd4fbef37bb57ce3a55f812b 100644 (file)
@@ -46,7 +46,8 @@ TRANSLATIONS += translations/transmission_en.ts \
                 translations/transmission_ru.ts \
                 translations/transmission_uk.ts
 
-FORMS += details.ui \
+FORMS += about.ui \
+         details.ui \
          mainwin.ui \
          session-dialog.ui \
          stats-dialog.ui