From 4138c7519bb6311d95a33d4fc37f22569d04095e Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Thu, 25 Dec 2014 19:39:45 +0000 Subject: [PATCH] Rework about dialog in Qt client to load from .ui --- qt/CMakeLists.txt | 1 + qt/about.cc | 45 ++------------- qt/about.h | 11 ++-- qt/about.ui | 136 ++++++++++++++++++++++++++++++++++++++++++++++ qt/qtr.pro | 3 +- 5 files changed, 150 insertions(+), 46 deletions(-) create mode 100644 qt/about.ui diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 2ca17b95d..5ce3154f5 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -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 diff --git a/qt/about.cc b/qt/about.cc index 100211d04..b8bcd963d 100644 --- a/qt/about.cc +++ b/qt/about.cc @@ -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 ("Transmission %1").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 ("http://www.transmissionbt.com/")); - 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 ("Transmission %1").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 diff --git a/qt/about.h b/qt/about.h index 8db1b1309..3a914a902 100644 --- a/qt/about.h +++ b/qt/about.h @@ -12,23 +12,22 @@ #include +#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 index 000000000..4545ae1c8 --- /dev/null +++ b/qt/about.ui @@ -0,0 +1,136 @@ + + + AboutDialog + + + + 0 + 0 + 249 + 191 + + + + About Transmission + + + + QLayout::SetFixedSize + + + + + Qt::AlignCenter + + + + + + + Qt::AlignCenter + + + 8 + + + + + + + A fast and easy BitTorrent client + + + Qt::AlignCenter + + + + + + + Copyright (c) The Transmission Project + + + Qt::AlignCenter + + + + + + + <a href="http://www.transmissionbt.com/">http://www.transmissionbt.com/</a> + + + Qt::AlignCenter + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 1 + 6 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + true + + + + + + + + + dialogButtons + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + dialogButtons + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/qt/qtr.pro b/qt/qtr.pro index 208e3b061..662d63d4f 100644 --- a/qt/qtr.pro +++ b/qt/qtr.pro @@ -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 -- 2.40.0