mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
Rework about dialog in Qt client to load from .ui
This commit is contained in:
parent
4f239d57e1
commit
4138c7519b
5 changed files with 150 additions and 46 deletions
|
@ -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
|
||||
|
|
45
qt/about.cc
45
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 ("<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
|
||||
|
|
11
qt/about.h
11
qt/about.h
|
@ -12,23 +12,22 @@
|
|||
|
||||
#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
|
||||
|
|
136
qt/about.ui
Normal file
136
qt/about.ui
Normal file
|
@ -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><a href="http://www.transmissionbt.com/">http://www.transmissionbt.com/</a></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>
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue