mirror of
https://github.com/transmission/transmission
synced 2025-02-22 22:20:39 +00:00
Create dialogs on demand, don't keep them ready all the time
This commit is contained in:
parent
18ea8c429a
commit
f592083f15
12 changed files with 151 additions and 89 deletions
|
@ -17,10 +17,11 @@
|
||||||
|
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
#include "LicenseDialog.h"
|
#include "LicenseDialog.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
AboutDialog::AboutDialog (QWidget * parent):
|
AboutDialog::AboutDialog (QWidget * parent):
|
||||||
QDialog (parent, Qt::Dialog),
|
QDialog (parent, Qt::Dialog),
|
||||||
myLicenseDialog (new LicenseDialog (this))
|
myLicenseDialog ()
|
||||||
{
|
{
|
||||||
ui.setupUi (this);
|
ui.setupUi (this);
|
||||||
|
|
||||||
|
@ -29,13 +30,11 @@ AboutDialog::AboutDialog (QWidget * parent):
|
||||||
|
|
||||||
QPushButton * b;
|
QPushButton * b;
|
||||||
|
|
||||||
b = new QPushButton (tr ("C&redits"), this);
|
b = ui.dialogButtons->addButton (tr ("C&redits"), QDialogButtonBox::ActionRole);
|
||||||
ui.dialogButtons->addButton (b, QDialogButtonBox::ActionRole);
|
|
||||||
connect (b, SIGNAL (clicked ()), this, SLOT (showCredits ()));
|
connect (b, SIGNAL (clicked ()), this, SLOT (showCredits ()));
|
||||||
|
|
||||||
b = new QPushButton (tr ("&License"), this);
|
b = ui.dialogButtons->addButton (tr ("&License"), QDialogButtonBox::ActionRole);
|
||||||
ui.dialogButtons->addButton (b, QDialogButtonBox::ActionRole);
|
connect (b, SIGNAL (clicked ()), this, SLOT (showLicense ()));
|
||||||
connect (b, SIGNAL (clicked ()), myLicenseDialog, SLOT (show ()));
|
|
||||||
|
|
||||||
ui.dialogButtons->button (QDialogButtonBox::Close)->setDefault (true);
|
ui.dialogButtons->button (QDialogButtonBox::Close)->setDefault (true);
|
||||||
}
|
}
|
||||||
|
@ -49,3 +48,9 @@ AboutDialog::showCredits ()
|
||||||
QString::fromUtf8 ("Jordan Lee (Backend; Daemon; GTK+; Qt)\n"
|
QString::fromUtf8 ("Jordan Lee (Backend; Daemon; GTK+; Qt)\n"
|
||||||
"Michell Livingston (OS X)\n"));
|
"Michell Livingston (OS X)\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AboutDialog::showLicense ()
|
||||||
|
{
|
||||||
|
Utils::openDialog (myLicenseDialog, this);
|
||||||
|
}
|
||||||
|
|
|
@ -11,9 +11,12 @@
|
||||||
#define QTR_ABOUT_DIALOG_H
|
#define QTR_ABOUT_DIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include "ui_AboutDialog.h"
|
#include "ui_AboutDialog.h"
|
||||||
|
|
||||||
|
class LicenseDialog;
|
||||||
|
|
||||||
class AboutDialog: public QDialog
|
class AboutDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -22,13 +25,14 @@ class AboutDialog: public QDialog
|
||||||
AboutDialog (QWidget * parent = nullptr);
|
AboutDialog (QWidget * parent = nullptr);
|
||||||
virtual ~AboutDialog () {}
|
virtual ~AboutDialog () {}
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void showCredits ();
|
void showCredits ();
|
||||||
|
void showLicense ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AboutDialog ui;
|
Ui::AboutDialog ui;
|
||||||
|
|
||||||
QDialog * myLicenseDialog;
|
QPointer<LicenseDialog> myLicenseDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QTR_ABOUT_DIALOG_H
|
#endif // QTR_ABOUT_DIALOG_H
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "OptionsDialog.h"
|
#include "OptionsDialog.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "SessionDialog.h"
|
|
||||||
#include "TorrentModel.h"
|
#include "TorrentModel.h"
|
||||||
#include "WatchDir.h"
|
#include "WatchDir.h"
|
||||||
|
|
||||||
|
@ -292,14 +291,9 @@ Application::Application (int& argc, char ** argv):
|
||||||
maybeUpdateBlocklist ();
|
maybeUpdateBlocklist ();
|
||||||
|
|
||||||
if (!firstTime)
|
if (!firstTime)
|
||||||
{
|
mySession->restart ();
|
||||||
mySession->restart ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
myWindow->openSession ();
|
||||||
QDialog * d = new SessionDialog (*mySession, *myPrefs, myWindow);
|
|
||||||
d->show ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myPrefs->getBool (Prefs::USER_HAS_GIVEN_INFORMED_CONSENT))
|
if (!myPrefs->getBool (Prefs::USER_HAS_GIVEN_INFORMED_CONSENT))
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,6 +119,7 @@ set(${PROJECT_NAME}_HEADERS
|
||||||
tr_qt_wrap_ui(${PROJECT_NAME}_UI_SOURCES
|
tr_qt_wrap_ui(${PROJECT_NAME}_UI_SOURCES
|
||||||
AboutDialog.ui
|
AboutDialog.ui
|
||||||
DetailsDialog.ui
|
DetailsDialog.ui
|
||||||
|
LicenseDialog.ui
|
||||||
MainWindow.ui
|
MainWindow.ui
|
||||||
MakeDialog.ui
|
MakeDialog.ui
|
||||||
MakeProgressDialog.ui
|
MakeProgressDialog.ui
|
||||||
|
|
|
@ -195,8 +195,6 @@ DetailsDialog::DetailsDialog (Session & session,
|
||||||
adjustSize ();
|
adjustSize ();
|
||||||
ui.commentBrowser->setMaximumHeight (QWIDGETSIZE_MAX);
|
ui.commentBrowser->setMaximumHeight (QWIDGETSIZE_MAX);
|
||||||
|
|
||||||
setAttribute (Qt::WA_DeleteOnClose, true);
|
|
||||||
|
|
||||||
QList<int> initKeys;
|
QList<int> initKeys;
|
||||||
initKeys << Prefs::SHOW_TRACKER_SCRAPES
|
initKeys << Prefs::SHOW_TRACKER_SCRAPES
|
||||||
<< Prefs::SHOW_BACKUP_TRACKERS;
|
<< Prefs::SHOW_BACKUP_TRACKERS;
|
||||||
|
|
|
@ -7,42 +7,10 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
#include "LicenseDialog.h"
|
#include "LicenseDialog.h"
|
||||||
|
|
||||||
LicenseDialog::LicenseDialog (QWidget * parent):
|
LicenseDialog::LicenseDialog (QWidget * parent):
|
||||||
QDialog (parent, Qt::Dialog)
|
QDialog (parent, Qt::Dialog)
|
||||||
{
|
{
|
||||||
setWindowTitle (tr ("License"));
|
ui.setupUi (this);
|
||||||
resize (400, 300);
|
|
||||||
QVBoxLayout * v = new QVBoxLayout (this);
|
|
||||||
|
|
||||||
QPlainTextEdit * t = new QPlainTextEdit (this);
|
|
||||||
t->setReadOnly (true);
|
|
||||||
t->setPlainText (QLatin1String (
|
|
||||||
"Copyright 2005-2014. All code is copyrighted by the respective authors.\n"
|
|
||||||
"\n"
|
|
||||||
"Transmission can be redistributed and/or modified under the terms of the "
|
|
||||||
"GNU GPL versions 2 or 3 or by any future license endorsed by Mnemosyne LLC.\n"
|
|
||||||
"\n"
|
|
||||||
"In addition, linking to and/or using OpenSSL is allowed.\n"
|
|
||||||
"\n"
|
|
||||||
"This program is distributed in the hope that it will be useful, "
|
|
||||||
"but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
|
||||||
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
|
|
||||||
"\n"
|
|
||||||
"Some of Transmission's source files have more permissive licenses. "
|
|
||||||
"Those files may, of course, be used on their own under their own terms.\n"));
|
|
||||||
v->addWidget (t);
|
|
||||||
|
|
||||||
QDialogButtonBox * box = new QDialogButtonBox;
|
|
||||||
box->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
||||||
box->setOrientation (Qt::Horizontal);
|
|
||||||
box->setStandardButtons (QDialogButtonBox::Close);
|
|
||||||
v->addWidget (box);
|
|
||||||
|
|
||||||
connect (box, SIGNAL (rejected ()), this, SLOT (hide ()));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "ui_LicenseDialog.h"
|
||||||
|
|
||||||
class LicenseDialog: public QDialog
|
class LicenseDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -19,6 +21,9 @@ class LicenseDialog: public QDialog
|
||||||
public:
|
public:
|
||||||
LicenseDialog (QWidget * parent = nullptr);
|
LicenseDialog (QWidget * parent = nullptr);
|
||||||
virtual ~LicenseDialog () {}
|
virtual ~LicenseDialog () {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::LicenseDialog ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QTR_LICENSE_DIALOG_H
|
#endif // QTR_LICENSE_DIALOG_H
|
||||||
|
|
66
qt/LicenseDialog.ui
Normal file
66
qt/LicenseDialog.ui
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LicenseDialog</class>
|
||||||
|
<widget class="QDialog" name="LicenseDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>License</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="dialogLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="licenseEdit">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="plainText">
|
||||||
|
<string notr="true">Copyright 2005-2014. All code is copyrighted by the respective authors.
|
||||||
|
|
||||||
|
Transmission can be redistributed and/or modified under the terms of the GNU GPL versions 2 or 3 or by any future license endorsed by Mnemosyne LLC.
|
||||||
|
|
||||||
|
In addition, linking to and/or using OpenSSL is allowed.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
Some of Transmission's source files have more permissive licenses. Those files may, of course, be used on their own under their own terms.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="dialogButtons">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>dialogButtons</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>LicenseDialog</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>
|
|
@ -42,6 +42,7 @@
|
||||||
#include "TorrentDelegateMin.h"
|
#include "TorrentDelegateMin.h"
|
||||||
#include "TorrentFilter.h"
|
#include "TorrentFilter.h"
|
||||||
#include "TorrentModel.h"
|
#include "TorrentModel.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
#define PREFS_KEY "prefs-key";
|
#define PREFS_KEY "prefs-key";
|
||||||
|
|
||||||
|
@ -83,11 +84,11 @@ MainWindow::MainWindow (Session& session, Prefs& prefs, TorrentModel& model, boo
|
||||||
myPrefs (prefs),
|
myPrefs (prefs),
|
||||||
myModel (model),
|
myModel (model),
|
||||||
myLastFullUpdateTime (0),
|
myLastFullUpdateTime (0),
|
||||||
mySessionDialog (new SessionDialog (session, prefs, this)),
|
mySessionDialog (),
|
||||||
myPrefsDialog (),
|
myPrefsDialog (),
|
||||||
myAboutDialog (new AboutDialog (this)),
|
myAboutDialog (),
|
||||||
myStatsDialog (new StatsDialog (session, this)),
|
myStatsDialog (),
|
||||||
myDetailsDialog (0),
|
myDetailsDialog (),
|
||||||
myFilterModel (prefs),
|
myFilterModel (prefs),
|
||||||
myTorrentDelegate (new TorrentDelegate (this)),
|
myTorrentDelegate (new TorrentDelegate (this)),
|
||||||
myTorrentDelegateMin (new TorrentDelegateMin (this)),
|
myTorrentDelegateMin (new TorrentDelegateMin (this)),
|
||||||
|
@ -169,15 +170,15 @@ MainWindow::MainWindow (Session& session, Prefs& prefs, TorrentModel& model, boo
|
||||||
connect (ui.action_AddURL, SIGNAL (triggered ()), this, SLOT (openURL ()));
|
connect (ui.action_AddURL, SIGNAL (triggered ()), this, SLOT (openURL ()));
|
||||||
connect (ui.action_New, SIGNAL (triggered ()), this, SLOT (newTorrent ()));
|
connect (ui.action_New, SIGNAL (triggered ()), this, SLOT (newTorrent ()));
|
||||||
connect (ui.action_Preferences, SIGNAL (triggered ()), this, SLOT (openPreferences ()));
|
connect (ui.action_Preferences, SIGNAL (triggered ()), this, SLOT (openPreferences ()));
|
||||||
connect (ui.action_Statistics, SIGNAL (triggered ()), myStatsDialog, SLOT (show ()));
|
connect (ui.action_Statistics, SIGNAL (triggered ()), this, SLOT (openStats ()));
|
||||||
connect (ui.action_Donate, SIGNAL (triggered ()), this, SLOT (openDonate ()));
|
connect (ui.action_Donate, SIGNAL (triggered ()), this, SLOT (openDonate ()));
|
||||||
connect (ui.action_About, SIGNAL (triggered ()), myAboutDialog, SLOT (show ()));
|
connect (ui.action_About, SIGNAL (triggered ()), this, SLOT (openAbout ()));
|
||||||
connect (ui.action_Contents, SIGNAL (triggered ()), this, SLOT (openHelp ()));
|
connect (ui.action_Contents, SIGNAL (triggered ()), this, SLOT (openHelp ()));
|
||||||
connect (ui.action_OpenFolder, SIGNAL (triggered ()), this, SLOT (openFolder ()));
|
connect (ui.action_OpenFolder, SIGNAL (triggered ()), this, SLOT (openFolder ()));
|
||||||
connect (ui.action_CopyMagnetToClipboard, SIGNAL (triggered ()), this, SLOT (copyMagnetLinkToClipboard ()));
|
connect (ui.action_CopyMagnetToClipboard, SIGNAL (triggered ()), this, SLOT (copyMagnetLinkToClipboard ()));
|
||||||
connect (ui.action_SetLocation, SIGNAL (triggered ()), this, SLOT (setLocation ()));
|
connect (ui.action_SetLocation, SIGNAL (triggered ()), this, SLOT (setLocation ()));
|
||||||
connect (ui.action_Properties, SIGNAL (triggered ()), this, SLOT (openProperties ()));
|
connect (ui.action_Properties, SIGNAL (triggered ()), this, SLOT (openProperties ()));
|
||||||
connect (ui.action_SessionDialog, SIGNAL (triggered ()), mySessionDialog, SLOT (show ()));
|
connect (ui.action_SessionDialog, SIGNAL (triggered ()), this, SLOT (openSession ()));
|
||||||
|
|
||||||
connect (ui.listView, SIGNAL (activated (QModelIndex)), ui.action_Properties, SLOT (trigger ()));
|
connect (ui.listView, SIGNAL (activated (QModelIndex)), ui.action_Properties, SLOT (trigger ()));
|
||||||
|
|
||||||
|
@ -514,38 +515,22 @@ MainWindow::hideEvent (QHideEvent * event)
|
||||||
****/
|
****/
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openPreferences ()
|
MainWindow::openSession ()
|
||||||
{
|
{
|
||||||
if (myPrefsDialog.isNull ())
|
Utils::openDialog (mySessionDialog, mySession, myPrefs, this);
|
||||||
{
|
|
||||||
myPrefsDialog = new PrefsDialog (mySession, myPrefs, this);
|
|
||||||
myPrefsDialog->setAttribute (Qt::WA_DeleteOnClose);
|
|
||||||
myPrefsDialog->show ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myPrefsDialog->raise ();
|
|
||||||
myPrefsDialog->activateWindow ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::onDetailsDestroyed ()
|
MainWindow::openPreferences ()
|
||||||
{
|
{
|
||||||
myDetailsDialog = 0;
|
Utils::openDialog (myPrefsDialog, mySession, myPrefs, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openProperties ()
|
MainWindow::openProperties ()
|
||||||
{
|
{
|
||||||
if (myDetailsDialog == 0)
|
Utils::openDialog (myDetailsDialog, mySession, myPrefs, myModel, this);
|
||||||
{
|
|
||||||
myDetailsDialog = new DetailsDialog (mySession, myPrefs, myModel, this);
|
|
||||||
connect (myDetailsDialog, SIGNAL (destroyed (QObject*)), this, SLOT (onDetailsDestroyed ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
myDetailsDialog->setIds (getSelectedTorrents ());
|
myDetailsDialog->setIds (getSelectedTorrents ());
|
||||||
myDetailsDialog->show ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -617,12 +602,24 @@ MainWindow::copyMagnetLinkToClipboard ()
|
||||||
mySession.copyMagnetLinkToClipboard (id);
|
mySession.copyMagnetLinkToClipboard (id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::openStats ()
|
||||||
|
{
|
||||||
|
Utils::openDialog (myStatsDialog, mySession, this);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openDonate ()
|
MainWindow::openDonate ()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl (QUrl (QLatin1String ("http://www.transmissionbt.com/donate.php")));
|
QDesktopServices::openUrl (QUrl (QLatin1String ("http://www.transmissionbt.com/donate.php")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::openAbout ()
|
||||||
|
{
|
||||||
|
Utils::openDialog (myAboutDialog, this);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::openHelp ()
|
MainWindow::openHelp ()
|
||||||
{
|
{
|
||||||
|
@ -792,7 +789,7 @@ MainWindow::refreshActionSensitivity ()
|
||||||
ui.action_QueueMoveDown->setEnabled (haveSelection);
|
ui.action_QueueMoveDown->setEnabled (haveSelection);
|
||||||
ui.action_QueueMoveBottom->setEnabled (haveSelection);
|
ui.action_QueueMoveBottom->setEnabled (haveSelection);
|
||||||
|
|
||||||
if (myDetailsDialog)
|
if (!myDetailsDialog.isNull ())
|
||||||
myDetailsDialog->setIds (getSelectedTorrents ());
|
myDetailsDialog->setIds (getSelectedTorrents ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,7 +1379,7 @@ void
|
||||||
MainWindow::wrongAuthentication ()
|
MainWindow::wrongAuthentication ()
|
||||||
{
|
{
|
||||||
mySession.stop ();
|
mySession.stop ();
|
||||||
mySessionDialog->show ();
|
openSession ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
@ -28,10 +28,14 @@ class QAction;
|
||||||
class QIcon;
|
class QIcon;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
|
class AboutDialog;
|
||||||
class AddData;
|
class AddData;
|
||||||
class Prefs;
|
|
||||||
class DetailsDialog;
|
class DetailsDialog;
|
||||||
|
class Prefs;
|
||||||
|
class PrefsDialog;
|
||||||
class Session;
|
class Session;
|
||||||
|
class SessionDialog;
|
||||||
|
class StatsDialog;
|
||||||
class TorrentDelegate;
|
class TorrentDelegate;
|
||||||
class TorrentDelegateMin;
|
class TorrentDelegateMin;
|
||||||
class TorrentModel;
|
class TorrentModel;
|
||||||
|
@ -73,6 +77,8 @@ class MainWindow: public QMainWindow
|
||||||
void refreshActionSensitivitySoon ();
|
void refreshActionSensitivitySoon ();
|
||||||
void wrongAuthentication ();
|
void wrongAuthentication ();
|
||||||
|
|
||||||
|
void openSession ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// QWidget
|
// QWidget
|
||||||
virtual void contextMenuEvent (QContextMenuEvent *);
|
virtual void contextMenuEvent (QContextMenuEvent *);
|
||||||
|
@ -98,7 +104,6 @@ class MainWindow: public QMainWindow
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openPreferences ();
|
void openPreferences ();
|
||||||
void onDetailsDestroyed ();
|
|
||||||
void showTotalRatio ();
|
void showTotalRatio ();
|
||||||
void showTotalTransfer ();
|
void showTotalTransfer ();
|
||||||
void showSessionRatio ();
|
void showSessionRatio ();
|
||||||
|
@ -114,7 +119,9 @@ class MainWindow: public QMainWindow
|
||||||
void refreshPref (int key);
|
void refreshPref (int key);
|
||||||
void addTorrents (const QStringList& filenames);
|
void addTorrents (const QStringList& filenames);
|
||||||
void removeTorrents (const bool deleteFiles);
|
void removeTorrents (const bool deleteFiles);
|
||||||
|
void openStats ();
|
||||||
void openDonate ();
|
void openDonate ();
|
||||||
|
void openAbout ();
|
||||||
void openHelp ();
|
void openHelp ();
|
||||||
void openFolder ();
|
void openFolder ();
|
||||||
void copyMagnetLinkToClipboard ();
|
void copyMagnetLinkToClipboard ();
|
||||||
|
@ -151,11 +158,11 @@ class MainWindow: public QMainWindow
|
||||||
Ui_MainWindow ui;
|
Ui_MainWindow ui;
|
||||||
|
|
||||||
time_t myLastFullUpdateTime;
|
time_t myLastFullUpdateTime;
|
||||||
QDialog * mySessionDialog;
|
QPointer<SessionDialog> mySessionDialog;
|
||||||
QPointer<QDialog> myPrefsDialog;
|
QPointer<PrefsDialog> myPrefsDialog;
|
||||||
QDialog * myAboutDialog;
|
QPointer<AboutDialog> myAboutDialog;
|
||||||
QDialog * myStatsDialog;
|
QPointer<StatsDialog> myStatsDialog;
|
||||||
DetailsDialog * myDetailsDialog;
|
QPointer<DetailsDialog> myDetailsDialog;
|
||||||
QSystemTrayIcon myTrayIcon;
|
QSystemTrayIcon myTrayIcon;
|
||||||
TorrentFilter myFilterModel;
|
TorrentFilter myFilterModel;
|
||||||
TorrentDelegate * myTorrentDelegate;
|
TorrentDelegate * myTorrentDelegate;
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>18</number>
|
<number>18</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="startCountLabel">
|
<widget class="QLabel" name="startCountLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">...</string>
|
<string notr="true">...</string>
|
||||||
|
|
17
qt/Utils.h
17
qt/Utils.h
|
@ -41,6 +41,23 @@ class Utils
|
||||||
|
|
||||||
static QColor getFadedColor (const QColor& color);
|
static QColor getFadedColor (const QColor& color);
|
||||||
|
|
||||||
|
template<typename DialogT, typename... ArgsT>
|
||||||
|
static void
|
||||||
|
openDialog (QPointer<DialogT>& dialog, ArgsT&&... args)
|
||||||
|
{
|
||||||
|
if (dialog.isNull ())
|
||||||
|
{
|
||||||
|
dialog = new DialogT (std::forward<ArgsT> (args)...);
|
||||||
|
dialog->setAttribute (Qt::WA_DeleteOnClose);
|
||||||
|
dialog->show ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dialog->raise ();
|
||||||
|
dialog->activateWindow ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// URLs
|
/// URLs
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue