mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
Strip spaces around :: in C++ code (Qt client)
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include "hig.h"
|
||||
#include "license.h"
|
||||
|
||||
AboutDialog :: AboutDialog (QWidget * parent):
|
||||
AboutDialog::AboutDialog (QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog),
|
||||
myLicenseDialog (new LicenseDialog (this))
|
||||
{
|
||||
@@ -83,7 +83,7 @@ AboutDialog :: AboutDialog (QWidget * parent):
|
||||
}
|
||||
|
||||
void
|
||||
AboutDialog :: showCredits ()
|
||||
AboutDialog::showCredits ()
|
||||
{
|
||||
QMessageBox::about (
|
||||
this,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
int
|
||||
AddData :: set (const QString& key)
|
||||
AddData::set (const QString& key)
|
||||
{
|
||||
if (Utils::isMagnetLink (key))
|
||||
{
|
||||
@@ -64,7 +64,7 @@ AddData :: set (const QString& key)
|
||||
}
|
||||
|
||||
QByteArray
|
||||
AddData :: toBase64 () const
|
||||
AddData::toBase64 () const
|
||||
{
|
||||
QByteArray ret;
|
||||
|
||||
@@ -80,7 +80,7 @@ AddData :: toBase64 () const
|
||||
}
|
||||
|
||||
QString
|
||||
AddData :: readableName () const
|
||||
AddData::readableName () const
|
||||
{
|
||||
QString ret;
|
||||
|
||||
|
||||
52
qt/app.cc
52
qt/app.cc
@@ -82,7 +82,7 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
MyApp :: MyApp (int& argc, char ** argv):
|
||||
MyApp::MyApp (int& argc, char ** argv):
|
||||
QApplication (argc, argv),
|
||||
myPrefs(nullptr),
|
||||
mySession(nullptr),
|
||||
@@ -308,7 +308,7 @@ MyApp :: MyApp (int& argc, char ** argv):
|
||||
/* these functions are for popping up desktop notifications */
|
||||
|
||||
void
|
||||
MyApp :: onTorrentsAdded (QSet<int> torrents)
|
||||
MyApp::onTorrentsAdded (QSet<int> torrents)
|
||||
{
|
||||
if (!myPrefs->getBool (Prefs::SHOW_NOTIFICATION_ON_ADD))
|
||||
return;
|
||||
@@ -332,7 +332,7 @@ MyApp :: onTorrentsAdded (QSet<int> torrents)
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: onTorrentCompleted (int id)
|
||||
MyApp::onTorrentCompleted (int id)
|
||||
{
|
||||
Torrent * tor = myModel->getTorrentFromId (id);
|
||||
|
||||
@@ -355,7 +355,7 @@ MyApp :: onTorrentCompleted (int id)
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: onNewTorrentChanged (int id)
|
||||
MyApp::onNewTorrentChanged (int id)
|
||||
{
|
||||
Torrent * tor = myModel->getTorrentFromId (id);
|
||||
|
||||
@@ -377,20 +377,20 @@ MyApp :: onNewTorrentChanged (int id)
|
||||
***/
|
||||
|
||||
void
|
||||
MyApp :: consentGiven ()
|
||||
MyApp::consentGiven ()
|
||||
{
|
||||
myPrefs->set<bool> (Prefs::USER_HAS_GIVEN_INFORMED_CONSENT, true);
|
||||
}
|
||||
|
||||
MyApp :: ~MyApp ()
|
||||
MyApp::~MyApp ()
|
||||
{
|
||||
if (myPrefs != nullptr && myWindow != nullptr)
|
||||
{
|
||||
const QRect mainwinRect (myWindow->geometry ());
|
||||
myPrefs->set (Prefs :: MAIN_WINDOW_HEIGHT, std::max (100, mainwinRect.height ()));
|
||||
myPrefs->set (Prefs :: MAIN_WINDOW_WIDTH, std::max (100, mainwinRect.width ()));
|
||||
myPrefs->set (Prefs :: MAIN_WINDOW_X, mainwinRect.x ());
|
||||
myPrefs->set (Prefs :: MAIN_WINDOW_Y, mainwinRect.y ());
|
||||
myPrefs->set (Prefs::MAIN_WINDOW_HEIGHT, std::max (100, mainwinRect.height ()));
|
||||
myPrefs->set (Prefs::MAIN_WINDOW_WIDTH, std::max (100, mainwinRect.width ()));
|
||||
myPrefs->set (Prefs::MAIN_WINDOW_X, mainwinRect.x ());
|
||||
myPrefs->set (Prefs::MAIN_WINDOW_Y, mainwinRect.y ());
|
||||
}
|
||||
|
||||
delete myWatchDir;
|
||||
@@ -405,16 +405,16 @@ MyApp :: ~MyApp ()
|
||||
***/
|
||||
|
||||
void
|
||||
MyApp :: refreshPref (int key)
|
||||
MyApp::refreshPref (int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Prefs :: BLOCKLIST_UPDATES_ENABLED:
|
||||
case Prefs::BLOCKLIST_UPDATES_ENABLED:
|
||||
maybeUpdateBlocklist ();
|
||||
break;
|
||||
|
||||
case Prefs :: DIR_WATCH:
|
||||
case Prefs :: DIR_WATCH_ENABLED:
|
||||
case Prefs::DIR_WATCH:
|
||||
case Prefs::DIR_WATCH_ENABLED:
|
||||
{
|
||||
const QString path (myPrefs->getString (Prefs::DIR_WATCH));
|
||||
const bool isEnabled (myPrefs->getBool (Prefs::DIR_WATCH_ENABLED));
|
||||
@@ -428,24 +428,24 @@ MyApp :: refreshPref (int key)
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: maybeUpdateBlocklist ()
|
||||
MyApp::maybeUpdateBlocklist ()
|
||||
{
|
||||
if (!myPrefs->getBool (Prefs :: BLOCKLIST_UPDATES_ENABLED))
|
||||
if (!myPrefs->getBool (Prefs::BLOCKLIST_UPDATES_ENABLED))
|
||||
return;
|
||||
|
||||
const QDateTime lastUpdatedAt = myPrefs->getDateTime (Prefs :: BLOCKLIST_DATE);
|
||||
const QDateTime lastUpdatedAt = myPrefs->getDateTime (Prefs::BLOCKLIST_DATE);
|
||||
const QDateTime nextUpdateAt = lastUpdatedAt.addDays (7);
|
||||
const QDateTime now = QDateTime::currentDateTime ();
|
||||
|
||||
if (now < nextUpdateAt)
|
||||
{
|
||||
mySession->updateBlocklist ();
|
||||
myPrefs->set (Prefs :: BLOCKLIST_DATE, now);
|
||||
myPrefs->set (Prefs::BLOCKLIST_DATE, now);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: onSessionSourceChanged ()
|
||||
MyApp::onSessionSourceChanged ()
|
||||
{
|
||||
mySession->initTorrents ();
|
||||
mySession->refreshSessionStats ();
|
||||
@@ -453,7 +453,7 @@ MyApp :: onSessionSourceChanged ()
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: refreshTorrents ()
|
||||
MyApp::refreshTorrents ()
|
||||
{
|
||||
// usually we just poll the torrents that have shown recent activity,
|
||||
// but we also periodically ask for updates on the others to ensure
|
||||
@@ -475,7 +475,7 @@ MyApp :: refreshTorrents ()
|
||||
***/
|
||||
|
||||
void
|
||||
MyApp :: addTorrent (const QString& key)
|
||||
MyApp::addTorrent (const QString& key)
|
||||
{
|
||||
const AddData addme (key);
|
||||
|
||||
@@ -484,9 +484,9 @@ MyApp :: addTorrent (const QString& key)
|
||||
}
|
||||
|
||||
void
|
||||
MyApp :: addTorrent (const AddData& addme)
|
||||
MyApp::addTorrent (const AddData& addme)
|
||||
{
|
||||
if (!myPrefs->getBool (Prefs :: OPTIONS_PROMPT))
|
||||
if (!myPrefs->getBool (Prefs::OPTIONS_PROMPT))
|
||||
{
|
||||
mySession->addTorrent (addme);
|
||||
}
|
||||
@@ -504,13 +504,13 @@ MyApp :: addTorrent (const AddData& addme)
|
||||
***/
|
||||
|
||||
void
|
||||
MyApp :: raise ()
|
||||
MyApp::raise ()
|
||||
{
|
||||
QApplication :: alert (myWindow);
|
||||
QApplication::alert (myWindow);
|
||||
}
|
||||
|
||||
bool
|
||||
MyApp :: notifyApp (const QString& title, const QString& body) const
|
||||
MyApp::notifyApp (const QString& title, const QString& body) const
|
||||
{
|
||||
const QString dbusServiceName = QString::fromUtf8 ("org.freedesktop.Notifications");
|
||||
const QString dbusInterfaceName = QString::fromUtf8 ("org.freedesktop.Notifications");
|
||||
|
||||
@@ -11,21 +11,21 @@
|
||||
#include "app.h"
|
||||
#include "dbus-adaptor.h"
|
||||
|
||||
TrDBusAdaptor :: TrDBusAdaptor (MyApp* app):
|
||||
TrDBusAdaptor::TrDBusAdaptor (MyApp* app):
|
||||
QDBusAbstractAdaptor (app),
|
||||
myApp (app)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
TrDBusAdaptor :: PresentWindow ()
|
||||
TrDBusAdaptor::PresentWindow ()
|
||||
{
|
||||
myApp->raise ();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TrDBusAdaptor :: AddMetainfo (const QString& key)
|
||||
TrDBusAdaptor::AddMetainfo (const QString& key)
|
||||
{
|
||||
AddData addme (key);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ class PeerItem: public QTreeWidgetItem
|
||||
***/
|
||||
|
||||
QIcon
|
||||
Details :: getStockIcon (const QString& freedesktop_name, int fallback)
|
||||
Details::getStockIcon (const QString& freedesktop_name, int fallback)
|
||||
{
|
||||
QIcon icon = QIcon::fromTheme (freedesktop_name);
|
||||
|
||||
@@ -147,10 +147,10 @@ Details :: getStockIcon (const QString& freedesktop_name, int fallback)
|
||||
return icon;
|
||||
}
|
||||
|
||||
Details :: Details (Session & session,
|
||||
Prefs & prefs,
|
||||
TorrentModel & model,
|
||||
QWidget * parent):
|
||||
Details::Details (Session & session,
|
||||
Prefs & prefs,
|
||||
TorrentModel & model,
|
||||
QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog),
|
||||
mySession (session),
|
||||
myPrefs (prefs),
|
||||
@@ -182,8 +182,8 @@ Details :: Details (Session & session,
|
||||
QWidget::setAttribute (Qt::WA_DeleteOnClose, true);
|
||||
|
||||
QList<int> initKeys;
|
||||
initKeys << Prefs :: SHOW_TRACKER_SCRAPES
|
||||
<< Prefs :: SHOW_BACKUP_TRACKERS;
|
||||
initKeys << Prefs::SHOW_TRACKER_SCRAPES
|
||||
<< Prefs::SHOW_BACKUP_TRACKERS;
|
||||
foreach (int key, initKeys)
|
||||
refreshPref (key);
|
||||
|
||||
@@ -195,7 +195,7 @@ Details :: Details (Session & session,
|
||||
myTimer.start (REFRESH_INTERVAL_MSEC);
|
||||
}
|
||||
|
||||
Details :: ~Details ()
|
||||
Details::~Details ()
|
||||
{
|
||||
myTrackerDelegate->deleteLater ();
|
||||
myTrackerFilter->deleteLater ();
|
||||
@@ -203,7 +203,7 @@ Details :: ~Details ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: setIds (const QSet<int>& ids)
|
||||
Details::setIds (const QSet<int>& ids)
|
||||
{
|
||||
if (ids == myIds)
|
||||
return;
|
||||
@@ -237,13 +237,13 @@ Details :: setIds (const QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: refreshPref (int key)
|
||||
Details::refreshPref (int key)
|
||||
{
|
||||
QString str;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case Prefs :: SHOW_TRACKER_SCRAPES:
|
||||
case Prefs::SHOW_TRACKER_SCRAPES:
|
||||
{
|
||||
QItemSelectionModel * selectionModel (myTrackerView->selectionModel ());
|
||||
const QItemSelection selection (selectionModel->selection ());
|
||||
@@ -256,7 +256,7 @@ Details :: refreshPref (int key)
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: SHOW_BACKUP_TRACKERS:
|
||||
case Prefs::SHOW_BACKUP_TRACKERS:
|
||||
myTrackerFilter->setShowBackupTrackers (myPrefs.getBool (key));
|
||||
break;
|
||||
|
||||
@@ -271,7 +271,7 @@ Details :: refreshPref (int key)
|
||||
***/
|
||||
|
||||
QString
|
||||
Details :: timeToStringRounded (int seconds)
|
||||
Details::timeToStringRounded (int seconds)
|
||||
{
|
||||
if (seconds > 60)
|
||||
seconds -= (seconds % 60);
|
||||
@@ -280,13 +280,13 @@ Details :: timeToStringRounded (int seconds)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onTimer ()
|
||||
Details::onTimer ()
|
||||
{
|
||||
getNewData ();
|
||||
}
|
||||
|
||||
void
|
||||
Details :: getNewData ()
|
||||
Details::getNewData ()
|
||||
{
|
||||
if (!myIds.empty ())
|
||||
{
|
||||
@@ -305,7 +305,7 @@ Details :: getNewData ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onTorrentChanged ()
|
||||
Details::onTorrentChanged ()
|
||||
{
|
||||
if (!myHavePendingRefresh)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
Details :: refresh ()
|
||||
Details::refresh ()
|
||||
{
|
||||
const int n = myIds.size ();
|
||||
const bool single = n == 1;
|
||||
@@ -923,7 +923,7 @@ Details :: refresh ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: enableWhenChecked (QCheckBox * box, QWidget * w)
|
||||
Details::enableWhenChecked (QCheckBox * box, QWidget * w)
|
||||
{
|
||||
connect (box, SIGNAL (toggled (bool)), w, SLOT (setEnabled (bool)));
|
||||
w->setEnabled (box->isChecked ());
|
||||
@@ -935,7 +935,7 @@ Details :: enableWhenChecked (QCheckBox * box, QWidget * w)
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
Details :: createInfoTab ()
|
||||
Details::createInfoTab ()
|
||||
{
|
||||
HIG * hig = new HIG (this);
|
||||
|
||||
@@ -973,31 +973,31 @@ Details :: createInfoTab ()
|
||||
***/
|
||||
|
||||
void
|
||||
Details :: onShowTrackerScrapesToggled (bool val)
|
||||
Details::onShowTrackerScrapesToggled (bool val)
|
||||
{
|
||||
myPrefs.set (Prefs::SHOW_TRACKER_SCRAPES, val);
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onShowBackupTrackersToggled (bool val)
|
||||
Details::onShowBackupTrackersToggled (bool val)
|
||||
{
|
||||
myPrefs.set (Prefs::SHOW_BACKUP_TRACKERS, val);
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onHonorsSessionLimitsToggled (bool val)
|
||||
Details::onHonorsSessionLimitsToggled (bool val)
|
||||
{
|
||||
mySession.torrentSet (myIds, TR_KEY_honorsSessionLimits, val);
|
||||
getNewData ();
|
||||
}
|
||||
void
|
||||
Details :: onDownloadLimitedToggled (bool val)
|
||||
Details::onDownloadLimitedToggled (bool val)
|
||||
{
|
||||
mySession.torrentSet (myIds, TR_KEY_downloadLimited, val);
|
||||
getNewData ();
|
||||
}
|
||||
void
|
||||
Details :: onSpinBoxEditingFinished ()
|
||||
Details::onSpinBoxEditingFinished ()
|
||||
{
|
||||
const QObject * spin = sender ();
|
||||
const tr_quark key = spin->property (PREF_KEY).toInt ();
|
||||
@@ -1010,14 +1010,14 @@ Details :: onSpinBoxEditingFinished ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onUploadLimitedToggled (bool val)
|
||||
Details::onUploadLimitedToggled (bool val)
|
||||
{
|
||||
mySession.torrentSet (myIds, TR_KEY_uploadLimited, val);
|
||||
getNewData ();
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onIdleModeChanged (int index)
|
||||
Details::onIdleModeChanged (int index)
|
||||
{
|
||||
const int val = myIdleCombo->itemData (index).toInt ();
|
||||
mySession.torrentSet (myIds, TR_KEY_seedIdleMode, val);
|
||||
@@ -1025,14 +1025,14 @@ Details :: onIdleModeChanged (int index)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onRatioModeChanged (int index)
|
||||
Details::onRatioModeChanged (int index)
|
||||
{
|
||||
const int val = myRatioCombo->itemData (index).toInt ();
|
||||
mySession.torrentSet (myIds, TR_KEY_seedRatioMode, val);
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onBandwidthPriorityChanged (int index)
|
||||
Details::onBandwidthPriorityChanged (int index)
|
||||
{
|
||||
if (index != -1)
|
||||
{
|
||||
@@ -1043,7 +1043,7 @@ Details :: onBandwidthPriorityChanged (int index)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onTrackerSelectionChanged ()
|
||||
Details::onTrackerSelectionChanged ()
|
||||
{
|
||||
const int selectionCount = myTrackerView->selectionModel ()->selectedRows ().size ();
|
||||
myEditTrackerButton->setEnabled (selectionCount == 1);
|
||||
@@ -1051,7 +1051,7 @@ Details :: onTrackerSelectionChanged ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onAddTrackerClicked ()
|
||||
Details::onAddTrackerClicked ()
|
||||
{
|
||||
bool ok = false;
|
||||
const QString url = QInputDialog::getText (this,
|
||||
@@ -1089,7 +1089,7 @@ Details :: onAddTrackerClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onEditTrackerClicked ()
|
||||
Details::onEditTrackerClicked ()
|
||||
{
|
||||
QItemSelectionModel * selectionModel = myTrackerView->selectionModel ();
|
||||
QModelIndexList selectedRows = selectionModel->selectedRows ();
|
||||
@@ -1125,7 +1125,7 @@ Details :: onEditTrackerClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onRemoveTrackerClicked ()
|
||||
Details::onRemoveTrackerClicked ()
|
||||
{
|
||||
// make a map of torrentIds to announce URLs to remove
|
||||
QItemSelectionModel * selectionModel = myTrackerView->selectionModel ();
|
||||
@@ -1150,7 +1150,7 @@ Details :: onRemoveTrackerClicked ()
|
||||
}
|
||||
|
||||
QWidget *
|
||||
Details :: createOptionsTab ()
|
||||
Details::createOptionsTab ()
|
||||
{
|
||||
QSpinBox * s;
|
||||
QCheckBox * c;
|
||||
@@ -1203,7 +1203,7 @@ Details :: createOptionsTab ()
|
||||
hig->addSectionTitle (tr ("Seeding Limits"));
|
||||
|
||||
h = new QHBoxLayout ();
|
||||
h->setSpacing (HIG :: PAD);
|
||||
h->setSpacing (HIG::PAD);
|
||||
m = new QComboBox;
|
||||
m->addItem (tr ("Use Global Settings"), TR_RATIOLIMIT_GLOBAL);
|
||||
m->addItem (tr ("Seed regardless of ratio"), TR_RATIOLIMIT_UNLIMITED);
|
||||
@@ -1218,7 +1218,7 @@ Details :: createOptionsTab ()
|
||||
hig->addRow (tr ("&Ratio:"), h, m);
|
||||
|
||||
h = new QHBoxLayout ();
|
||||
h->setSpacing (HIG :: PAD);
|
||||
h->setSpacing (HIG::PAD);
|
||||
m = new QComboBox;
|
||||
m->addItem (tr ("Use Global Settings"), TR_IDLELIMIT_GLOBAL);
|
||||
m->addItem (tr ("Seed regardless of activity"), TR_IDLELIMIT_UNLIMITED);
|
||||
@@ -1255,7 +1255,7 @@ Details :: createOptionsTab ()
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
Details :: createTrackerTab ()
|
||||
Details::createTrackerTab ()
|
||||
{
|
||||
QCheckBox * c;
|
||||
QPushButton * p;
|
||||
@@ -1338,11 +1338,11 @@ Details :: createTrackerTab ()
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
Details :: createPeersTab ()
|
||||
Details::createPeersTab ()
|
||||
{
|
||||
QWidget * top = new QWidget;
|
||||
QVBoxLayout * v = new QVBoxLayout (top);
|
||||
v->setSpacing (HIG :: PAD_BIG);
|
||||
v->setSpacing (HIG::PAD_BIG);
|
||||
v->setContentsMargins (HIG::PAD_BIG, HIG::PAD_BIG, HIG::PAD_BIG, HIG::PAD_BIG);
|
||||
|
||||
QStringList headers;
|
||||
@@ -1379,7 +1379,7 @@ Details :: createPeersTab ()
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
Details :: createFilesTab ()
|
||||
Details::createFilesTab ()
|
||||
{
|
||||
myFileTreeView = new FileTreeView ();
|
||||
|
||||
@@ -1399,7 +1399,7 @@ Details :: createFilesTab ()
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onFilePriorityChanged (const QSet<int>& indices, int priority)
|
||||
Details::onFilePriorityChanged (const QSet<int>& indices, int priority)
|
||||
{
|
||||
tr_quark key;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ Details :: onFilePriorityChanged (const QSet<int>& indices, int priority)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onFileWantedChanged (const QSet<int>& indices, bool wanted)
|
||||
Details::onFileWantedChanged (const QSet<int>& indices, bool wanted)
|
||||
{
|
||||
const tr_quark key = wanted ? TR_KEY_files_wanted : TR_KEY_files_unwanted;
|
||||
mySession.torrentSet (myIds, key, indices.toList ());
|
||||
@@ -1431,13 +1431,13 @@ Details :: onFileWantedChanged (const QSet<int>& indices, bool wanted)
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onPathEdited (const QString& oldpath, const QString& newname)
|
||||
Details::onPathEdited (const QString& oldpath, const QString& newname)
|
||||
{
|
||||
mySession.torrentRenamePath (myIds, oldpath, newname);
|
||||
}
|
||||
|
||||
void
|
||||
Details :: onOpenRequested (const QString& path)
|
||||
Details::onOpenRequested (const QString& path)
|
||||
{
|
||||
if (!mySession.isLocal ())
|
||||
return;
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
****
|
||||
***/
|
||||
|
||||
Favicons :: Favicons ()
|
||||
Favicons::Favicons ()
|
||||
{
|
||||
myNAM = new QNetworkAccessManager ();
|
||||
connect (myNAM, SIGNAL(finished(QNetworkReply*)), this, SLOT(onRequestFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
Favicons :: ~Favicons ()
|
||||
Favicons::~Favicons ()
|
||||
{
|
||||
delete myNAM;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ Favicons :: ~Favicons ()
|
||||
***/
|
||||
|
||||
QString
|
||||
Favicons :: getCacheDir ()
|
||||
Favicons::getCacheDir ()
|
||||
{
|
||||
const QString base =
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
@@ -53,7 +53,7 @@ Favicons :: getCacheDir ()
|
||||
}
|
||||
|
||||
void
|
||||
Favicons :: ensureCacheDirHasBeenScanned ()
|
||||
Favicons::ensureCacheDirHasBeenScanned ()
|
||||
{
|
||||
static bool hasBeenScanned = false;
|
||||
|
||||
@@ -76,7 +76,7 @@ Favicons :: ensureCacheDirHasBeenScanned ()
|
||||
}
|
||||
|
||||
QString
|
||||
Favicons :: getHost (const QUrl& url)
|
||||
Favicons::getHost (const QUrl& url)
|
||||
{
|
||||
QString host = url.host ();
|
||||
const int first_dot = host.indexOf ('.');
|
||||
@@ -89,7 +89,7 @@ Favicons :: getHost (const QUrl& url)
|
||||
}
|
||||
|
||||
QPixmap
|
||||
Favicons :: find (const QUrl& url)
|
||||
Favicons::find (const QUrl& url)
|
||||
{
|
||||
return findFromHost (getHost (url));
|
||||
}
|
||||
@@ -100,7 +100,7 @@ namespace
|
||||
};
|
||||
|
||||
QPixmap
|
||||
Favicons :: findFromHost (const QString& host)
|
||||
Favicons::findFromHost (const QString& host)
|
||||
{
|
||||
ensureCacheDirHasBeenScanned ();
|
||||
|
||||
@@ -109,7 +109,7 @@ Favicons :: findFromHost (const QString& host)
|
||||
}
|
||||
|
||||
void
|
||||
Favicons :: add (const QUrl& url)
|
||||
Favicons::add (const QUrl& url)
|
||||
{
|
||||
ensureCacheDirHasBeenScanned ();
|
||||
|
||||
@@ -132,7 +132,7 @@ Favicons :: add (const QUrl& url)
|
||||
}
|
||||
|
||||
void
|
||||
Favicons :: onRequestFinished (QNetworkReply * reply)
|
||||
Favicons::onRequestFinished (QNetworkReply * reply)
|
||||
{
|
||||
const QString host = reply->url().host();
|
||||
|
||||
|
||||
128
qt/file-tree.cc
128
qt/file-tree.cc
@@ -44,7 +44,7 @@ enum
|
||||
****/
|
||||
|
||||
const QHash<QString,int>&
|
||||
FileTreeItem :: getMyChildRows ()
|
||||
FileTreeItem::getMyChildRows ()
|
||||
{
|
||||
const size_t n = childCount();
|
||||
|
||||
@@ -60,7 +60,7 @@ FileTreeItem :: getMyChildRows ()
|
||||
}
|
||||
|
||||
|
||||
FileTreeItem :: ~FileTreeItem ()
|
||||
FileTreeItem::~FileTreeItem ()
|
||||
{
|
||||
assert(myChildren.isEmpty());
|
||||
|
||||
@@ -75,7 +75,7 @@ FileTreeItem :: ~FileTreeItem ()
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: appendChild (FileTreeItem * child)
|
||||
FileTreeItem::appendChild (FileTreeItem * child)
|
||||
{
|
||||
const size_t n = childCount();
|
||||
child->myParent = this;
|
||||
@@ -84,7 +84,7 @@ FileTreeItem :: appendChild (FileTreeItem * child)
|
||||
}
|
||||
|
||||
FileTreeItem *
|
||||
FileTreeItem :: child (const QString& filename)
|
||||
FileTreeItem::child (const QString& filename)
|
||||
{
|
||||
FileTreeItem * item(0);
|
||||
|
||||
@@ -99,7 +99,7 @@ FileTreeItem :: child (const QString& filename)
|
||||
}
|
||||
|
||||
int
|
||||
FileTreeItem :: row () const
|
||||
FileTreeItem::row () const
|
||||
{
|
||||
int i(-1);
|
||||
|
||||
@@ -113,7 +113,7 @@ FileTreeItem :: row () const
|
||||
}
|
||||
|
||||
QVariant
|
||||
FileTreeItem :: data (int column, int role) const
|
||||
FileTreeItem::data (int column, int role) const
|
||||
{
|
||||
QVariant value;
|
||||
|
||||
@@ -167,7 +167,7 @@ FileTreeItem :: data (int column, int role) const
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: getSubtreeWantedSize (uint64_t& have, uint64_t& total) const
|
||||
FileTreeItem::getSubtreeWantedSize (uint64_t& have, uint64_t& total) const
|
||||
{
|
||||
if (myIsWanted)
|
||||
{
|
||||
@@ -180,7 +180,7 @@ FileTreeItem :: getSubtreeWantedSize (uint64_t& have, uint64_t& total) const
|
||||
}
|
||||
|
||||
double
|
||||
FileTreeItem :: progress () const
|
||||
FileTreeItem::progress () const
|
||||
{
|
||||
double d(0);
|
||||
uint64_t have(0), total(0);
|
||||
@@ -193,7 +193,7 @@ FileTreeItem :: progress () const
|
||||
}
|
||||
|
||||
QString
|
||||
FileTreeItem :: sizeString () const
|
||||
FileTreeItem::sizeString () const
|
||||
{
|
||||
QString str;
|
||||
|
||||
@@ -213,11 +213,11 @@ FileTreeItem :: sizeString () const
|
||||
}
|
||||
|
||||
std::pair<int,int>
|
||||
FileTreeItem :: update (const QString& name,
|
||||
bool wanted,
|
||||
int priority,
|
||||
uint64_t haveSize,
|
||||
bool updateFields)
|
||||
FileTreeItem::update (const QString& name,
|
||||
bool wanted,
|
||||
int priority,
|
||||
uint64_t haveSize,
|
||||
bool updateFields)
|
||||
{
|
||||
int changed_count = 0;
|
||||
int changed_columns[4];
|
||||
@@ -266,7 +266,7 @@ FileTreeItem :: update (const QString& name,
|
||||
}
|
||||
|
||||
QString
|
||||
FileTreeItem :: priorityString () const
|
||||
FileTreeItem::priorityString () const
|
||||
{
|
||||
const int i = priority();
|
||||
|
||||
@@ -280,7 +280,7 @@ FileTreeItem :: priorityString () const
|
||||
}
|
||||
|
||||
int
|
||||
FileTreeItem :: priority () const
|
||||
FileTreeItem::priority () const
|
||||
{
|
||||
int i(0);
|
||||
|
||||
@@ -309,7 +309,7 @@ FileTreeItem :: priority () const
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: setSubtreePriority (int i, QSet<int>& ids)
|
||||
FileTreeItem::setSubtreePriority (int i, QSet<int>& ids)
|
||||
{
|
||||
if (myPriority != i)
|
||||
{
|
||||
@@ -324,7 +324,7 @@ FileTreeItem :: setSubtreePriority (int i, QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: twiddlePriority (QSet<int>& ids, int& p)
|
||||
FileTreeItem::twiddlePriority (QSet<int>& ids, int& p)
|
||||
{
|
||||
const int old(priority());
|
||||
|
||||
@@ -339,7 +339,7 @@ FileTreeItem :: twiddlePriority (QSet<int>& ids, int& p)
|
||||
}
|
||||
|
||||
int
|
||||
FileTreeItem :: isSubtreeWanted () const
|
||||
FileTreeItem::isSubtreeWanted () const
|
||||
{
|
||||
if(myChildren.isEmpty())
|
||||
return myIsWanted ? Qt::Checked : Qt::Unchecked;
|
||||
@@ -363,7 +363,7 @@ FileTreeItem :: isSubtreeWanted () const
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: setSubtreeWanted (bool b, QSet<int>& ids)
|
||||
FileTreeItem::setSubtreeWanted (bool b, QSet<int>& ids)
|
||||
{
|
||||
if (myIsWanted != b)
|
||||
{
|
||||
@@ -378,14 +378,14 @@ FileTreeItem :: setSubtreeWanted (bool b, QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeItem :: twiddleWanted (QSet<int>& ids, bool& wanted)
|
||||
FileTreeItem::twiddleWanted (QSet<int>& ids, bool& wanted)
|
||||
{
|
||||
wanted = isSubtreeWanted() != Qt::Checked;
|
||||
setSubtreeWanted (wanted, ids);
|
||||
}
|
||||
|
||||
QString
|
||||
FileTreeItem :: path () const
|
||||
FileTreeItem::path () const
|
||||
{
|
||||
QString itemPath;
|
||||
const FileTreeItem * item = this;
|
||||
@@ -403,7 +403,7 @@ FileTreeItem :: path () const
|
||||
}
|
||||
|
||||
bool
|
||||
FileTreeItem :: isComplete () const
|
||||
FileTreeItem::isComplete () const
|
||||
{
|
||||
return myHaveSize == totalSize ();
|
||||
}
|
||||
@@ -413,7 +413,7 @@ FileTreeItem :: isComplete () const
|
||||
****
|
||||
***/
|
||||
|
||||
FileTreeModel :: FileTreeModel (QObject *parent, bool isEditable):
|
||||
FileTreeModel::FileTreeModel (QObject * parent, bool isEditable):
|
||||
QAbstractItemModel(parent),
|
||||
myRootItem (new FileTreeItem),
|
||||
myIndexCache (),
|
||||
@@ -421,7 +421,7 @@ FileTreeModel :: FileTreeModel (QObject *parent, bool isEditable):
|
||||
{
|
||||
}
|
||||
|
||||
FileTreeModel :: ~FileTreeModel()
|
||||
FileTreeModel::~FileTreeModel()
|
||||
{
|
||||
clear();
|
||||
|
||||
@@ -429,13 +429,13 @@ FileTreeModel :: ~FileTreeModel()
|
||||
}
|
||||
|
||||
FileTreeItem *
|
||||
FileTreeModel :: itemFromIndex (const QModelIndex& index) const
|
||||
FileTreeModel::itemFromIndex (const QModelIndex& index) const
|
||||
{
|
||||
return static_cast<FileTreeItem*>(index.internalPointer());
|
||||
}
|
||||
|
||||
QVariant
|
||||
FileTreeModel :: data (const QModelIndex &index, int role) const
|
||||
FileTreeModel::data (const QModelIndex &index, int role) const
|
||||
{
|
||||
QVariant value;
|
||||
|
||||
@@ -446,7 +446,7 @@ FileTreeModel :: data (const QModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
Qt::ItemFlags
|
||||
FileTreeModel :: flags (const QModelIndex& index) const
|
||||
FileTreeModel::flags (const QModelIndex& index) const
|
||||
{
|
||||
int i(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
@@ -460,7 +460,7 @@ FileTreeModel :: flags (const QModelIndex& index) const
|
||||
}
|
||||
|
||||
bool
|
||||
FileTreeModel :: setData (const QModelIndex& index, const QVariant& newname, int role)
|
||||
FileTreeModel::setData (const QModelIndex& index, const QVariant& newname, int role)
|
||||
{
|
||||
if (role == Qt::EditRole)
|
||||
{
|
||||
@@ -473,7 +473,7 @@ FileTreeModel :: setData (const QModelIndex& index, const QVariant& newname, int
|
||||
}
|
||||
|
||||
QVariant
|
||||
FileTreeModel :: headerData (int column, Qt::Orientation orientation, int role) const
|
||||
FileTreeModel::headerData (int column, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
QVariant data;
|
||||
|
||||
@@ -510,7 +510,7 @@ FileTreeModel :: headerData (int column, Qt::Orientation orientation, int role)
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
FileTreeModel :: index (int row, int column, const QModelIndex& parent) const
|
||||
FileTreeModel::index (int row, int column, const QModelIndex& parent) const
|
||||
{
|
||||
QModelIndex i;
|
||||
|
||||
@@ -533,13 +533,13 @@ FileTreeModel :: index (int row, int column, const QModelIndex& parent) const
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
FileTreeModel :: parent (const QModelIndex& child) const
|
||||
FileTreeModel::parent (const QModelIndex& child) const
|
||||
{
|
||||
return parent (child, 0); // QAbstractItemModel::parent() wants col 0
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
FileTreeModel :: parent (const QModelIndex& child, int column) const
|
||||
FileTreeModel::parent (const QModelIndex& child, int column) const
|
||||
{
|
||||
QModelIndex parent;
|
||||
|
||||
@@ -550,7 +550,7 @@ FileTreeModel :: parent (const QModelIndex& child, int column) const
|
||||
}
|
||||
|
||||
int
|
||||
FileTreeModel :: rowCount (const QModelIndex& parent) const
|
||||
FileTreeModel::rowCount (const QModelIndex& parent) const
|
||||
{
|
||||
FileTreeItem * parentItem;
|
||||
|
||||
@@ -563,7 +563,7 @@ FileTreeModel :: rowCount (const QModelIndex& parent) const
|
||||
}
|
||||
|
||||
int
|
||||
FileTreeModel :: columnCount (const QModelIndex &parent) const
|
||||
FileTreeModel::columnCount (const QModelIndex& parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
|
||||
@@ -571,7 +571,7 @@ FileTreeModel :: columnCount (const QModelIndex &parent) const
|
||||
}
|
||||
|
||||
QModelIndex
|
||||
FileTreeModel :: indexOf (FileTreeItem * item, int column) const
|
||||
FileTreeModel::indexOf (FileTreeItem * item, int column) const
|
||||
{
|
||||
if (!item || item==myRootItem)
|
||||
return QModelIndex();
|
||||
@@ -580,7 +580,7 @@ FileTreeModel :: indexOf (FileTreeItem * item, int column) const
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: clearSubtree (const QModelIndex& top)
|
||||
FileTreeModel::clearSubtree (const QModelIndex& top)
|
||||
{
|
||||
size_t i = rowCount (top);
|
||||
|
||||
@@ -598,7 +598,7 @@ FileTreeModel :: clearSubtree (const QModelIndex& top)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: clear ()
|
||||
FileTreeModel::clear ()
|
||||
{
|
||||
beginResetModel ();
|
||||
clearSubtree (QModelIndex());
|
||||
@@ -608,20 +608,20 @@ FileTreeModel :: clear ()
|
||||
}
|
||||
|
||||
FileTreeItem *
|
||||
FileTreeModel :: findItemForFileIndex (int fileIndex) const
|
||||
FileTreeModel::findItemForFileIndex (int fileIndex) const
|
||||
{
|
||||
return myIndexCache.value (fileIndex, 0);
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: addFile (int fileIndex,
|
||||
const QString & filename,
|
||||
bool wanted,
|
||||
int priority,
|
||||
uint64_t totalSize,
|
||||
uint64_t have,
|
||||
QList<QModelIndex> & rowsAdded,
|
||||
bool updateFields)
|
||||
FileTreeModel::addFile (int fileIndex,
|
||||
const QString & filename,
|
||||
bool wanted,
|
||||
int priority,
|
||||
uint64_t totalSize,
|
||||
uint64_t have,
|
||||
QList<QModelIndex> & rowsAdded,
|
||||
bool updateFields)
|
||||
{
|
||||
bool added = false;
|
||||
FileTreeItem * item;
|
||||
@@ -690,7 +690,7 @@ FileTreeModel :: addFile (int fileIndex,
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: parentsChanged (const QModelIndex& index, int firstColumn, int lastColumn)
|
||||
FileTreeModel::parentsChanged (const QModelIndex& index, int firstColumn, int lastColumn)
|
||||
{
|
||||
assert (firstColumn <= lastColumn);
|
||||
|
||||
@@ -707,7 +707,7 @@ FileTreeModel :: parentsChanged (const QModelIndex& index, int firstColumn, int
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: subtreeChanged (const QModelIndex& index, int firstColumn, int lastColumn)
|
||||
FileTreeModel::subtreeChanged (const QModelIndex& index, int firstColumn, int lastColumn)
|
||||
{
|
||||
assert (firstColumn <= lastColumn);
|
||||
|
||||
@@ -724,7 +724,7 @@ FileTreeModel :: subtreeChanged (const QModelIndex& index, int firstColumn, int
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: clicked (const QModelIndex& index)
|
||||
FileTreeModel::clicked (const QModelIndex& index)
|
||||
{
|
||||
const int column (index.column());
|
||||
|
||||
@@ -762,7 +762,7 @@ FileTreeModel :: clicked (const QModelIndex& index)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeModel :: doubleClicked (const QModelIndex& index)
|
||||
FileTreeModel::doubleClicked (const QModelIndex& index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
@@ -782,7 +782,7 @@ FileTreeModel :: doubleClicked (const QModelIndex& index)
|
||||
****/
|
||||
|
||||
QSize
|
||||
FileTreeDelegate :: sizeHint(const QStyleOptionViewItem& item, const QModelIndex& index) const
|
||||
FileTreeDelegate::sizeHint(const QStyleOptionViewItem& item, const QModelIndex& index) const
|
||||
{
|
||||
QSize size;
|
||||
|
||||
@@ -802,9 +802,9 @@ FileTreeDelegate :: sizeHint(const QStyleOptionViewItem& item, const QModelIndex
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeDelegate :: paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
FileTreeDelegate::paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
const int column(index.column());
|
||||
|
||||
@@ -814,7 +814,7 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||
return;
|
||||
}
|
||||
|
||||
QStyle * style (QApplication :: style());
|
||||
QStyle * style (QApplication::style ());
|
||||
|
||||
painter->save();
|
||||
QItemDelegate::drawBackground (painter, option, index);
|
||||
@@ -863,7 +863,7 @@ FileTreeDelegate :: paint (QPainter * painter,
|
||||
*****
|
||||
****/
|
||||
|
||||
FileTreeView :: FileTreeView (QWidget * parent, bool isEditable):
|
||||
FileTreeView::FileTreeView (QWidget * parent, bool isEditable):
|
||||
QTreeView (parent),
|
||||
myModel (this, isEditable),
|
||||
myProxy (new QSortFilterProxyModel()),
|
||||
@@ -911,27 +911,27 @@ FileTreeView :: FileTreeView (QWidget * parent, bool isEditable):
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
FileTreeView :: ~FileTreeView ()
|
||||
FileTreeView::~FileTreeView ()
|
||||
{
|
||||
myProxy->deleteLater();
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeView :: onClicked (const QModelIndex& proxyIndex)
|
||||
FileTreeView::onClicked (const QModelIndex& proxyIndex)
|
||||
{
|
||||
const QModelIndex modelIndex = myProxy->mapToSource (proxyIndex);
|
||||
myModel.clicked (modelIndex);
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeView :: onDoubleClicked (const QModelIndex& proxyIndex)
|
||||
FileTreeView::onDoubleClicked (const QModelIndex& proxyIndex)
|
||||
{
|
||||
const QModelIndex modelIndex = myProxy->mapToSource (proxyIndex);
|
||||
myModel.doubleClicked (modelIndex);
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeView :: onOpenRequested (const QString& path)
|
||||
FileTreeView::onOpenRequested (const QString& path)
|
||||
{
|
||||
if (state () == EditingState)
|
||||
return;
|
||||
@@ -940,7 +940,7 @@ FileTreeView :: onOpenRequested (const QString& path)
|
||||
}
|
||||
|
||||
bool
|
||||
FileTreeView :: eventFilter (QObject * o, QEvent * event)
|
||||
FileTreeView::eventFilter (QObject * o, QEvent * event)
|
||||
{
|
||||
// this is kind of a hack to get the last three columns be the
|
||||
// right size, and to have the filename column use whatever
|
||||
@@ -994,7 +994,7 @@ FileTreeView :: eventFilter (QObject * o, QEvent * event)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeView :: update (const FileList& files, bool updateFields)
|
||||
FileTreeView::update (const FileList& files, bool updateFields)
|
||||
{
|
||||
foreach (const TrFile file, files)
|
||||
{
|
||||
@@ -1006,7 +1006,7 @@ FileTreeView :: update (const FileList& files, bool updateFields)
|
||||
}
|
||||
|
||||
void
|
||||
FileTreeView :: clear ()
|
||||
FileTreeView::clear ()
|
||||
{
|
||||
myModel.clear();
|
||||
}
|
||||
|
||||
@@ -48,19 +48,19 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
FilterBarComboBoxDelegate :: FilterBarComboBoxDelegate (QObject * parent, QComboBox * combo):
|
||||
FilterBarComboBoxDelegate::FilterBarComboBoxDelegate (QObject * parent, QComboBox * combo):
|
||||
QItemDelegate (parent),
|
||||
myCombo (combo)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
FilterBarComboBoxDelegate :: isSeparator (const QModelIndex &index)
|
||||
FilterBarComboBoxDelegate::isSeparator (const QModelIndex& index)
|
||||
{
|
||||
return index.data (Qt::AccessibleDescriptionRole).toString () == QLatin1String ("separator");
|
||||
}
|
||||
void
|
||||
FilterBarComboBoxDelegate :: setSeparator (QAbstractItemModel * model, const QModelIndex& index)
|
||||
FilterBarComboBoxDelegate::setSeparator (QAbstractItemModel * model, const QModelIndex& index)
|
||||
{
|
||||
model->setData (index, QString::fromLatin1 ("separator"), Qt::AccessibleDescriptionRole);
|
||||
|
||||
@@ -70,9 +70,9 @@ FilterBarComboBoxDelegate :: setSeparator (QAbstractItemModel * model, const QMo
|
||||
}
|
||||
|
||||
void
|
||||
FilterBarComboBoxDelegate :: paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
FilterBarComboBoxDelegate::paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
if (isSeparator (index))
|
||||
{
|
||||
@@ -120,8 +120,8 @@ FilterBarComboBoxDelegate :: paint (QPainter * painter,
|
||||
}
|
||||
|
||||
QSize
|
||||
FilterBarComboBoxDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
FilterBarComboBoxDelegate::sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
if (isSeparator (index))
|
||||
{
|
||||
@@ -146,13 +146,13 @@ FilterBarComboBoxDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
***
|
||||
**/
|
||||
|
||||
FilterBarComboBox :: FilterBarComboBox (QWidget * parent):
|
||||
FilterBarComboBox::FilterBarComboBox (QWidget * parent):
|
||||
QComboBox (parent)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
FilterBarComboBox :: currentCount () const
|
||||
FilterBarComboBox::currentCount () const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
@@ -164,7 +164,7 @@ FilterBarComboBox :: currentCount () const
|
||||
}
|
||||
|
||||
void
|
||||
FilterBarComboBox :: paintEvent (QPaintEvent * e)
|
||||
FilterBarComboBox::paintEvent (QPaintEvent * e)
|
||||
{
|
||||
Q_UNUSED (e);
|
||||
|
||||
@@ -226,7 +226,7 @@ FilterBarComboBox :: paintEvent (QPaintEvent * e)
|
||||
****/
|
||||
|
||||
FilterBarComboBox *
|
||||
FilterBar :: createActivityCombo ()
|
||||
FilterBar::createActivityCombo ()
|
||||
{
|
||||
FilterBarComboBox * c = new FilterBarComboBox (this);
|
||||
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (this, c);
|
||||
@@ -299,7 +299,7 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
FilterBar :: refreshTrackers ()
|
||||
FilterBar::refreshTrackers ()
|
||||
{
|
||||
Favicons& favicons = dynamic_cast<MyApp*> (QApplication::instance ())->favicons;
|
||||
const int firstTrackerRow = 2; // skip over the "All" and separator...
|
||||
@@ -392,7 +392,7 @@ FilterBar :: refreshTrackers ()
|
||||
|
||||
|
||||
FilterBarComboBox *
|
||||
FilterBar :: createTrackerCombo (QStandardItemModel * model)
|
||||
FilterBar::createTrackerCombo (QStandardItemModel * model)
|
||||
{
|
||||
FilterBarComboBox * c = new FilterBarComboBox (this);
|
||||
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (this, c);
|
||||
@@ -418,7 +418,7 @@ FilterBar :: createTrackerCombo (QStandardItemModel * model)
|
||||
*****
|
||||
****/
|
||||
|
||||
FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& filter, QWidget * parent):
|
||||
FilterBar::FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& filter, QWidget * parent):
|
||||
QWidget (parent),
|
||||
myPrefs (prefs),
|
||||
myTorrents (torrents),
|
||||
@@ -476,13 +476,13 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
|
||||
|
||||
// initialize our state
|
||||
QList<int> initKeys;
|
||||
initKeys << Prefs :: FILTER_MODE
|
||||
<< Prefs :: FILTER_TRACKERS;
|
||||
initKeys << Prefs::FILTER_MODE
|
||||
<< Prefs::FILTER_TRACKERS;
|
||||
foreach (int key, initKeys)
|
||||
refreshPref (key);
|
||||
}
|
||||
|
||||
FilterBar :: ~FilterBar ()
|
||||
FilterBar::~FilterBar ()
|
||||
{
|
||||
delete myRecountTimer;
|
||||
}
|
||||
@@ -492,11 +492,11 @@ FilterBar :: ~FilterBar ()
|
||||
***/
|
||||
|
||||
void
|
||||
FilterBar :: refreshPref (int key)
|
||||
FilterBar::refreshPref (int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Prefs :: FILTER_MODE:
|
||||
case Prefs::FILTER_MODE:
|
||||
{
|
||||
const FilterMode m = myPrefs.get<FilterMode> (key);
|
||||
QAbstractItemModel * model = myActivityCombo->model ();
|
||||
@@ -505,7 +505,7 @@ FilterBar :: refreshPref (int key)
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: FILTER_TRACKERS:
|
||||
case Prefs::FILTER_TRACKERS:
|
||||
{
|
||||
const QString tracker = myPrefs.getString (key);
|
||||
const QString name = readableHostName (tracker);
|
||||
@@ -526,14 +526,14 @@ FilterBar :: refreshPref (int key)
|
||||
}
|
||||
|
||||
void
|
||||
FilterBar :: onTextChanged (const QString& str)
|
||||
FilterBar::onTextChanged (const QString& str)
|
||||
{
|
||||
if (!myIsBootstrapping)
|
||||
myPrefs.set (Prefs::FILTER_TEXT, str.trimmed ());
|
||||
}
|
||||
|
||||
void
|
||||
FilterBar :: onTrackerIndexChanged (int i)
|
||||
FilterBar::onTrackerIndexChanged (int i)
|
||||
{
|
||||
if (!myIsBootstrapping)
|
||||
{
|
||||
@@ -555,7 +555,7 @@ FilterBar :: onTrackerIndexChanged (int i)
|
||||
}
|
||||
|
||||
void
|
||||
FilterBar :: onActivityIndexChanged (int i)
|
||||
FilterBar::onActivityIndexChanged (int i)
|
||||
{
|
||||
if (!myIsBootstrapping)
|
||||
{
|
||||
@@ -568,13 +568,13 @@ FilterBar :: onActivityIndexChanged (int i)
|
||||
****
|
||||
***/
|
||||
|
||||
void FilterBar :: onTorrentModelReset () { recountSoon (); }
|
||||
void FilterBar :: onTorrentModelRowsInserted (const QModelIndex&, int, int) { recountSoon (); }
|
||||
void FilterBar :: onTorrentModelRowsRemoved (const QModelIndex&, int, int) { recountSoon (); }
|
||||
void FilterBar :: onTorrentModelDataChanged (const QModelIndex&, const QModelIndex&) { recountSoon (); }
|
||||
void FilterBar::onTorrentModelReset () { recountSoon (); }
|
||||
void FilterBar::onTorrentModelRowsInserted (const QModelIndex&, int, int) { recountSoon (); }
|
||||
void FilterBar::onTorrentModelRowsRemoved (const QModelIndex&, int, int) { recountSoon (); }
|
||||
void FilterBar::onTorrentModelDataChanged (const QModelIndex&, const QModelIndex&) { recountSoon (); }
|
||||
|
||||
void
|
||||
FilterBar :: recountSoon ()
|
||||
FilterBar::recountSoon ()
|
||||
{
|
||||
if (!myRecountTimer->isActive ())
|
||||
{
|
||||
@@ -583,7 +583,7 @@ FilterBar :: recountSoon ()
|
||||
}
|
||||
}
|
||||
void
|
||||
FilterBar :: recount ()
|
||||
FilterBar::recount ()
|
||||
{
|
||||
QAbstractItemModel * model = myActivityCombo->model ();
|
||||
|
||||
@@ -604,13 +604,13 @@ FilterBar :: recount ()
|
||||
}
|
||||
|
||||
QString
|
||||
FilterBar :: getCountString (int n) const
|
||||
FilterBar::getCountString (int n) const
|
||||
{
|
||||
return QString ("%L1").arg (n);
|
||||
}
|
||||
|
||||
void
|
||||
FilterBar :: refreshCountLabel ()
|
||||
FilterBar::refreshCountLabel ()
|
||||
{
|
||||
const int visibleCount = myFilter.rowCount ();
|
||||
const int trackerCount = myTrackerCombo->currentCount ();
|
||||
|
||||
@@ -22,7 +22,7 @@ const QString FilterMode::names[NUM_MODES] =
|
||||
};
|
||||
|
||||
int
|
||||
FilterMode :: modeFromName( const QString& name )
|
||||
FilterMode::modeFromName (const QString& name)
|
||||
{
|
||||
for (int i=0; i<NUM_MODES; ++i)
|
||||
if( names[i] == name )
|
||||
@@ -46,7 +46,7 @@ const QString SortMode::names[NUM_MODES] =
|
||||
};
|
||||
|
||||
int
|
||||
SortMode :: modeFromName (const QString& name)
|
||||
SortMode::modeFromName (const QString& name)
|
||||
{
|
||||
for (int i=0; i<NUM_MODES; ++i)
|
||||
if (names[i] == name)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace
|
||||
QString Formatter::unitStrings[3][5];
|
||||
|
||||
void
|
||||
Formatter :: initUnits ()
|
||||
Formatter::initUnits ()
|
||||
{
|
||||
speed_K = 1000;
|
||||
unitStrings[SPEED][B] = tr ( "B/s");
|
||||
@@ -73,13 +73,13 @@ Formatter :: initUnits ()
|
||||
***/
|
||||
|
||||
double
|
||||
Speed :: KBps () const
|
||||
Speed::KBps () const
|
||||
{
|
||||
return _Bps / (double)speed_K;
|
||||
}
|
||||
|
||||
Speed
|
||||
Speed :: fromKBps (double KBps)
|
||||
Speed::fromKBps (double KBps)
|
||||
{
|
||||
return int (KBps * speed_K);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ Speed :: fromKBps (double KBps)
|
||||
***/
|
||||
|
||||
QString
|
||||
Formatter :: memToString (int64_t bytes)
|
||||
Formatter::memToString (int64_t bytes)
|
||||
{
|
||||
if (bytes < 0)
|
||||
return tr ("Unknown");
|
||||
@@ -103,7 +103,7 @@ Formatter :: memToString (int64_t bytes)
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: sizeToString (int64_t bytes)
|
||||
Formatter::sizeToString (int64_t bytes)
|
||||
{
|
||||
if (bytes < 0)
|
||||
return tr ("Unknown");
|
||||
@@ -117,7 +117,7 @@ Formatter :: sizeToString (int64_t bytes)
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: speedToString (const Speed& speed)
|
||||
Formatter::speedToString (const Speed& speed)
|
||||
{
|
||||
char buf[128];
|
||||
tr_formatter_speed_KBps (buf, speed.KBps (), sizeof (buf));
|
||||
@@ -125,7 +125,7 @@ Formatter :: speedToString (const Speed& speed)
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: uploadSpeedToString (const Speed& uploadSpeed)
|
||||
Formatter::uploadSpeedToString (const Speed& uploadSpeed)
|
||||
{
|
||||
static const QChar uploadSymbol (0x25B4);
|
||||
|
||||
@@ -133,7 +133,7 @@ Formatter :: uploadSpeedToString (const Speed& uploadSpeed)
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: downloadSpeedToString (const Speed& downloadSpeed)
|
||||
Formatter::downloadSpeedToString (const Speed& downloadSpeed)
|
||||
{
|
||||
static const QChar downloadSymbol (0x25BE);
|
||||
|
||||
@@ -141,21 +141,21 @@ Formatter :: downloadSpeedToString (const Speed& downloadSpeed)
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: percentToString (double x)
|
||||
Formatter::percentToString (double x)
|
||||
{
|
||||
char buf[128];
|
||||
return QString (tr_strpercent (buf, x, sizeof (buf)));
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: ratioToString (double ratio)
|
||||
Formatter::ratioToString (double ratio)
|
||||
{
|
||||
char buf[128];
|
||||
return QString::fromUtf8 (tr_strratio (buf, sizeof (buf), ratio, "\xE2\x88\x9E"));
|
||||
}
|
||||
|
||||
QString
|
||||
Formatter :: timeToString (int seconds)
|
||||
Formatter::timeToString (int seconds)
|
||||
{
|
||||
int days, hours, minutes;
|
||||
QString d, h, m, s;
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace
|
||||
static const int INTERVAL_MSEC = 15000;
|
||||
}
|
||||
|
||||
FreespaceLabel :: FreespaceLabel (Session & session,
|
||||
const QString & path,
|
||||
QWidget * parent):
|
||||
FreespaceLabel::FreespaceLabel (Session & session,
|
||||
const QString & path,
|
||||
QWidget * parent):
|
||||
QLabel (parent),
|
||||
mySession (session),
|
||||
myTag (-1),
|
||||
@@ -40,7 +40,7 @@ FreespaceLabel :: FreespaceLabel (Session & session,
|
||||
}
|
||||
|
||||
void
|
||||
FreespaceLabel :: setPath (const QString& path)
|
||||
FreespaceLabel::setPath (const QString& path)
|
||||
{
|
||||
if (myPath != path)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ FreespaceLabel :: setPath (const QString& path)
|
||||
}
|
||||
|
||||
void
|
||||
FreespaceLabel :: onTimer ()
|
||||
FreespaceLabel::onTimer ()
|
||||
{
|
||||
const int64_t tag = mySession.getUniqueTag ();
|
||||
const QByteArray myPathUtf8 = myPath.toUtf8 ();
|
||||
@@ -68,7 +68,7 @@ FreespaceLabel :: onTimer ()
|
||||
}
|
||||
|
||||
void
|
||||
FreespaceLabel :: onSessionExecuted (int64_t tag, const QString& result, struct tr_variant * arguments)
|
||||
FreespaceLabel::onSessionExecuted (int64_t tag, const QString& result, struct tr_variant * arguments)
|
||||
{
|
||||
Q_UNUSED (result);
|
||||
|
||||
|
||||
44
qt/hig.cc
44
qt/hig.cc
@@ -17,7 +17,7 @@
|
||||
#include "hig.h"
|
||||
|
||||
|
||||
HIG :: HIG (QWidget * parent):
|
||||
HIG::HIG (QWidget * parent):
|
||||
QWidget (parent),
|
||||
myRow (0),
|
||||
myHasTall (false),
|
||||
@@ -29,7 +29,7 @@ HIG :: HIG (QWidget * parent):
|
||||
myGrid->setColumnStretch (1, 1);
|
||||
}
|
||||
|
||||
HIG :: ~HIG ()
|
||||
HIG::~HIG ()
|
||||
{
|
||||
delete myGrid;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ HIG :: ~HIG ()
|
||||
***/
|
||||
|
||||
void
|
||||
HIG :: addSectionDivider ()
|
||||
HIG::addSectionDivider ()
|
||||
{
|
||||
QWidget * w = new QWidget (this);
|
||||
myGrid->addWidget (w, myRow, 0, 1, 2);
|
||||
@@ -47,7 +47,7 @@ HIG :: addSectionDivider ()
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addSectionTitle (const QString& title)
|
||||
HIG::addSectionTitle (const QString& title)
|
||||
{
|
||||
QLabel * label = new QLabel (this);
|
||||
label->setText (title);
|
||||
@@ -57,14 +57,14 @@ HIG :: addSectionTitle (const QString& title)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addSectionTitle (QWidget * w)
|
||||
HIG::addSectionTitle (QWidget * w)
|
||||
{
|
||||
myGrid->addWidget (w, myRow, 0, 1, 2, Qt::AlignLeft|Qt::AlignVCenter);
|
||||
++myRow;
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addSectionTitle (QLayout * l)
|
||||
HIG::addSectionTitle (QLayout * l)
|
||||
{
|
||||
myGrid->addLayout (l, myRow, 0, 1, 2, Qt::AlignLeft|Qt::AlignVCenter);
|
||||
++myRow;
|
||||
@@ -72,7 +72,7 @@ HIG :: addSectionTitle (QLayout * l)
|
||||
|
||||
|
||||
QLayout *
|
||||
HIG :: addRow (QWidget * w)
|
||||
HIG::addRow (QWidget * w)
|
||||
{
|
||||
QHBoxLayout * h = new QHBoxLayout ();
|
||||
h->addSpacing (18);
|
||||
@@ -86,7 +86,7 @@ HIG :: addRow (QWidget * w)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addWideControl (QLayout * l)
|
||||
HIG::addWideControl (QLayout * l)
|
||||
{
|
||||
QHBoxLayout * h = new QHBoxLayout ();
|
||||
h->addSpacing (18);
|
||||
@@ -96,7 +96,7 @@ HIG :: addWideControl (QLayout * l)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addWideControl (QWidget * w)
|
||||
HIG::addWideControl (QWidget * w)
|
||||
{
|
||||
QHBoxLayout * h = new QHBoxLayout ();
|
||||
h->addSpacing (18);
|
||||
@@ -106,7 +106,7 @@ HIG :: addWideControl (QWidget * w)
|
||||
}
|
||||
|
||||
QCheckBox*
|
||||
HIG :: addWideCheckBox (const QString& text, bool isChecked)
|
||||
HIG::addWideCheckBox (const QString& text, bool isChecked)
|
||||
{
|
||||
QCheckBox * check = new QCheckBox (text, this);
|
||||
check->setChecked (isChecked);
|
||||
@@ -115,7 +115,7 @@ HIG :: addWideCheckBox (const QString& text, bool isChecked)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addLabel (QWidget * w)
|
||||
HIG::addLabel (QWidget * w)
|
||||
{
|
||||
QHBoxLayout * h = new QHBoxLayout ();
|
||||
h->addSpacing (18);
|
||||
@@ -124,7 +124,7 @@ HIG :: addLabel (QWidget * w)
|
||||
}
|
||||
|
||||
QLabel*
|
||||
HIG :: addLabel (const QString& text)
|
||||
HIG::addLabel (const QString& text)
|
||||
{
|
||||
QLabel * label = new QLabel (text, this);
|
||||
addLabel (label);
|
||||
@@ -132,7 +132,7 @@ HIG :: addLabel (const QString& text)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addTallLabel (QWidget * w)
|
||||
HIG::addTallLabel (QWidget * w)
|
||||
{
|
||||
QHBoxLayout * h = new QHBoxLayout ();
|
||||
h->addSpacing (18);
|
||||
@@ -141,7 +141,7 @@ HIG :: addTallLabel (QWidget * w)
|
||||
}
|
||||
|
||||
QLabel*
|
||||
HIG :: addTallLabel (const QString& text)
|
||||
HIG::addTallLabel (const QString& text)
|
||||
{
|
||||
QLabel * label = new QLabel (text, this);
|
||||
addTallLabel (label);
|
||||
@@ -149,19 +149,19 @@ HIG :: addTallLabel (const QString& text)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addControl (QWidget * w)
|
||||
HIG::addControl (QWidget * w)
|
||||
{
|
||||
myGrid->addWidget (w, myRow, 1, 1, 1);
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addControl (QLayout * l)
|
||||
HIG::addControl (QLayout * l)
|
||||
{
|
||||
myGrid->addLayout (l, myRow, 1, 1, 1);
|
||||
}
|
||||
|
||||
QLabel *
|
||||
HIG :: addRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
HIG::addRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
{
|
||||
QLabel * label = addLabel (text);
|
||||
addControl (control);
|
||||
@@ -171,7 +171,7 @@ HIG :: addRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
}
|
||||
|
||||
QLabel *
|
||||
HIG :: addTallRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
HIG::addTallRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
{
|
||||
QLabel* label = addTallLabel (text);
|
||||
label->setBuddy (buddy ? buddy : control);
|
||||
@@ -183,7 +183,7 @@ HIG :: addTallRow (const QString& text, QWidget * control, QWidget * buddy)
|
||||
}
|
||||
|
||||
QLabel *
|
||||
HIG :: addRow (const QString& text, QLayout * control, QWidget * buddy)
|
||||
HIG::addRow (const QString& text, QLayout * control, QWidget * buddy)
|
||||
{
|
||||
QLabel * label = addLabel (text);
|
||||
addControl (control);
|
||||
@@ -194,7 +194,7 @@ HIG :: addRow (const QString& text, QLayout * control, QWidget * buddy)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addRow (QWidget * label, QWidget * control, QWidget * buddy)
|
||||
HIG::addRow (QWidget * label, QWidget * control, QWidget * buddy)
|
||||
{
|
||||
addLabel (label);
|
||||
|
||||
@@ -211,7 +211,7 @@ HIG :: addRow (QWidget * label, QWidget * control, QWidget * buddy)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: addRow (QWidget * label, QLayout * control, QWidget * buddy)
|
||||
HIG::addRow (QWidget * label, QLayout * control, QWidget * buddy)
|
||||
{
|
||||
addLabel (label);
|
||||
|
||||
@@ -228,7 +228,7 @@ HIG :: addRow (QWidget * label, QLayout * control, QWidget * buddy)
|
||||
}
|
||||
|
||||
void
|
||||
HIG :: finish ()
|
||||
HIG::finish ()
|
||||
{
|
||||
if (!myHasTall)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "license.h"
|
||||
|
||||
LicenseDialog :: LicenseDialog (QWidget * parent):
|
||||
LicenseDialog::LicenseDialog (QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog)
|
||||
{
|
||||
setWindowTitle (tr ("License"));
|
||||
|
||||
214
qt/mainwin.cc
214
qt/mainwin.cc
@@ -72,7 +72,7 @@ class ListViewProxyStyle: public QProxyStyle
|
||||
|
||||
|
||||
QIcon
|
||||
TrMainWindow :: getStockIcon (const QString& name, int fallback)
|
||||
TrMainWindow::getStockIcon (const QString& name, int fallback)
|
||||
{
|
||||
QIcon icon = QIcon::fromTheme (name);
|
||||
|
||||
@@ -82,7 +82,7 @@ TrMainWindow :: getStockIcon (const QString& name, int fallback)
|
||||
return icon;
|
||||
}
|
||||
|
||||
TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& model, bool minimized):
|
||||
TrMainWindow::TrMainWindow (Session& session, Prefs& prefs, TorrentModel& model, bool minimized):
|
||||
myLastFullUpdateTime (0),
|
||||
mySessionDialog (new SessionDialog (session, prefs, this)),
|
||||
myPrefsDialog (0),
|
||||
@@ -248,22 +248,22 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
|
||||
ui.verticalLayout->insertWidget (0, myFilterBar = new FilterBar (myPrefs, myModel, myFilterModel));
|
||||
|
||||
QList<int> initKeys;
|
||||
initKeys << Prefs :: MAIN_WINDOW_X
|
||||
<< Prefs :: SHOW_TRAY_ICON
|
||||
<< Prefs :: SORT_REVERSED
|
||||
<< Prefs :: SORT_MODE
|
||||
<< Prefs :: FILTERBAR
|
||||
<< Prefs :: STATUSBAR
|
||||
<< Prefs :: STATUSBAR_STATS
|
||||
<< Prefs :: TOOLBAR
|
||||
<< Prefs :: ALT_SPEED_LIMIT_ENABLED
|
||||
<< Prefs :: COMPACT_VIEW
|
||||
<< Prefs :: DSPEED
|
||||
<< Prefs :: DSPEED_ENABLED
|
||||
<< Prefs :: USPEED
|
||||
<< Prefs :: USPEED_ENABLED
|
||||
<< Prefs :: RATIO
|
||||
<< Prefs :: RATIO_ENABLED;
|
||||
initKeys << Prefs::MAIN_WINDOW_X
|
||||
<< Prefs::SHOW_TRAY_ICON
|
||||
<< Prefs::SORT_REVERSED
|
||||
<< Prefs::SORT_MODE
|
||||
<< Prefs::FILTERBAR
|
||||
<< Prefs::STATUSBAR
|
||||
<< Prefs::STATUSBAR_STATS
|
||||
<< Prefs::TOOLBAR
|
||||
<< Prefs::ALT_SPEED_LIMIT_ENABLED
|
||||
<< Prefs::COMPACT_VIEW
|
||||
<< Prefs::DSPEED
|
||||
<< Prefs::DSPEED_ENABLED
|
||||
<< Prefs::USPEED
|
||||
<< Prefs::USPEED_ENABLED
|
||||
<< Prefs::RATIO
|
||||
<< Prefs::RATIO_ENABLED;
|
||||
foreach (int key, initKeys)
|
||||
refreshPref (key);
|
||||
|
||||
@@ -295,7 +295,7 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
|
||||
refreshTitle ();
|
||||
}
|
||||
|
||||
TrMainWindow :: ~TrMainWindow ()
|
||||
TrMainWindow::~TrMainWindow ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -304,13 +304,13 @@ TrMainWindow :: ~TrMainWindow ()
|
||||
****/
|
||||
|
||||
void
|
||||
TrMainWindow :: onSessionSourceChanged ()
|
||||
TrMainWindow::onSessionSourceChanged ()
|
||||
{
|
||||
myModel.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: onModelReset ()
|
||||
TrMainWindow::onModelReset ()
|
||||
{
|
||||
refreshTitle ();
|
||||
refreshActionSensitivitySoon ();
|
||||
@@ -325,7 +325,7 @@ TrMainWindow :: onModelReset ()
|
||||
#define PREF_VARIANTS_KEY "pref-variants-list"
|
||||
|
||||
void
|
||||
TrMainWindow :: onSetPrefs ()
|
||||
TrMainWindow::onSetPrefs ()
|
||||
{
|
||||
const QVariantList p = sender ()->property (PREF_VARIANTS_KEY).toList ();
|
||||
assert ( (p.size () % 2) == 0);
|
||||
@@ -334,7 +334,7 @@ TrMainWindow :: onSetPrefs ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: onSetPrefs (bool isChecked)
|
||||
TrMainWindow::onSetPrefs (bool isChecked)
|
||||
{
|
||||
if (isChecked)
|
||||
onSetPrefs ();
|
||||
@@ -343,7 +343,7 @@ TrMainWindow :: onSetPrefs (bool isChecked)
|
||||
#define SHOW_KEY "show-mode"
|
||||
|
||||
QWidget *
|
||||
TrMainWindow :: createStatusBar ()
|
||||
TrMainWindow::createStatusBar ()
|
||||
{
|
||||
QMenu * m;
|
||||
QLabel * l;
|
||||
@@ -421,7 +421,7 @@ TrMainWindow :: createStatusBar ()
|
||||
}
|
||||
|
||||
QMenu *
|
||||
TrMainWindow :: createOptionsMenu ()
|
||||
TrMainWindow::createOptionsMenu ()
|
||||
{
|
||||
QMenu * menu;
|
||||
QMenu * sub;
|
||||
@@ -509,22 +509,22 @@ TrMainWindow :: createOptionsMenu ()
|
||||
****/
|
||||
|
||||
void
|
||||
TrMainWindow :: setSortPref (int i)
|
||||
TrMainWindow::setSortPref (int i)
|
||||
{
|
||||
myPrefs.set (Prefs::SORT_MODE, SortMode (i));
|
||||
}
|
||||
void TrMainWindow :: onSortByActivityToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_ACTIVITY); }
|
||||
void TrMainWindow :: onSortByAgeToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_AGE); }
|
||||
void TrMainWindow :: onSortByETAToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_ETA); }
|
||||
void TrMainWindow :: onSortByNameToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_NAME); }
|
||||
void TrMainWindow :: onSortByProgressToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_PROGRESS); }
|
||||
void TrMainWindow :: onSortByQueueToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_QUEUE); }
|
||||
void TrMainWindow :: onSortByRatioToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_RATIO); }
|
||||
void TrMainWindow :: onSortBySizeToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_SIZE); }
|
||||
void TrMainWindow :: onSortByStateToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_STATE); }
|
||||
void TrMainWindow::onSortByActivityToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_ACTIVITY); }
|
||||
void TrMainWindow::onSortByAgeToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_AGE); }
|
||||
void TrMainWindow::onSortByETAToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_ETA); }
|
||||
void TrMainWindow::onSortByNameToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_NAME); }
|
||||
void TrMainWindow::onSortByProgressToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_PROGRESS); }
|
||||
void TrMainWindow::onSortByQueueToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_QUEUE); }
|
||||
void TrMainWindow::onSortByRatioToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_RATIO); }
|
||||
void TrMainWindow::onSortBySizeToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_SIZE); }
|
||||
void TrMainWindow::onSortByStateToggled (bool b) { if (b) setSortPref (SortMode::SORT_BY_STATE); }
|
||||
|
||||
void
|
||||
TrMainWindow :: setSortAscendingPref (bool b)
|
||||
TrMainWindow::setSortAscendingPref (bool b)
|
||||
{
|
||||
myPrefs.set (Prefs::SORT_REVERSED, b);
|
||||
}
|
||||
@@ -534,7 +534,7 @@ TrMainWindow :: setSortAscendingPref (bool b)
|
||||
****/
|
||||
|
||||
void
|
||||
TrMainWindow :: showEvent (QShowEvent * event)
|
||||
TrMainWindow::showEvent (QShowEvent * event)
|
||||
{
|
||||
Q_UNUSED (event);
|
||||
|
||||
@@ -546,7 +546,7 @@ TrMainWindow :: showEvent (QShowEvent * event)
|
||||
****/
|
||||
|
||||
void
|
||||
TrMainWindow :: hideEvent (QHideEvent * event)
|
||||
TrMainWindow::hideEvent (QHideEvent * event)
|
||||
{
|
||||
Q_UNUSED (event);
|
||||
|
||||
@@ -559,13 +559,13 @@ TrMainWindow :: hideEvent (QHideEvent * event)
|
||||
****/
|
||||
|
||||
void
|
||||
TrMainWindow :: onPrefsDestroyed ()
|
||||
TrMainWindow::onPrefsDestroyed ()
|
||||
{
|
||||
myPrefsDialog = 0;
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openPreferences ()
|
||||
TrMainWindow::openPreferences ()
|
||||
{
|
||||
if (myPrefsDialog == 0)
|
||||
{
|
||||
@@ -577,13 +577,13 @@ TrMainWindow :: openPreferences ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: onDetailsDestroyed ()
|
||||
TrMainWindow::onDetailsDestroyed ()
|
||||
{
|
||||
myDetailsDialog = 0;
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openProperties ()
|
||||
TrMainWindow::openProperties ()
|
||||
{
|
||||
if (myDetailsDialog == 0)
|
||||
{
|
||||
@@ -596,7 +596,7 @@ TrMainWindow :: openProperties ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: setLocation ()
|
||||
TrMainWindow::setLocation ()
|
||||
{
|
||||
QDialog * d = new RelocateDialog (mySession, myModel, getSelectedTorrents (), this);
|
||||
d->show ();
|
||||
@@ -634,7 +634,7 @@ void openSelect (const QString& path)
|
||||
#endif
|
||||
|
||||
void
|
||||
TrMainWindow :: openFolder ()
|
||||
TrMainWindow::openFolder ()
|
||||
{
|
||||
const int torrentId (*getSelectedTorrents ().begin ());
|
||||
const Torrent * tor (myModel.getTorrentFromId (torrentId));
|
||||
@@ -653,35 +653,35 @@ TrMainWindow :: openFolder ()
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
QDesktopServices :: openUrl (QUrl::fromLocalFile (path));
|
||||
QDesktopServices::openUrl (QUrl::fromLocalFile (path));
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: copyMagnetLinkToClipboard ()
|
||||
TrMainWindow::copyMagnetLinkToClipboard ()
|
||||
{
|
||||
const int id (*getSelectedTorrents ().begin ());
|
||||
mySession.copyMagnetLinkToClipboard (id);
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openDonate ()
|
||||
TrMainWindow::openDonate ()
|
||||
{
|
||||
QDesktopServices :: openUrl (QUrl ("http://www.transmissionbt.com/donate.php"));
|
||||
QDesktopServices::openUrl (QUrl ("http://www.transmissionbt.com/donate.php"));
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openHelp ()
|
||||
TrMainWindow::openHelp ()
|
||||
{
|
||||
const char * fmt = "http://www.transmissionbt.com/help/gtk/%d.%dx";
|
||||
int major, minor;
|
||||
sscanf (SHORT_VERSION_STRING, "%d.%d", &major, &minor);
|
||||
char url[128];
|
||||
tr_snprintf (url, sizeof (url), fmt, major, minor/10);
|
||||
QDesktopServices :: openUrl (QUrl (url));
|
||||
QDesktopServices::openUrl (QUrl (url));
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshTitle ()
|
||||
TrMainWindow::refreshTitle ()
|
||||
{
|
||||
QString title ("Transmission");
|
||||
const QUrl url (mySession.getRemoteUrl ());
|
||||
@@ -691,7 +691,7 @@ TrMainWindow :: refreshTitle ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshTrayIconSoon ()
|
||||
TrMainWindow::refreshTrayIconSoon ()
|
||||
{
|
||||
if (!myRefreshTrayIconTimer.isActive ())
|
||||
{
|
||||
@@ -700,7 +700,7 @@ TrMainWindow :: refreshTrayIconSoon ()
|
||||
}
|
||||
}
|
||||
void
|
||||
TrMainWindow :: refreshTrayIcon ()
|
||||
TrMainWindow::refreshTrayIcon ()
|
||||
{
|
||||
Speed upSpeed, downSpeed;
|
||||
size_t upCount, downCount;
|
||||
@@ -730,7 +730,7 @@ TrMainWindow :: refreshTrayIcon ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshStatusBar ()
|
||||
TrMainWindow::refreshStatusBar ()
|
||||
{
|
||||
Speed upSpeed, downSpeed;
|
||||
size_t upCount, downCount;
|
||||
@@ -773,7 +773,7 @@ TrMainWindow :: refreshStatusBar ()
|
||||
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshActionSensitivitySoon ()
|
||||
TrMainWindow::refreshActionSensitivitySoon ()
|
||||
{
|
||||
if (!myRefreshActionSensitivityTimer.isActive ())
|
||||
{
|
||||
@@ -782,7 +782,7 @@ TrMainWindow :: refreshActionSensitivitySoon ()
|
||||
}
|
||||
}
|
||||
void
|
||||
TrMainWindow :: refreshActionSensitivity ()
|
||||
TrMainWindow::refreshActionSensitivity ()
|
||||
{
|
||||
int selected (0);
|
||||
int paused (0);
|
||||
@@ -848,13 +848,13 @@ TrMainWindow :: refreshActionSensitivity ()
|
||||
**/
|
||||
|
||||
void
|
||||
TrMainWindow :: clearSelection ()
|
||||
TrMainWindow::clearSelection ()
|
||||
{
|
||||
ui.action_DeselectAll->trigger ();
|
||||
}
|
||||
|
||||
QSet<int>
|
||||
TrMainWindow :: getSelectedTorrents () const
|
||||
TrMainWindow::getSelectedTorrents () const
|
||||
{
|
||||
QSet<int> ids;
|
||||
|
||||
@@ -868,67 +868,67 @@ TrMainWindow :: getSelectedTorrents () const
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: startSelected ()
|
||||
TrMainWindow::startSelected ()
|
||||
{
|
||||
mySession.startTorrents (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: startSelectedNow ()
|
||||
TrMainWindow::startSelectedNow ()
|
||||
{
|
||||
mySession.startTorrentsNow (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: pauseSelected ()
|
||||
TrMainWindow::pauseSelected ()
|
||||
{
|
||||
mySession.pauseTorrents (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: queueMoveTop ()
|
||||
TrMainWindow::queueMoveTop ()
|
||||
{
|
||||
mySession.queueMoveTop (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: queueMoveUp ()
|
||||
TrMainWindow::queueMoveUp ()
|
||||
{
|
||||
mySession.queueMoveUp (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: queueMoveDown ()
|
||||
TrMainWindow::queueMoveDown ()
|
||||
{
|
||||
mySession.queueMoveDown (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: queueMoveBottom ()
|
||||
TrMainWindow::queueMoveBottom ()
|
||||
{
|
||||
mySession.queueMoveBottom (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: startAll ()
|
||||
TrMainWindow::startAll ()
|
||||
{
|
||||
mySession.startTorrents ();
|
||||
}
|
||||
void
|
||||
TrMainWindow :: pauseAll ()
|
||||
TrMainWindow::pauseAll ()
|
||||
{
|
||||
mySession.pauseTorrents ();
|
||||
}
|
||||
void
|
||||
TrMainWindow :: removeSelected ()
|
||||
TrMainWindow::removeSelected ()
|
||||
{
|
||||
removeTorrents (false);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: deleteSelected ()
|
||||
TrMainWindow::deleteSelected ()
|
||||
{
|
||||
removeTorrents (true);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: verifySelected ()
|
||||
TrMainWindow::verifySelected ()
|
||||
{
|
||||
mySession.verifyTorrents (getSelectedTorrents ());
|
||||
}
|
||||
void
|
||||
TrMainWindow :: reannounceSelected ()
|
||||
TrMainWindow::reannounceSelected ()
|
||||
{
|
||||
mySession.reannounceTorrents (getSelectedTorrents ());
|
||||
}
|
||||
@@ -937,39 +937,39 @@ TrMainWindow :: reannounceSelected ()
|
||||
***
|
||||
**/
|
||||
|
||||
void TrMainWindow :: showTotalRatio () { myPrefs.set (Prefs::STATUSBAR_STATS, "total-ratio"); }
|
||||
void TrMainWindow :: showTotalTransfer () { myPrefs.set (Prefs::STATUSBAR_STATS, "total-transfer"); }
|
||||
void TrMainWindow :: showSessionRatio () { myPrefs.set (Prefs::STATUSBAR_STATS, "session-ratio"); }
|
||||
void TrMainWindow :: showSessionTransfer () { myPrefs.set (Prefs::STATUSBAR_STATS, "session-transfer"); }
|
||||
void TrMainWindow::showTotalRatio () { myPrefs.set (Prefs::STATUSBAR_STATS, "total-ratio"); }
|
||||
void TrMainWindow::showTotalTransfer () { myPrefs.set (Prefs::STATUSBAR_STATS, "total-transfer"); }
|
||||
void TrMainWindow::showSessionRatio () { myPrefs.set (Prefs::STATUSBAR_STATS, "session-ratio"); }
|
||||
void TrMainWindow::showSessionTransfer () { myPrefs.set (Prefs::STATUSBAR_STATS, "session-transfer"); }
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
||||
void
|
||||
TrMainWindow :: setCompactView (bool visible)
|
||||
TrMainWindow::setCompactView (bool visible)
|
||||
{
|
||||
myPrefs.set (Prefs :: COMPACT_VIEW, visible);
|
||||
myPrefs.set (Prefs::COMPACT_VIEW, visible);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: toggleSpeedMode ()
|
||||
TrMainWindow::toggleSpeedMode ()
|
||||
{
|
||||
myPrefs.toggleBool (Prefs :: ALT_SPEED_LIMIT_ENABLED);
|
||||
myPrefs.toggleBool (Prefs::ALT_SPEED_LIMIT_ENABLED);
|
||||
const bool mode = myPrefs.get<bool> (Prefs::ALT_SPEED_LIMIT_ENABLED);
|
||||
myAltSpeedAction->setIcon (mode ? mySpeedModeOnIcon : mySpeedModeOffIcon);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: setToolbarVisible (bool visible)
|
||||
TrMainWindow::setToolbarVisible (bool visible)
|
||||
{
|
||||
myPrefs.set (Prefs::TOOLBAR, visible);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: setFilterbarVisible (bool visible)
|
||||
TrMainWindow::setFilterbarVisible (bool visible)
|
||||
{
|
||||
myPrefs.set (Prefs::FILTERBAR, visible);
|
||||
}
|
||||
void
|
||||
TrMainWindow :: setStatusbarVisible (bool visible)
|
||||
TrMainWindow::setStatusbarVisible (bool visible)
|
||||
{
|
||||
myPrefs.set (Prefs::STATUSBAR, visible);
|
||||
}
|
||||
@@ -979,7 +979,7 @@ TrMainWindow :: setStatusbarVisible (bool visible)
|
||||
**/
|
||||
|
||||
void
|
||||
TrMainWindow :: toggleWindows (bool doShow)
|
||||
TrMainWindow::toggleWindows (bool doShow)
|
||||
{
|
||||
if (!doShow)
|
||||
{
|
||||
@@ -996,7 +996,7 @@ TrMainWindow :: toggleWindows (bool doShow)
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: trayActivated (QSystemTrayIcon::ActivationReason reason)
|
||||
TrMainWindow::trayActivated (QSystemTrayIcon::ActivationReason reason)
|
||||
{
|
||||
if ((reason == QSystemTrayIcon::Trigger) ||
|
||||
(reason == QSystemTrayIcon::DoubleClick))
|
||||
@@ -1010,7 +1010,7 @@ TrMainWindow :: trayActivated (QSystemTrayIcon::ActivationReason reason)
|
||||
|
||||
|
||||
void
|
||||
TrMainWindow :: refreshPref (int key)
|
||||
TrMainWindow::refreshPref (int key)
|
||||
{
|
||||
bool b;
|
||||
int i;
|
||||
@@ -1118,11 +1118,11 @@ TrMainWindow :: refreshPref (int key)
|
||||
myPrefs.getInt (Prefs::MAIN_WINDOW_HEIGHT));
|
||||
break;
|
||||
|
||||
case Prefs :: ALT_SPEED_LIMIT_ENABLED:
|
||||
case Prefs :: ALT_SPEED_LIMIT_UP:
|
||||
case Prefs :: ALT_SPEED_LIMIT_DOWN:
|
||||
case Prefs::ALT_SPEED_LIMIT_ENABLED:
|
||||
case Prefs::ALT_SPEED_LIMIT_UP:
|
||||
case Prefs::ALT_SPEED_LIMIT_DOWN:
|
||||
{
|
||||
b = myPrefs.getBool (Prefs :: ALT_SPEED_LIMIT_ENABLED);
|
||||
b = myPrefs.getBool (Prefs::ALT_SPEED_LIMIT_ENABLED);
|
||||
myAltSpeedButton->setChecked (b);
|
||||
myAltSpeedButton->setIcon (b ? mySpeedModeOnIcon : mySpeedModeOffIcon);
|
||||
const QString fmt = b ? tr ("Click to disable Temporary Speed Limits\n (%1 down, %2 up)")
|
||||
@@ -1146,14 +1146,14 @@ TrMainWindow :: refreshPref (int key)
|
||||
#define SHOW_OPTIONS_CHECKBOX_NAME "show-options-checkbox"
|
||||
|
||||
void
|
||||
TrMainWindow :: newTorrent ()
|
||||
TrMainWindow::newTorrent ()
|
||||
{
|
||||
MakeDialog * dialog = new MakeDialog (mySession, this);
|
||||
dialog->show ();
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openTorrent ()
|
||||
TrMainWindow::openTorrent ()
|
||||
{
|
||||
QFileDialog * d;
|
||||
d = new QFileDialog (this,
|
||||
@@ -1181,7 +1181,7 @@ TrMainWindow :: openTorrent ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: openURL ()
|
||||
TrMainWindow::openURL ()
|
||||
{
|
||||
QString str = QApplication::clipboard ()->text (QClipboard::Selection);
|
||||
|
||||
@@ -1195,7 +1195,7 @@ TrMainWindow :: openURL ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: addTorrents (const QStringList& filenames)
|
||||
TrMainWindow::addTorrents (const QStringList& filenames)
|
||||
{
|
||||
bool showOptions = myPrefs.getBool (Prefs::OPTIONS_PROMPT);
|
||||
|
||||
@@ -1212,23 +1212,23 @@ TrMainWindow :: addTorrents (const QStringList& filenames)
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: addTorrent (const AddData& addMe, bool showOptions)
|
||||
TrMainWindow::addTorrent (const AddData& addMe, bool showOptions)
|
||||
{
|
||||
if (showOptions)
|
||||
{
|
||||
Options * o = new Options (mySession, myPrefs, addMe, this);
|
||||
o->show ();
|
||||
QApplication :: alert (o);
|
||||
QApplication::alert (o);
|
||||
}
|
||||
else
|
||||
{
|
||||
mySession.addTorrent (addMe);
|
||||
QApplication :: alert (this);
|
||||
QApplication::alert (this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: removeTorrents (const bool deleteFiles)
|
||||
TrMainWindow::removeTorrents (const bool deleteFiles)
|
||||
{
|
||||
QSet<int> ids;
|
||||
QMessageBox msgBox (this);
|
||||
@@ -1335,7 +1335,7 @@ TrMainWindow :: removeTorrents (const bool deleteFiles)
|
||||
***/
|
||||
|
||||
void
|
||||
TrMainWindow :: updateNetworkIcon ()
|
||||
TrMainWindow::updateNetworkIcon ()
|
||||
{
|
||||
const time_t now = time (NULL);
|
||||
const int period = 3;
|
||||
@@ -1376,26 +1376,26 @@ TrMainWindow :: updateNetworkIcon ()
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: onNetworkTimer ()
|
||||
TrMainWindow::onNetworkTimer ()
|
||||
{
|
||||
updateNetworkIcon ();
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: dataReadProgress ()
|
||||
TrMainWindow::dataReadProgress ()
|
||||
{
|
||||
if (!myNetworkError)
|
||||
myLastReadTime = time (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: dataSendProgress ()
|
||||
TrMainWindow::dataSendProgress ()
|
||||
{
|
||||
myLastSendTime = time (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: onError (QNetworkReply::NetworkError code)
|
||||
TrMainWindow::onError (QNetworkReply::NetworkError code)
|
||||
{
|
||||
const bool hadError = myNetworkError;
|
||||
const bool haveError = (code != QNetworkReply::NoError)
|
||||
@@ -1412,13 +1412,13 @@ TrMainWindow :: onError (QNetworkReply::NetworkError code)
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: errorMessage (const QString msg)
|
||||
TrMainWindow::errorMessage (const QString msg)
|
||||
{
|
||||
myErrorMessage = msg;
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: wrongAuthentication ()
|
||||
TrMainWindow::wrongAuthentication ()
|
||||
{
|
||||
mySession.stop ();
|
||||
mySessionDialog->show ();
|
||||
@@ -1429,7 +1429,7 @@ TrMainWindow :: wrongAuthentication ()
|
||||
***/
|
||||
|
||||
void
|
||||
TrMainWindow :: dragEnterEvent (QDragEnterEvent * event)
|
||||
TrMainWindow::dragEnterEvent (QDragEnterEvent * event)
|
||||
{
|
||||
const QMimeData * mime = event->mimeData ();
|
||||
|
||||
@@ -1441,7 +1441,7 @@ TrMainWindow :: dragEnterEvent (QDragEnterEvent * event)
|
||||
}
|
||||
|
||||
void
|
||||
TrMainWindow :: dropEvent (QDropEvent * event)
|
||||
TrMainWindow::dropEvent (QDropEvent * event)
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
@@ -1476,7 +1476,7 @@ TrMainWindow :: dropEvent (QDropEvent * event)
|
||||
***/
|
||||
|
||||
void
|
||||
TrMainWindow :: contextMenuEvent (QContextMenuEvent * event)
|
||||
TrMainWindow::contextMenuEvent (QContextMenuEvent * event)
|
||||
{
|
||||
QMenu * menu = new QMenu (this);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
***/
|
||||
|
||||
void
|
||||
MakeDialog :: onNewDialogDestroyed (QObject * o)
|
||||
MakeDialog::onNewDialogDestroyed (QObject * o)
|
||||
{
|
||||
Q_UNUSED (o);
|
||||
|
||||
@@ -51,7 +51,7 @@ MakeDialog :: onNewDialogDestroyed (QObject * o)
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onNewButtonBoxClicked (QAbstractButton * button)
|
||||
MakeDialog::onNewButtonBoxClicked (QAbstractButton * button)
|
||||
{
|
||||
switch (myNewButtonBox->standardButton (button))
|
||||
{
|
||||
@@ -71,7 +71,7 @@ MakeDialog :: onNewButtonBoxClicked (QAbstractButton * button)
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onProgress ()
|
||||
MakeDialog::onProgress ()
|
||||
{
|
||||
// progress bar
|
||||
const tr_metainfo_builder * b = myBuilder;
|
||||
@@ -104,7 +104,7 @@ MakeDialog :: onProgress ()
|
||||
|
||||
|
||||
void
|
||||
MakeDialog :: makeTorrent ()
|
||||
MakeDialog::makeTorrent ()
|
||||
{
|
||||
if (!myBuilder)
|
||||
return;
|
||||
@@ -172,7 +172,7 @@ MakeDialog :: makeTorrent ()
|
||||
***/
|
||||
|
||||
void
|
||||
MakeDialog :: onFileClicked ()
|
||||
MakeDialog::onFileClicked ()
|
||||
{
|
||||
QFileDialog * d = new QFileDialog (this, tr ("Select File"));
|
||||
d->setFileMode (QFileDialog::ExistingFile);
|
||||
@@ -182,13 +182,13 @@ MakeDialog :: onFileClicked ()
|
||||
d->show ();
|
||||
}
|
||||
void
|
||||
MakeDialog :: onFileSelected (const QStringList& list)
|
||||
MakeDialog::onFileSelected (const QStringList& list)
|
||||
{
|
||||
if (!list.empty ())
|
||||
onFileSelected (list.front ());
|
||||
}
|
||||
void
|
||||
MakeDialog :: onFileSelected (const QString& filename)
|
||||
MakeDialog::onFileSelected (const QString& filename)
|
||||
{
|
||||
myFile = Utils::removeTrailingDirSeparator (filename);
|
||||
myFileButton->setText (QFileInfo(myFile).fileName());
|
||||
@@ -196,7 +196,7 @@ MakeDialog :: onFileSelected (const QString& filename)
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onFolderClicked ()
|
||||
MakeDialog::onFolderClicked ()
|
||||
{
|
||||
QFileDialog * d = new QFileDialog (this, tr ("Select Folder"));
|
||||
d->setFileMode (QFileDialog::Directory);
|
||||
@@ -208,14 +208,14 @@ MakeDialog :: onFolderClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onFolderSelected (const QStringList& list)
|
||||
MakeDialog::onFolderSelected (const QStringList& list)
|
||||
{
|
||||
if (!list.empty ())
|
||||
onFolderSelected (list.front ());
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onFolderSelected (const QString& filename)
|
||||
MakeDialog::onFolderSelected (const QString& filename)
|
||||
{
|
||||
myFolder = Utils::removeTrailingDirSeparator (filename);
|
||||
myFolderButton->setText (QFileInfo(myFolder).fileName());
|
||||
@@ -223,7 +223,7 @@ MakeDialog :: onFolderSelected (const QString& filename)
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onDestinationClicked ()
|
||||
MakeDialog::onDestinationClicked ()
|
||||
{
|
||||
QFileDialog * d = new QFileDialog (this, tr ("Select Folder"));
|
||||
d->setFileMode (QFileDialog::Directory);
|
||||
@@ -234,39 +234,39 @@ MakeDialog :: onDestinationClicked ()
|
||||
d->show ();
|
||||
}
|
||||
void
|
||||
MakeDialog :: onDestinationSelected (const QStringList& list)
|
||||
MakeDialog::onDestinationSelected (const QStringList& list)
|
||||
{
|
||||
if (!list.empty ())
|
||||
onDestinationSelected (list.front());
|
||||
}
|
||||
void
|
||||
MakeDialog :: onDestinationSelected (const QString& filename)
|
||||
MakeDialog::onDestinationSelected (const QString& filename)
|
||||
{
|
||||
myDestination = Utils::removeTrailingDirSeparator (filename);
|
||||
myDestinationButton->setText (QFileInfo(myDestination).fileName());
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: enableBuddyWhenChecked (QRadioButton * box, QWidget * buddy)
|
||||
MakeDialog::enableBuddyWhenChecked (QRadioButton * box, QWidget * buddy)
|
||||
{
|
||||
connect (box, SIGNAL(toggled(bool)), buddy, SLOT(setEnabled(bool)));
|
||||
buddy->setEnabled (box->isChecked ());
|
||||
}
|
||||
void
|
||||
MakeDialog :: enableBuddyWhenChecked (QCheckBox * box, QWidget * buddy)
|
||||
MakeDialog::enableBuddyWhenChecked (QCheckBox * box, QWidget * buddy)
|
||||
{
|
||||
connect (box, SIGNAL(toggled(bool)), buddy, SLOT(setEnabled(bool)));
|
||||
buddy->setEnabled (box->isChecked ());
|
||||
}
|
||||
|
||||
QString
|
||||
MakeDialog :: getSource () const
|
||||
MakeDialog::getSource () const
|
||||
{
|
||||
return myFileRadio->isChecked () ? myFile : myFolder;
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: onButtonBoxClicked (QAbstractButton * button)
|
||||
MakeDialog::onButtonBoxClicked (QAbstractButton * button)
|
||||
{
|
||||
switch (myButtonBox->standardButton (button))
|
||||
{
|
||||
@@ -285,7 +285,7 @@ MakeDialog :: onButtonBoxClicked (QAbstractButton * button)
|
||||
***/
|
||||
|
||||
void
|
||||
MakeDialog :: onSourceChanged ()
|
||||
MakeDialog::onSourceChanged ()
|
||||
{
|
||||
if (myBuilder)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ class ShortPlainTextEdit: public QPlainTextEdit
|
||||
virtual QSize sizeHint () const { return QSize (256, 50); }
|
||||
};
|
||||
|
||||
MakeDialog :: MakeDialog (Session & session, QWidget * parent):
|
||||
MakeDialog::MakeDialog (Session& session, QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog),
|
||||
mySession (session),
|
||||
myBuilder (0)
|
||||
@@ -338,7 +338,7 @@ MakeDialog :: MakeDialog (Session & session, QWidget * parent):
|
||||
|
||||
setWindowTitle (tr ("New Torrent"));
|
||||
QVBoxLayout * top = new QVBoxLayout (this);
|
||||
top->setSpacing (HIG :: PAD);
|
||||
top->setSpacing (HIG::PAD);
|
||||
|
||||
HIG * hig = new HIG;
|
||||
hig->setContentsMargins (0, 0, 0, 0);
|
||||
@@ -419,7 +419,7 @@ MakeDialog :: MakeDialog (Session & session, QWidget * parent):
|
||||
onSourceChanged ();
|
||||
}
|
||||
|
||||
MakeDialog :: ~MakeDialog ()
|
||||
MakeDialog::~MakeDialog ()
|
||||
{
|
||||
if (myBuilder)
|
||||
tr_metaInfoBuilderFree (myBuilder);
|
||||
@@ -430,7 +430,7 @@ MakeDialog :: ~MakeDialog ()
|
||||
***/
|
||||
|
||||
void
|
||||
MakeDialog :: dragEnterEvent (QDragEnterEvent * event)
|
||||
MakeDialog::dragEnterEvent (QDragEnterEvent * event)
|
||||
{
|
||||
const QMimeData * mime = event->mimeData ();
|
||||
|
||||
@@ -439,7 +439,7 @@ MakeDialog :: dragEnterEvent (QDragEnterEvent * event)
|
||||
}
|
||||
|
||||
void
|
||||
MakeDialog :: dropEvent (QDropEvent * event)
|
||||
MakeDialog::dropEvent (QDropEvent * event)
|
||||
{
|
||||
const QString filename = event->mimeData()->urls().front().path();
|
||||
const QFileInfo fileInfo (filename);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
****
|
||||
***/
|
||||
|
||||
Options :: Options (Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent):
|
||||
Options::Options (Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog),
|
||||
mySession (session),
|
||||
myAdd (addme),
|
||||
@@ -72,7 +72,7 @@ Options :: Options (Session& session, const Prefs& prefs, const AddData& addme,
|
||||
myEditTimer.setSingleShot (true);
|
||||
connect (&myEditTimer, SIGNAL (timeout ()), this, SLOT (onDestinationEditedIdle ()));
|
||||
|
||||
const int iconSize (style ()->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
const int iconSize (style ()->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
QIcon fileIcon = style ()->standardIcon (QStyle::SP_FileIcon);
|
||||
const QPixmap filePixmap = fileIcon.pixmap (iconSize);
|
||||
|
||||
@@ -163,11 +163,11 @@ Options :: Options (Session& session, const Prefs& prefs, const AddData& addme,
|
||||
|
||||
QCheckBox * c;
|
||||
c = myStartCheck = new QCheckBox (tr ("S&tart when added"));
|
||||
c->setChecked (prefs.getBool (Prefs :: START));
|
||||
c->setChecked (prefs.getBool (Prefs::START));
|
||||
layout->addWidget (c, ++row, 0, 1, 2, Qt::AlignLeft);
|
||||
|
||||
c = myTrashCheck = new QCheckBox (tr ("Mo&ve .torrent file to the trash"));
|
||||
c->setChecked (prefs.getBool (Prefs :: TRASH_ORIGINAL));
|
||||
c->setChecked (prefs.getBool (Prefs::TRASH_ORIGINAL));
|
||||
layout->addWidget (c, ++row, 0, 1, 2, Qt::AlignLeft);
|
||||
|
||||
QDialogButtonBox * b = new QDialogButtonBox (QDialogButtonBox::Open|QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||
@@ -177,7 +177,7 @@ Options :: Options (Session& session, const Prefs& prefs, const AddData& addme,
|
||||
|
||||
layout->setRowStretch (3, 2);
|
||||
layout->setColumnStretch (1, 2);
|
||||
layout->setSpacing (HIG :: PAD);
|
||||
layout->setSpacing (HIG::PAD);
|
||||
|
||||
connect (myTree, SIGNAL (priorityChanged (const QSet<int>&,int)), this, SLOT (onPriorityChanged (const QSet<int>&,int)));
|
||||
connect (myTree, SIGNAL (wantedChanged (const QSet<int>&,bool)), this, SLOT (onWantedChanged (const QSet<int>&,bool)));
|
||||
@@ -189,7 +189,7 @@ Options :: Options (Session& session, const Prefs& prefs, const AddData& addme,
|
||||
reload ();
|
||||
}
|
||||
|
||||
Options :: ~Options ()
|
||||
Options::~Options ()
|
||||
{
|
||||
clearInfo ();
|
||||
}
|
||||
@@ -199,7 +199,7 @@ Options :: ~Options ()
|
||||
***/
|
||||
|
||||
void
|
||||
Options :: refreshButton (QPushButton * p, const QString& text, int width)
|
||||
Options::refreshButton (QPushButton * p, const QString& text, int width)
|
||||
{
|
||||
if (width <= 0)
|
||||
width = p->width ();
|
||||
@@ -210,7 +210,7 @@ Options :: refreshButton (QPushButton * p, const QString& text, int width)
|
||||
}
|
||||
|
||||
void
|
||||
Options :: refreshSource (int width)
|
||||
Options::refreshSource (int width)
|
||||
{
|
||||
QString text = myAdd.readableName ();
|
||||
|
||||
@@ -222,7 +222,7 @@ Options :: refreshSource (int width)
|
||||
}
|
||||
|
||||
void
|
||||
Options :: refreshDestinationButton (int width)
|
||||
Options::refreshDestinationButton (int width)
|
||||
{
|
||||
if (myDestinationButton != 0)
|
||||
refreshButton (myDestinationButton, myLocalDestination.absolutePath (), width);
|
||||
@@ -230,7 +230,7 @@ Options :: refreshDestinationButton (int width)
|
||||
|
||||
|
||||
bool
|
||||
Options :: eventFilter (QObject * o, QEvent * event)
|
||||
Options::eventFilter (QObject * o, QEvent * event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ Options :: eventFilter (QObject * o, QEvent * event)
|
||||
***/
|
||||
|
||||
void
|
||||
Options :: clearInfo ()
|
||||
Options::clearInfo ()
|
||||
{
|
||||
if (myHaveInfo)
|
||||
tr_metainfoFree (&myInfo);
|
||||
@@ -259,7 +259,7 @@ Options :: clearInfo ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: reload ()
|
||||
Options::reload ()
|
||||
{
|
||||
clearInfo ();
|
||||
clearVerify ();
|
||||
@@ -319,21 +319,21 @@ Options :: reload ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onPriorityChanged (const QSet<int>& fileIndices, int priority)
|
||||
Options::onPriorityChanged (const QSet<int>& fileIndices, int priority)
|
||||
{
|
||||
foreach (int i, fileIndices)
|
||||
myPriorities[i] = priority;
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onWantedChanged (const QSet<int>& fileIndices, bool isWanted)
|
||||
Options::onWantedChanged (const QSet<int>& fileIndices, bool isWanted)
|
||||
{
|
||||
foreach (int i, fileIndices)
|
||||
myWanted[i] = isWanted;
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onAccepted ()
|
||||
Options::onAccepted ()
|
||||
{
|
||||
// rpc spec section 3.4 "adding a torrent"
|
||||
|
||||
@@ -395,7 +395,7 @@ Options :: onAccepted ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onFilenameClicked ()
|
||||
Options::onFilenameClicked ()
|
||||
{
|
||||
if (myAdd.type == AddData::FILENAME)
|
||||
{
|
||||
@@ -411,7 +411,7 @@ Options :: onFilenameClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onFilesSelected (const QStringList& files)
|
||||
Options::onFilesSelected (const QStringList& files)
|
||||
{
|
||||
if (files.size () == 1)
|
||||
{
|
||||
@@ -422,13 +422,13 @@ Options :: onFilesSelected (const QStringList& files)
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onSourceEditingFinished ()
|
||||
Options::onSourceEditingFinished ()
|
||||
{
|
||||
myAdd.set (mySourceEdit->text());
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onDestinationClicked ()
|
||||
Options::onDestinationClicked ()
|
||||
{
|
||||
QFileDialog * d = new QFileDialog (this, tr ("Select Destination"), myLocalDestination.absolutePath ());
|
||||
d->setFileMode (QFileDialog::Directory);
|
||||
@@ -438,7 +438,7 @@ Options :: onDestinationClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onDestinationsSelected (const QStringList& destinations)
|
||||
Options::onDestinationsSelected (const QStringList& destinations)
|
||||
{
|
||||
if (destinations.size () == 1)
|
||||
{
|
||||
@@ -450,7 +450,7 @@ Options :: onDestinationsSelected (const QStringList& destinations)
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onDestinationEdited (const QString& text)
|
||||
Options::onDestinationEdited (const QString& text)
|
||||
{
|
||||
Q_UNUSED (text);
|
||||
|
||||
@@ -458,7 +458,7 @@ Options :: onDestinationEdited (const QString& text)
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onDestinationEditedIdle ()
|
||||
Options::onDestinationEditedIdle ()
|
||||
{
|
||||
myFreespaceLabel->setPath (myDestinationEdit->text());
|
||||
}
|
||||
@@ -470,7 +470,7 @@ Options :: onDestinationEditedIdle ()
|
||||
***/
|
||||
|
||||
void
|
||||
Options :: clearVerify ()
|
||||
Options::clearVerify ()
|
||||
{
|
||||
myVerifyHash.reset ();
|
||||
myVerifyFile.close ();
|
||||
@@ -488,7 +488,7 @@ Options :: clearVerify ()
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onVerify ()
|
||||
Options::onVerify ()
|
||||
{
|
||||
clearVerify ();
|
||||
myVerifyFlags.insert (0, myInfo.pieceCount, false);
|
||||
@@ -507,7 +507,7 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
Options :: onTimeout ()
|
||||
Options::onTimeout ()
|
||||
{
|
||||
if (myFiles.isEmpty())
|
||||
{
|
||||
|
||||
@@ -51,14 +51,14 @@ namespace
|
||||
};
|
||||
|
||||
void
|
||||
PrefsDialog :: checkBoxToggled (bool checked)
|
||||
PrefsDialog::checkBoxToggled (bool checked)
|
||||
{
|
||||
const int key (sender ()->property (PREF_KEY).toInt ());
|
||||
setPref (key, checked);
|
||||
}
|
||||
|
||||
QCheckBox *
|
||||
PrefsDialog :: checkBoxNew (const QString& text, int key)
|
||||
PrefsDialog::checkBoxNew (const QString& text, int key)
|
||||
{
|
||||
QCheckBox * box = new QCheckBox (text);
|
||||
box->setChecked (myPrefs.getBool (key));
|
||||
@@ -69,14 +69,14 @@ PrefsDialog :: checkBoxNew (const QString& text, int key)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: enableBuddyWhenChecked (QCheckBox * box, QWidget * buddy)
|
||||
PrefsDialog::enableBuddyWhenChecked (QCheckBox * box, QWidget * buddy)
|
||||
{
|
||||
connect (box, SIGNAL(toggled(bool)), buddy, SLOT(setEnabled(bool)));
|
||||
buddy->setEnabled (box->isChecked ());
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: spinBoxEditingFinished()
|
||||
PrefsDialog::spinBoxEditingFinished ()
|
||||
{
|
||||
const QObject * spin = sender();
|
||||
const int key = spin->property (PREF_KEY).toInt ();
|
||||
@@ -89,7 +89,7 @@ PrefsDialog :: spinBoxEditingFinished()
|
||||
}
|
||||
|
||||
QSpinBox *
|
||||
PrefsDialog :: spinBoxNew (int key, int low, int high, int step)
|
||||
PrefsDialog::spinBoxNew (int key, int low, int high, int step)
|
||||
{
|
||||
QSpinBox * spin = new QSpinBox ();
|
||||
spin->setRange (low, high);
|
||||
@@ -102,7 +102,7 @@ PrefsDialog :: spinBoxNew (int key, int low, int high, int step)
|
||||
}
|
||||
|
||||
QDoubleSpinBox *
|
||||
PrefsDialog :: doubleSpinBoxNew (int key, double low, double high, double step, int decimals)
|
||||
PrefsDialog::doubleSpinBoxNew (int key, double low, double high, double step, int decimals)
|
||||
{
|
||||
QDoubleSpinBox * spin = new QDoubleSpinBox ();
|
||||
spin->setRange (low, high);
|
||||
@@ -142,7 +142,7 @@ PrefsDialog::timeEditNew (int key)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: lineEditingFinished ()
|
||||
PrefsDialog::lineEditingFinished ()
|
||||
{
|
||||
QLineEdit * e = qobject_cast<QLineEdit*>(sender());
|
||||
if (e && e->isModified ())
|
||||
@@ -154,7 +154,7 @@ PrefsDialog :: lineEditingFinished ()
|
||||
}
|
||||
|
||||
QLineEdit*
|
||||
PrefsDialog :: lineEditNew (int key, int echoMode)
|
||||
PrefsDialog::lineEditNew (int key, int echoMode)
|
||||
{
|
||||
QLineEdit * e = new QLineEdit (myPrefs.getString (key));
|
||||
e->setProperty (PREF_KEY, key);
|
||||
@@ -169,7 +169,7 @@ PrefsDialog :: lineEditNew (int key, int echoMode)
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createRemoteTab (Session& session)
|
||||
PrefsDialog::createRemoteTab (Session& session)
|
||||
{
|
||||
HIG * hig = new HIG (this);
|
||||
hig->addSectionTitle (tr ("Remote Control"));
|
||||
@@ -203,7 +203,7 @@ PrefsDialog :: createRemoteTab (Session& session)
|
||||
***/
|
||||
|
||||
void
|
||||
PrefsDialog :: altSpeedDaysEdited (int i)
|
||||
PrefsDialog::altSpeedDaysEdited (int i)
|
||||
{
|
||||
const int value = qobject_cast<QComboBox*>(sender())->itemData(i).toInt();
|
||||
setPref (Prefs::ALT_SPEED_LIMIT_TIME_DAY, value);
|
||||
@@ -211,7 +211,7 @@ PrefsDialog :: altSpeedDaysEdited (int i)
|
||||
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createSpeedTab ()
|
||||
PrefsDialog::createSpeedTab ()
|
||||
{
|
||||
QWidget *l, *r;
|
||||
HIG * hig = new HIG (this);
|
||||
@@ -230,7 +230,7 @@ PrefsDialog :: createSpeedTab ()
|
||||
|
||||
hig->addSectionDivider ();
|
||||
QHBoxLayout * h = new QHBoxLayout;
|
||||
h->setSpacing (HIG :: PAD);
|
||||
h->setSpacing (HIG::PAD);
|
||||
QLabel * label = new QLabel;
|
||||
label->setPixmap (QPixmap (QString::fromUtf8 (":/icons/alt-limit-off.png")));
|
||||
label->setAlignment (Qt::AlignLeft|Qt::AlignVCenter);
|
||||
@@ -245,23 +245,23 @@ PrefsDialog :: createSpeedTab ()
|
||||
hig->addWideControl (new QLabel (s));
|
||||
|
||||
s = tr ("U&pload (%1):").arg (speed_K_str);
|
||||
r = spinBoxNew (Prefs :: ALT_SPEED_LIMIT_UP, 0, INT_MAX, 5);
|
||||
r = spinBoxNew (Prefs::ALT_SPEED_LIMIT_UP, 0, INT_MAX, 5);
|
||||
hig->addRow (s, r);
|
||||
|
||||
s = tr ("Do&wnload (%1):").arg (speed_K_str);
|
||||
r = spinBoxNew (Prefs :: ALT_SPEED_LIMIT_DOWN, 0, INT_MAX, 5);
|
||||
r = spinBoxNew (Prefs::ALT_SPEED_LIMIT_DOWN, 0, INT_MAX, 5);
|
||||
hig->addRow (s, r);
|
||||
|
||||
QCheckBox * c = checkBoxNew (tr ("&Scheduled times:"), Prefs::ALT_SPEED_LIMIT_TIME_ENABLED);
|
||||
h = new QHBoxLayout ();
|
||||
h->setSpacing (HIG::PAD);
|
||||
QWidget * w = timeEditNew (Prefs :: ALT_SPEED_LIMIT_TIME_BEGIN);
|
||||
QWidget * w = timeEditNew (Prefs::ALT_SPEED_LIMIT_TIME_BEGIN);
|
||||
h->addWidget (w, 1);
|
||||
mySchedWidgets << w;
|
||||
QLabel * nd = new QLabel (tr("&to"));
|
||||
h->addWidget (nd);
|
||||
mySchedWidgets << nd;
|
||||
w = timeEditNew (Prefs :: ALT_SPEED_LIMIT_TIME_END);
|
||||
w = timeEditNew (Prefs::ALT_SPEED_LIMIT_TIME_END);
|
||||
nd->setBuddy (w);
|
||||
h->addWidget (w, 1);
|
||||
mySchedWidgets << w;
|
||||
@@ -280,7 +280,7 @@ PrefsDialog :: createSpeedTab ()
|
||||
box->addItem (noIcon, tr ("Thursday"), QVariant (TR_SCHED_THURS));
|
||||
box->addItem (noIcon, tr ("Friday"), QVariant (TR_SCHED_FRI));
|
||||
box->addItem (noIcon, tr ("Saturday"), QVariant (TR_SCHED_SAT));
|
||||
box->setCurrentIndex (box->findData (myPrefs.getInt (Prefs :: ALT_SPEED_LIMIT_TIME_DAY)));
|
||||
box->setCurrentIndex (box->findData (myPrefs.getInt (Prefs::ALT_SPEED_LIMIT_TIME_DAY)));
|
||||
connect (box, SIGNAL(activated(int)), this, SLOT(altSpeedDaysEdited(int)));
|
||||
w = hig->addRow (s, box);
|
||||
mySchedWidgets << w << box;
|
||||
@@ -294,7 +294,7 @@ PrefsDialog :: createSpeedTab ()
|
||||
***/
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createDesktopTab ()
|
||||
PrefsDialog::createDesktopTab ()
|
||||
{
|
||||
HIG * hig = new HIG (this);
|
||||
hig->addSectionTitle (tr ("Desktop"));
|
||||
@@ -318,7 +318,7 @@ PrefsDialog :: createDesktopTab ()
|
||||
***/
|
||||
|
||||
void
|
||||
PrefsDialog :: onPortTested (bool isOpen)
|
||||
PrefsDialog::onPortTested (bool isOpen)
|
||||
{
|
||||
myPortButton->setEnabled (true);
|
||||
myWidgets[Prefs::PEER_PORT]->setEnabled (true);
|
||||
@@ -327,7 +327,7 @@ PrefsDialog :: onPortTested (bool isOpen)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onPortTest ()
|
||||
PrefsDialog::onPortTest ()
|
||||
{
|
||||
myPortLabel->setText (tr ("Testing TCP Port..."));
|
||||
myPortButton->setEnabled (false);
|
||||
@@ -336,7 +336,7 @@ PrefsDialog :: onPortTest ()
|
||||
}
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createNetworkTab ()
|
||||
PrefsDialog::createNetworkTab ()
|
||||
{
|
||||
HIG * hig = new HIG (this);
|
||||
hig->addSectionTitle (tr ("Incoming Peers"));
|
||||
@@ -346,7 +346,7 @@ PrefsDialog :: createNetworkTab ()
|
||||
QPushButton * b = myPortButton = new QPushButton (tr ("Te&st Port"));
|
||||
QLabel * l = myPortLabel = new QLabel (tr ("Status unknown"));
|
||||
h->addWidget (l);
|
||||
h->addSpacing (HIG :: PAD_BIG);
|
||||
h->addSpacing (HIG::PAD_BIG);
|
||||
h->addWidget (b);
|
||||
h->setStretchFactor (l, 1);
|
||||
connect (b, SIGNAL(clicked(bool)), this, SLOT(onPortTest()));
|
||||
@@ -354,7 +354,7 @@ PrefsDialog :: createNetworkTab ()
|
||||
|
||||
hig->addRow (tr ("&Port for incoming connections:"), s);
|
||||
hig->addRow (QString(), h, 0);
|
||||
hig->addWideControl (checkBoxNew (tr ("Pick a &random port every time Transmission is started"), Prefs :: PEER_PORT_RANDOM_ON_START));
|
||||
hig->addWideControl (checkBoxNew (tr ("Pick a &random port every time Transmission is started"), Prefs::PEER_PORT_RANDOM_ON_START));
|
||||
hig->addWideControl (checkBoxNew (tr ("Use UPnP or NAT-PMP port &forwarding from my router"), Prefs::PORT_FORWARDING));
|
||||
|
||||
hig->addSectionDivider ();
|
||||
@@ -384,7 +384,7 @@ PrefsDialog :: createNetworkTab ()
|
||||
***/
|
||||
|
||||
void
|
||||
PrefsDialog :: onBlocklistDialogDestroyed (QObject * o)
|
||||
PrefsDialog::onBlocklistDialogDestroyed (QObject * o)
|
||||
{
|
||||
Q_UNUSED (o);
|
||||
|
||||
@@ -392,21 +392,21 @@ PrefsDialog :: onBlocklistDialogDestroyed (QObject * o)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onUpdateBlocklistCancelled ()
|
||||
PrefsDialog::onUpdateBlocklistCancelled ()
|
||||
{
|
||||
disconnect (&mySession, SIGNAL(blocklistUpdated(int)), this, SLOT(onBlocklistUpdated(int)));
|
||||
myBlocklistDialog->deleteLater ();
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onBlocklistUpdated (int n)
|
||||
PrefsDialog::onBlocklistUpdated (int n)
|
||||
{
|
||||
myBlocklistDialog->setText (tr ("<b>Update succeeded!</b><p>Blocklist now has %Ln rules.", 0, n));
|
||||
myBlocklistDialog->setTextFormat (Qt::RichText);
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onUpdateBlocklistClicked ()
|
||||
PrefsDialog::onUpdateBlocklistClicked ()
|
||||
{
|
||||
myBlocklistDialog = new QMessageBox (QMessageBox::Information,
|
||||
QString(),
|
||||
@@ -420,14 +420,14 @@ PrefsDialog :: onUpdateBlocklistClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: encryptionEdited (int i)
|
||||
PrefsDialog::encryptionEdited (int i)
|
||||
{
|
||||
const int value (qobject_cast<QComboBox*>(sender())->itemData(i).toInt ());
|
||||
setPref (Prefs::ENCRYPTION, value);
|
||||
}
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createPrivacyTab ()
|
||||
PrefsDialog::createPrivacyTab ()
|
||||
{
|
||||
QWidget * w;
|
||||
HIG * hig = new HIG (this);
|
||||
@@ -438,7 +438,7 @@ PrefsDialog :: createPrivacyTab ()
|
||||
box->addItem (tr ("Allow encryption"), 0);
|
||||
box->addItem (tr ("Prefer encryption"), 1);
|
||||
box->addItem (tr ("Require encryption"), 2);
|
||||
myWidgets.insert (Prefs :: ENCRYPTION, box);
|
||||
myWidgets.insert (Prefs::ENCRYPTION, box);
|
||||
connect (box, SIGNAL(activated(int)), this, SLOT(encryptionEdited(int)));
|
||||
|
||||
hig->addRow (tr ("&Encryption mode:"), box);
|
||||
@@ -476,7 +476,7 @@ PrefsDialog :: createPrivacyTab ()
|
||||
***/
|
||||
|
||||
void
|
||||
PrefsDialog :: onScriptClicked (void)
|
||||
PrefsDialog::onScriptClicked (void)
|
||||
{
|
||||
const QString title = tr ("Select \"Torrent Done\" Script");
|
||||
const QString myPath = myPrefs.getString (Prefs::SCRIPT_TORRENT_DONE_FILENAME);
|
||||
@@ -487,7 +487,7 @@ PrefsDialog :: onScriptClicked (void)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onIncompleteClicked (void)
|
||||
PrefsDialog::onIncompleteClicked (void)
|
||||
{
|
||||
const QString title = tr ("Select Incomplete Directory");
|
||||
const QString myPath = myPrefs.getString (Prefs::INCOMPLETE_DIR);
|
||||
@@ -498,7 +498,7 @@ PrefsDialog :: onIncompleteClicked (void)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onWatchClicked (void)
|
||||
PrefsDialog::onWatchClicked (void)
|
||||
{
|
||||
const QString title = tr ("Select Watch Directory");
|
||||
const QString myPath = myPrefs.getString (Prefs::DIR_WATCH);
|
||||
@@ -509,7 +509,7 @@ PrefsDialog :: onWatchClicked (void)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onDestinationClicked (void)
|
||||
PrefsDialog::onDestinationClicked (void)
|
||||
{
|
||||
const QString title = tr ("Select Destination");
|
||||
const QString myPath = myPrefs.getString (Prefs::DOWNLOAD_DIR);
|
||||
@@ -520,15 +520,15 @@ PrefsDialog :: onDestinationClicked (void)
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: onLocationSelected (const QString& path, int key)
|
||||
PrefsDialog::onLocationSelected (const QString& path, int key)
|
||||
{
|
||||
setPref (key, path);
|
||||
}
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createSeedingTab ()
|
||||
PrefsDialog::createSeedingTab ()
|
||||
{
|
||||
const int iconSize (style ()->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
const int iconSize (style ()->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
const QFileIconProvider iconProvider;
|
||||
const QIcon folderIcon = iconProvider.icon (QFileIconProvider::Folder);
|
||||
const QPixmap folderPixmap = folderIcon.pixmap (iconSize);
|
||||
@@ -554,9 +554,9 @@ PrefsDialog :: createSeedingTab ()
|
||||
}
|
||||
|
||||
QWidget *
|
||||
PrefsDialog :: createDownloadingTab ()
|
||||
PrefsDialog::createDownloadingTab ()
|
||||
{
|
||||
const int iconSize (style ()->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
const int iconSize (style ()->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
const QFileIconProvider iconProvider;
|
||||
const QIcon folderIcon = iconProvider.icon (QFileIconProvider::Folder);
|
||||
const QPixmap folderPixmap = folderIcon.pixmap (iconSize);
|
||||
@@ -630,7 +630,7 @@ PrefsDialog :: createDownloadingTab ()
|
||||
****
|
||||
***/
|
||||
|
||||
PrefsDialog :: PrefsDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
PrefsDialog::PrefsDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
QDialog (parent),
|
||||
myIsServer (session.isServer ()),
|
||||
mySession (session),
|
||||
@@ -657,16 +657,16 @@ PrefsDialog :: PrefsDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
connect (&mySession, SIGNAL(sessionUpdated()), this, SLOT(sessionUpdated()));
|
||||
|
||||
QList<int> keys;
|
||||
keys << Prefs :: RPC_ENABLED
|
||||
<< Prefs :: ALT_SPEED_LIMIT_ENABLED
|
||||
<< Prefs :: ALT_SPEED_LIMIT_TIME_ENABLED
|
||||
<< Prefs :: ENCRYPTION
|
||||
<< Prefs :: BLOCKLIST_ENABLED
|
||||
<< Prefs :: DIR_WATCH
|
||||
<< Prefs :: DOWNLOAD_DIR
|
||||
<< Prefs :: INCOMPLETE_DIR
|
||||
<< Prefs :: INCOMPLETE_DIR_ENABLED
|
||||
<< Prefs :: SCRIPT_TORRENT_DONE_FILENAME;
|
||||
keys << Prefs::RPC_ENABLED
|
||||
<< Prefs::ALT_SPEED_LIMIT_ENABLED
|
||||
<< Prefs::ALT_SPEED_LIMIT_TIME_ENABLED
|
||||
<< Prefs::ENCRYPTION
|
||||
<< Prefs::BLOCKLIST_ENABLED
|
||||
<< Prefs::DIR_WATCH
|
||||
<< Prefs::DOWNLOAD_DIR
|
||||
<< Prefs::INCOMPLETE_DIR
|
||||
<< Prefs::INCOMPLETE_DIR_ENABLED
|
||||
<< Prefs::SCRIPT_TORRENT_DONE_FILENAME;
|
||||
foreach (int key, keys)
|
||||
refreshPref (key);
|
||||
|
||||
@@ -682,12 +682,12 @@ PrefsDialog :: PrefsDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
}
|
||||
}
|
||||
|
||||
PrefsDialog :: ~PrefsDialog ()
|
||||
PrefsDialog::~PrefsDialog ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: setPref (int key, const QVariant& v)
|
||||
PrefsDialog::setPref (int key, const QVariant& v)
|
||||
{
|
||||
myPrefs.set (key, v);
|
||||
refreshPref (key);
|
||||
@@ -698,26 +698,26 @@ PrefsDialog :: setPref (int key, const QVariant& v)
|
||||
***/
|
||||
|
||||
void
|
||||
PrefsDialog :: sessionUpdated ()
|
||||
PrefsDialog::sessionUpdated ()
|
||||
{
|
||||
updateBlocklistLabel ();
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: updateBlocklistLabel ()
|
||||
PrefsDialog::updateBlocklistLabel ()
|
||||
{
|
||||
const int n = mySession.blocklistSize ();
|
||||
myBlocklistLabel->setText (tr ("<i>Blocklist contains %Ln rules</i>", 0, n));
|
||||
}
|
||||
|
||||
void
|
||||
PrefsDialog :: refreshPref (int key)
|
||||
PrefsDialog::refreshPref (int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Prefs :: RPC_ENABLED:
|
||||
case Prefs :: RPC_WHITELIST_ENABLED:
|
||||
case Prefs :: RPC_AUTH_REQUIRED:
|
||||
case Prefs::RPC_ENABLED:
|
||||
case Prefs::RPC_WHITELIST_ENABLED:
|
||||
case Prefs::RPC_AUTH_REQUIRED:
|
||||
{
|
||||
const bool enabled (myPrefs.getBool (Prefs::RPC_ENABLED));
|
||||
const bool whitelist (myPrefs.getBool (Prefs::RPC_WHITELIST_ENABLED));
|
||||
@@ -728,37 +728,37 @@ PrefsDialog :: refreshPref (int key)
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: ALT_SPEED_LIMIT_TIME_ENABLED:
|
||||
case Prefs::ALT_SPEED_LIMIT_TIME_ENABLED:
|
||||
{
|
||||
const bool enabled = myPrefs.getBool (key);
|
||||
foreach (QWidget * w, mySchedWidgets)w->setEnabled (enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: BLOCKLIST_ENABLED:
|
||||
case Prefs::BLOCKLIST_ENABLED:
|
||||
{
|
||||
const bool enabled = myPrefs.getBool (key);
|
||||
foreach (QWidget * w, myBlockWidgets)w->setEnabled (enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: DIR_WATCH:
|
||||
case Prefs::DIR_WATCH:
|
||||
myWatchButton->setText (QFileInfo(myPrefs.getString(Prefs::DIR_WATCH)).fileName());
|
||||
break;
|
||||
|
||||
case Prefs :: SCRIPT_TORRENT_DONE_FILENAME:
|
||||
case Prefs::SCRIPT_TORRENT_DONE_FILENAME:
|
||||
{
|
||||
const QString path (myPrefs.getString (key));
|
||||
myTorrentDoneScriptButton->setText (QFileInfo(path).fileName());
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: PEER_PORT:
|
||||
case Prefs::PEER_PORT:
|
||||
myPortLabel->setText (tr ("Status unknown"));
|
||||
myPortButton->setEnabled (true);
|
||||
break;
|
||||
|
||||
case Prefs :: DOWNLOAD_DIR:
|
||||
case Prefs::DOWNLOAD_DIR:
|
||||
{
|
||||
const QString path (myPrefs.getString (key));
|
||||
myDestinationButton->setText (QFileInfo(path).fileName());
|
||||
@@ -766,14 +766,14 @@ PrefsDialog :: refreshPref (int key)
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: INCOMPLETE_DIR:
|
||||
case Prefs::INCOMPLETE_DIR:
|
||||
{
|
||||
QString path (myPrefs.getString (key));
|
||||
myIncompleteButton->setText (QFileInfo(path).fileName());
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: INCOMPLETE_DIR_ENABLED:
|
||||
case Prefs::INCOMPLETE_DIR_ENABLED:
|
||||
{
|
||||
const bool enabled = myPrefs.getBool (key);
|
||||
myIncompleteButton->setEnabled (enabled);
|
||||
@@ -825,7 +825,7 @@ PrefsDialog :: refreshPref (int key)
|
||||
}
|
||||
|
||||
bool
|
||||
PrefsDialog :: isAllowed (int key) const
|
||||
PrefsDialog::isAllowed (int key) const
|
||||
{
|
||||
Q_UNUSED (key);
|
||||
|
||||
|
||||
20
qt/prefs.cc
20
qt/prefs.cc
@@ -125,7 +125,7 @@ Prefs::PrefItem Prefs::myItems[] =
|
||||
****
|
||||
***/
|
||||
|
||||
Prefs :: Prefs (const char * configDir):
|
||||
Prefs::Prefs (const char * configDir):
|
||||
myConfigDir (QString::fromUtf8 (configDir))
|
||||
{
|
||||
assert (sizeof(myItems) / sizeof(myItems[0]) == PREFS_COUNT);
|
||||
@@ -187,7 +187,7 @@ Prefs :: Prefs (const char * configDir):
|
||||
|
||||
case QVariant::DateTime:
|
||||
if (tr_variantGetInt (b, &intVal))
|
||||
myValues[i].setValue (QDateTime :: fromTime_t (intVal));
|
||||
myValues[i].setValue (QDateTime::fromTime_t (intVal));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -199,7 +199,7 @@ Prefs :: Prefs (const char * configDir):
|
||||
tr_variantFree (&top);
|
||||
}
|
||||
|
||||
Prefs :: ~Prefs ()
|
||||
Prefs::~Prefs ()
|
||||
{
|
||||
// make a dict from settings.json
|
||||
tr_variant current_settings;
|
||||
@@ -273,7 +273,7 @@ Prefs :: ~Prefs ()
|
||||
* If you add a new preferences key, you /must/ add a default value here.
|
||||
*/
|
||||
void
|
||||
Prefs :: initDefaults (tr_variant * d)
|
||||
Prefs::initDefaults (tr_variant * d)
|
||||
{
|
||||
tr_variantDictReserve (d, 38);
|
||||
tr_variantDictAddBool (d, TR_KEY_blocklist_updates_enabled, true);
|
||||
@@ -321,14 +321,14 @@ Prefs :: initDefaults (tr_variant * d)
|
||||
***/
|
||||
|
||||
bool
|
||||
Prefs :: getBool (int key) const
|
||||
Prefs::getBool (int key) const
|
||||
{
|
||||
assert (myItems[key].type == QVariant::Bool);
|
||||
return myValues[key].toBool();
|
||||
}
|
||||
|
||||
QString
|
||||
Prefs :: getString (int key) const
|
||||
Prefs::getString (int key) const
|
||||
{
|
||||
assert (myItems[key].type == QVariant::String);
|
||||
const QByteArray b = myValues[key].toByteArray();
|
||||
@@ -338,21 +338,21 @@ Prefs :: getString (int key) const
|
||||
}
|
||||
|
||||
int
|
||||
Prefs :: getInt (int key) const
|
||||
Prefs::getInt (int key) const
|
||||
{
|
||||
assert (myItems[key].type == QVariant::Int);
|
||||
return myValues[key].toInt();
|
||||
}
|
||||
|
||||
double
|
||||
Prefs :: getDouble (int key) const
|
||||
Prefs::getDouble (int key) const
|
||||
{
|
||||
assert (myItems[key].type == QVariant::Double);
|
||||
return myValues[key].toDouble();
|
||||
}
|
||||
|
||||
QDateTime
|
||||
Prefs :: getDateTime (int key) const
|
||||
Prefs::getDateTime (int key) const
|
||||
{
|
||||
assert (myItems[key].type == QVariant::DateTime);
|
||||
return myValues[key].toDateTime();
|
||||
@@ -363,7 +363,7 @@ Prefs :: getDateTime (int key) const
|
||||
***/
|
||||
|
||||
void
|
||||
Prefs :: toggleBool (int key)
|
||||
Prefs::toggleBool (int key)
|
||||
{
|
||||
set (key, !getBool(key));
|
||||
}
|
||||
|
||||
@@ -26,24 +26,24 @@
|
||||
#include "torrent-model.h"
|
||||
#include "utils.h"
|
||||
|
||||
bool RelocateDialog :: myMoveFlag = true;
|
||||
bool RelocateDialog::myMoveFlag = true;
|
||||
|
||||
void
|
||||
RelocateDialog :: onSetLocation ()
|
||||
RelocateDialog::onSetLocation ()
|
||||
{
|
||||
mySession.torrentSetLocation (myIds, myPath, myMoveFlag);
|
||||
deleteLater ();
|
||||
}
|
||||
|
||||
void
|
||||
RelocateDialog :: onFileSelected (const QString& path)
|
||||
RelocateDialog::onFileSelected (const QString& path)
|
||||
{
|
||||
myPath = path;
|
||||
myDirButton->setText (myPath);
|
||||
}
|
||||
|
||||
void
|
||||
RelocateDialog :: onDirButtonClicked ()
|
||||
RelocateDialog::onDirButtonClicked ()
|
||||
{
|
||||
const QString title = tr ("Select Location");
|
||||
const QString path = Utils::remoteFileChooser (this, title, myPath, true, mySession.isServer ());
|
||||
@@ -53,21 +53,21 @@ RelocateDialog :: onDirButtonClicked ()
|
||||
}
|
||||
|
||||
void
|
||||
RelocateDialog :: onMoveToggled (bool b)
|
||||
RelocateDialog::onMoveToggled (bool b)
|
||||
{
|
||||
myMoveFlag = b;
|
||||
}
|
||||
|
||||
RelocateDialog :: RelocateDialog (Session & session,
|
||||
TorrentModel & model,
|
||||
const QSet<int> & ids,
|
||||
QWidget * parent):
|
||||
RelocateDialog::RelocateDialog (Session & session,
|
||||
TorrentModel & model,
|
||||
const QSet<int> & ids,
|
||||
QWidget * parent):
|
||||
QDialog (parent),
|
||||
mySession (session),
|
||||
myModel (model),
|
||||
myIds (ids)
|
||||
{
|
||||
const int iconSize (style ()->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
const int iconSize (style ()->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
const QFileIconProvider iconProvider;
|
||||
const QIcon folderIcon = iconProvider.icon (QFileIconProvider::Folder);
|
||||
const QPixmap folderPixmap = folderIcon.pixmap (iconSize);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
***/
|
||||
|
||||
void
|
||||
SessionDialog :: onAccepted ()
|
||||
SessionDialog::onAccepted ()
|
||||
{
|
||||
myPrefs.set (Prefs::SESSION_IS_REMOTE, myRemoteRadioButton->isChecked ());
|
||||
myPrefs.set (Prefs::SESSION_REMOTE_HOST, myHostLineEdit->text ());
|
||||
@@ -38,7 +38,7 @@ SessionDialog :: onAccepted ()
|
||||
}
|
||||
|
||||
void
|
||||
SessionDialog :: resensitize ()
|
||||
SessionDialog::resensitize ()
|
||||
{
|
||||
const bool isRemote = myRemoteRadioButton->isChecked();
|
||||
const bool useAuth = myAuthCheckBox->isChecked();
|
||||
@@ -54,7 +54,7 @@ SessionDialog :: resensitize ()
|
||||
****
|
||||
***/
|
||||
|
||||
SessionDialog :: SessionDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
SessionDialog::SessionDialog (Session& session, Prefs& prefs, QWidget * parent):
|
||||
QDialog (parent),
|
||||
mySession (session),
|
||||
myPrefs (prefs)
|
||||
@@ -67,7 +67,7 @@ SessionDialog :: SessionDialog (Session& session, Prefs& prefs, QWidget * parent
|
||||
|
||||
setWindowTitle (tr ("Change Session"));
|
||||
QVBoxLayout * top = new QVBoxLayout (this);
|
||||
top->setSpacing (HIG :: PAD);
|
||||
top->setSpacing (HIG::PAD);
|
||||
|
||||
HIG * hig = new HIG;
|
||||
hig->setContentsMargins (0, 0, 0, 0);
|
||||
|
||||
218
qt/session.cc
218
qt/session.cc
@@ -89,7 +89,7 @@ namespace
|
||||
***/
|
||||
|
||||
void
|
||||
FileAdded :: executed (int64_t tag, const QString& result, struct tr_variant * arguments)
|
||||
FileAdded::executed (int64_t tag, const QString& result, struct tr_variant * arguments)
|
||||
{
|
||||
Q_UNUSED (arguments);
|
||||
|
||||
@@ -126,7 +126,7 @@ FileAdded :: executed (int64_t tag, const QString& result, struct tr_variant * a
|
||||
***/
|
||||
|
||||
void
|
||||
Session :: sessionSet (const tr_quark key, const QVariant& value)
|
||||
Session::sessionSet (const tr_quark key, const QVariant& value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -145,7 +145,7 @@ Session :: sessionSet (const tr_quark key, const QVariant& value)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: portTest ()
|
||||
Session::portTest ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -156,7 +156,7 @@ Session :: portTest ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: copyMagnetLinkToClipboard (int torrentId)
|
||||
Session::copyMagnetLinkToClipboard (int torrentId)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 3);
|
||||
@@ -170,62 +170,62 @@ Session :: copyMagnetLinkToClipboard (int torrentId)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: updatePref (int key)
|
||||
Session::updatePref (int key)
|
||||
{
|
||||
if (myPrefs.isCore (key)) switch (key)
|
||||
{
|
||||
case Prefs :: ALT_SPEED_LIMIT_DOWN:
|
||||
case Prefs :: ALT_SPEED_LIMIT_ENABLED:
|
||||
case Prefs :: ALT_SPEED_LIMIT_TIME_BEGIN:
|
||||
case Prefs :: ALT_SPEED_LIMIT_TIME_DAY:
|
||||
case Prefs :: ALT_SPEED_LIMIT_TIME_ENABLED:
|
||||
case Prefs :: ALT_SPEED_LIMIT_TIME_END:
|
||||
case Prefs :: ALT_SPEED_LIMIT_UP:
|
||||
case Prefs :: BLOCKLIST_DATE:
|
||||
case Prefs :: BLOCKLIST_ENABLED:
|
||||
case Prefs :: BLOCKLIST_URL:
|
||||
case Prefs :: DHT_ENABLED:
|
||||
case Prefs :: DOWNLOAD_QUEUE_ENABLED:
|
||||
case Prefs :: DOWNLOAD_QUEUE_SIZE:
|
||||
case Prefs :: DSPEED:
|
||||
case Prefs :: DSPEED_ENABLED:
|
||||
case Prefs :: IDLE_LIMIT:
|
||||
case Prefs :: IDLE_LIMIT_ENABLED:
|
||||
case Prefs :: INCOMPLETE_DIR:
|
||||
case Prefs :: INCOMPLETE_DIR_ENABLED:
|
||||
case Prefs :: LPD_ENABLED:
|
||||
case Prefs :: PEER_LIMIT_GLOBAL:
|
||||
case Prefs :: PEER_LIMIT_TORRENT:
|
||||
case Prefs :: PEER_PORT:
|
||||
case Prefs :: PEER_PORT_RANDOM_ON_START:
|
||||
case Prefs :: QUEUE_STALLED_MINUTES:
|
||||
case Prefs :: PEX_ENABLED:
|
||||
case Prefs :: PORT_FORWARDING:
|
||||
case Prefs :: RENAME_PARTIAL_FILES:
|
||||
case Prefs :: SCRIPT_TORRENT_DONE_ENABLED:
|
||||
case Prefs :: SCRIPT_TORRENT_DONE_FILENAME:
|
||||
case Prefs :: START:
|
||||
case Prefs :: TRASH_ORIGINAL:
|
||||
case Prefs :: USPEED:
|
||||
case Prefs :: USPEED_ENABLED:
|
||||
case Prefs :: UTP_ENABLED:
|
||||
case Prefs::ALT_SPEED_LIMIT_DOWN:
|
||||
case Prefs::ALT_SPEED_LIMIT_ENABLED:
|
||||
case Prefs::ALT_SPEED_LIMIT_TIME_BEGIN:
|
||||
case Prefs::ALT_SPEED_LIMIT_TIME_DAY:
|
||||
case Prefs::ALT_SPEED_LIMIT_TIME_ENABLED:
|
||||
case Prefs::ALT_SPEED_LIMIT_TIME_END:
|
||||
case Prefs::ALT_SPEED_LIMIT_UP:
|
||||
case Prefs::BLOCKLIST_DATE:
|
||||
case Prefs::BLOCKLIST_ENABLED:
|
||||
case Prefs::BLOCKLIST_URL:
|
||||
case Prefs::DHT_ENABLED:
|
||||
case Prefs::DOWNLOAD_QUEUE_ENABLED:
|
||||
case Prefs::DOWNLOAD_QUEUE_SIZE:
|
||||
case Prefs::DSPEED:
|
||||
case Prefs::DSPEED_ENABLED:
|
||||
case Prefs::IDLE_LIMIT:
|
||||
case Prefs::IDLE_LIMIT_ENABLED:
|
||||
case Prefs::INCOMPLETE_DIR:
|
||||
case Prefs::INCOMPLETE_DIR_ENABLED:
|
||||
case Prefs::LPD_ENABLED:
|
||||
case Prefs::PEER_LIMIT_GLOBAL:
|
||||
case Prefs::PEER_LIMIT_TORRENT:
|
||||
case Prefs::PEER_PORT:
|
||||
case Prefs::PEER_PORT_RANDOM_ON_START:
|
||||
case Prefs::QUEUE_STALLED_MINUTES:
|
||||
case Prefs::PEX_ENABLED:
|
||||
case Prefs::PORT_FORWARDING:
|
||||
case Prefs::RENAME_PARTIAL_FILES:
|
||||
case Prefs::SCRIPT_TORRENT_DONE_ENABLED:
|
||||
case Prefs::SCRIPT_TORRENT_DONE_FILENAME:
|
||||
case Prefs::START:
|
||||
case Prefs::TRASH_ORIGINAL:
|
||||
case Prefs::USPEED:
|
||||
case Prefs::USPEED_ENABLED:
|
||||
case Prefs::UTP_ENABLED:
|
||||
sessionSet (myPrefs.getKey (key), myPrefs.variant (key));
|
||||
break;
|
||||
|
||||
case Prefs :: DOWNLOAD_DIR:
|
||||
case Prefs::DOWNLOAD_DIR:
|
||||
sessionSet (myPrefs.getKey (key), myPrefs.variant (key));
|
||||
/* this will change the 'freespace' argument, so refresh */
|
||||
refreshSessionInfo ();
|
||||
break;
|
||||
|
||||
case Prefs :: RATIO:
|
||||
case Prefs::RATIO:
|
||||
sessionSet (TR_KEY_seedRatioLimit, myPrefs.variant (key));
|
||||
break;
|
||||
case Prefs :: RATIO_ENABLED:
|
||||
case Prefs::RATIO_ENABLED:
|
||||
sessionSet (TR_KEY_seedRatioLimited, myPrefs.variant (key));
|
||||
break;
|
||||
|
||||
case Prefs :: ENCRYPTION:
|
||||
case Prefs::ENCRYPTION:
|
||||
{
|
||||
const int i = myPrefs.variant (key).toInt ();
|
||||
switch (i)
|
||||
@@ -243,37 +243,37 @@ Session :: updatePref (int key)
|
||||
break;
|
||||
}
|
||||
|
||||
case Prefs :: RPC_AUTH_REQUIRED:
|
||||
case Prefs::RPC_AUTH_REQUIRED:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCPasswordEnabled (mySession, myPrefs.getBool (key));
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_ENABLED:
|
||||
case Prefs::RPC_ENABLED:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCEnabled (mySession, myPrefs.getBool (key));
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_PASSWORD:
|
||||
case Prefs::RPC_PASSWORD:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCPassword (mySession, myPrefs.getString (key).toUtf8 ().constData ());
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_PORT:
|
||||
case Prefs::RPC_PORT:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCPort (mySession, myPrefs.getInt (key));
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_USERNAME:
|
||||
case Prefs::RPC_USERNAME:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCUsername (mySession, myPrefs.getString (key).toUtf8 ().constData ());
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_WHITELIST_ENABLED:
|
||||
case Prefs::RPC_WHITELIST_ENABLED:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCWhitelistEnabled (mySession, myPrefs.getBool (key));
|
||||
break;
|
||||
|
||||
case Prefs :: RPC_WHITELIST:
|
||||
case Prefs::RPC_WHITELIST:
|
||||
if (mySession)
|
||||
tr_sessionSetRPCWhitelist (mySession, myPrefs.getString (key).toUtf8 ().constData ());
|
||||
break;
|
||||
@@ -287,7 +287,7 @@ Session :: updatePref (int key)
|
||||
****
|
||||
***/
|
||||
|
||||
Session :: Session (const char * configDir, Prefs& prefs):
|
||||
Session::Session (const char * configDir, Prefs& prefs):
|
||||
nextUniqueTag (FIRST_UNIQUE_TAG),
|
||||
myBlocklistSize (-1),
|
||||
myPrefs (prefs),
|
||||
@@ -309,13 +309,13 @@ Session :: Session (const char * configDir, Prefs& prefs):
|
||||
this, SLOT (onResponseReceived (const QByteArray&)));
|
||||
}
|
||||
|
||||
Session :: ~Session ()
|
||||
Session::~Session ()
|
||||
{
|
||||
stop ();
|
||||
}
|
||||
|
||||
QNetworkAccessManager *
|
||||
Session :: networkAccessManager ()
|
||||
Session::networkAccessManager ()
|
||||
{
|
||||
if (myNAM == 0)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ Session :: networkAccessManager ()
|
||||
***/
|
||||
|
||||
void
|
||||
Session :: stop ()
|
||||
Session::stop ()
|
||||
{
|
||||
if (myNAM != 0)
|
||||
{
|
||||
@@ -354,14 +354,14 @@ Session :: stop ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: restart ()
|
||||
Session::restart ()
|
||||
{
|
||||
stop ();
|
||||
start ();
|
||||
}
|
||||
|
||||
void
|
||||
Session :: start ()
|
||||
Session::start ()
|
||||
{
|
||||
if (myPrefs.get<bool> (Prefs::SESSION_IS_REMOTE))
|
||||
{
|
||||
@@ -396,13 +396,13 @@ Session :: start ()
|
||||
}
|
||||
|
||||
bool
|
||||
Session :: isServer () const
|
||||
Session::isServer () const
|
||||
{
|
||||
return mySession != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
Session :: isLocal () const
|
||||
Session::isLocal () const
|
||||
{
|
||||
if (mySession != 0)
|
||||
return true;
|
||||
@@ -447,7 +447,7 @@ namespace
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, double value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, double value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -460,7 +460,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, double value)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, int value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, int value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -473,7 +473,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, int value)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, bool value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, bool value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -486,7 +486,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, bool value)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QStringList& value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, const QStringList& value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -501,7 +501,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QStringLi
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QList<int>& value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, const QList<int>& value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -516,7 +516,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QList<int
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QPair<int,QString>& value)
|
||||
Session::torrentSet (const QSet<int>& ids, const tr_quark key, const QPair<int,QString>& value)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -531,7 +531,7 @@ Session :: torrentSet (const QSet<int>& ids, const tr_quark key, const QPair<int
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentSetLocation (const QSet<int>& ids, const QString& location, bool doMove)
|
||||
Session::torrentSetLocation (const QSet<int>& ids, const QString& location, bool doMove)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -545,7 +545,7 @@ Session :: torrentSetLocation (const QSet<int>& ids, const QString& location, bo
|
||||
}
|
||||
|
||||
void
|
||||
Session :: torrentRenamePath (const QSet<int>& ids, const QString& oldpath, const QString& newname)
|
||||
Session::torrentRenamePath (const QSet<int>& ids, const QString& oldpath, const QString& newname)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -560,7 +560,7 @@ Session :: torrentRenamePath (const QSet<int>& ids, const QString& oldpath, cons
|
||||
}
|
||||
|
||||
void
|
||||
Session :: refreshTorrents (const QSet<int>& ids)
|
||||
Session::refreshTorrents (const QSet<int>& ids)
|
||||
{
|
||||
if (ids.empty ())
|
||||
{
|
||||
@@ -581,7 +581,7 @@ Session :: refreshTorrents (const QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: refreshExtraStats (const QSet<int>& ids)
|
||||
Session::refreshExtraStats (const QSet<int>& ids)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 3);
|
||||
@@ -595,7 +595,7 @@ Session :: refreshExtraStats (const QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: sendTorrentRequest (const char * request, const QSet<int>& ids)
|
||||
Session::sendTorrentRequest (const char * request, const QSet<int>& ids)
|
||||
{
|
||||
tr_variant top;
|
||||
|
||||
@@ -607,16 +607,16 @@ Session :: sendTorrentRequest (const char * request, const QSet<int>& ids)
|
||||
refreshTorrents (ids);
|
||||
}
|
||||
|
||||
void Session :: pauseTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-stop", ids); }
|
||||
void Session :: startTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-start", ids); }
|
||||
void Session :: startTorrentsNow (const QSet<int>& ids) { sendTorrentRequest ("torrent-start-now", ids); }
|
||||
void Session :: queueMoveTop (const QSet<int>& ids) { sendTorrentRequest ("queue-move-top", ids); }
|
||||
void Session :: queueMoveUp (const QSet<int>& ids) { sendTorrentRequest ("queue-move-up", ids); }
|
||||
void Session :: queueMoveDown (const QSet<int>& ids) { sendTorrentRequest ("queue-move-down", ids); }
|
||||
void Session :: queueMoveBottom (const QSet<int>& ids) { sendTorrentRequest ("queue-move-bottom", ids); }
|
||||
void Session::pauseTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-stop", ids); }
|
||||
void Session::startTorrents (const QSet<int>& ids) { sendTorrentRequest ("torrent-start", ids); }
|
||||
void Session::startTorrentsNow (const QSet<int>& ids) { sendTorrentRequest ("torrent-start-now", ids); }
|
||||
void Session::queueMoveTop (const QSet<int>& ids) { sendTorrentRequest ("queue-move-top", ids); }
|
||||
void Session::queueMoveUp (const QSet<int>& ids) { sendTorrentRequest ("queue-move-up", ids); }
|
||||
void Session::queueMoveDown (const QSet<int>& ids) { sendTorrentRequest ("queue-move-down", ids); }
|
||||
void Session::queueMoveBottom (const QSet<int>& ids) { sendTorrentRequest ("queue-move-bottom", ids); }
|
||||
|
||||
void
|
||||
Session :: refreshActiveTorrents ()
|
||||
Session::refreshActiveTorrents ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 3);
|
||||
@@ -630,7 +630,7 @@ Session :: refreshActiveTorrents ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: refreshAllTorrents ()
|
||||
Session::refreshAllTorrents ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 3);
|
||||
@@ -643,7 +643,7 @@ Session :: refreshAllTorrents ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: initTorrents (const QSet<int>& ids)
|
||||
Session::initTorrents (const QSet<int>& ids)
|
||||
{
|
||||
tr_variant top;
|
||||
const int tag (ids.isEmpty () ? TAG_ALL_TORRENTS : TAG_SOME_TORRENTS);
|
||||
@@ -655,7 +655,7 @@ Session :: initTorrents (const QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: refreshSessionStats ()
|
||||
Session::refreshSessionStats ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -666,7 +666,7 @@ Session :: refreshSessionStats ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: refreshSessionInfo ()
|
||||
Session::refreshSessionInfo ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -677,7 +677,7 @@ Session :: refreshSessionInfo ()
|
||||
}
|
||||
|
||||
void
|
||||
Session :: updateBlocklist ()
|
||||
Session::updateBlocklist ()
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 2);
|
||||
@@ -692,7 +692,7 @@ Session :: updateBlocklist ()
|
||||
***/
|
||||
|
||||
void
|
||||
Session :: exec (const tr_variant * request)
|
||||
Session::exec (const tr_variant * request)
|
||||
{
|
||||
char * str = tr_variantToStr (request, TR_VARIANT_FMT_JSON_LEAN, NULL);
|
||||
exec (str);
|
||||
@@ -700,7 +700,7 @@ Session :: exec (const tr_variant * request)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: localSessionCallback (tr_session * s, struct evbuffer * json, void * vself)
|
||||
Session::localSessionCallback (tr_session * s, struct evbuffer * json, void * vself)
|
||||
{
|
||||
Q_UNUSED (s);
|
||||
|
||||
@@ -715,7 +715,7 @@ Session :: localSessionCallback (tr_session * s, struct evbuffer * json, void *
|
||||
#define REQUEST_DATA_PROPERTY_KEY "requestData"
|
||||
|
||||
void
|
||||
Session :: exec (const char * json)
|
||||
Session::exec (const char * json)
|
||||
{
|
||||
if (mySession )
|
||||
{
|
||||
@@ -751,7 +751,7 @@ Session :: exec (const char * json)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: onFinished (QNetworkReply * reply)
|
||||
Session::onFinished (QNetworkReply * reply)
|
||||
{
|
||||
#ifdef DEBUG_HTTP
|
||||
std::cerr << "http response header: " << std::endl;
|
||||
@@ -789,13 +789,13 @@ Session :: onFinished (QNetworkReply * reply)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: onResponseReceived (const QByteArray& utf8)
|
||||
Session::onResponseReceived (const QByteArray& utf8)
|
||||
{
|
||||
parseResponse (utf8.constData (), utf8.length ());
|
||||
}
|
||||
|
||||
void
|
||||
Session :: parseResponse (const char * json, size_t jsonLength)
|
||||
Session::parseResponse (const char * json, size_t jsonLength)
|
||||
{
|
||||
tr_variant top;
|
||||
const int err (tr_variantFromJson (&top, json, jsonLength));
|
||||
@@ -920,7 +920,7 @@ Session :: parseResponse (const char * json, size_t jsonLength)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: updateStats (tr_variant * d, struct tr_session_stats * stats)
|
||||
Session::updateStats (tr_variant * d, struct tr_session_stats * stats)
|
||||
{
|
||||
int64_t i;
|
||||
|
||||
@@ -939,7 +939,7 @@ Session :: updateStats (tr_variant * d, struct tr_session_stats * stats)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: updateStats (tr_variant * d)
|
||||
Session::updateStats (tr_variant * d)
|
||||
{
|
||||
tr_variant * c;
|
||||
|
||||
@@ -953,7 +953,7 @@ Session :: updateStats (tr_variant * d)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: updateInfo (tr_variant * d)
|
||||
Session::updateInfo (tr_variant * d)
|
||||
{
|
||||
int64_t i;
|
||||
const char * str;
|
||||
@@ -967,7 +967,7 @@ Session :: updateInfo (tr_variant * d)
|
||||
if (!b)
|
||||
continue;
|
||||
|
||||
if (i == Prefs :: ENCRYPTION)
|
||||
if (i == Prefs::ENCRYPTION)
|
||||
{
|
||||
const char * val;
|
||||
if (tr_variantGetStr (b, &val, NULL))
|
||||
@@ -984,30 +984,30 @@ Session :: updateInfo (tr_variant * d)
|
||||
|
||||
switch (myPrefs.type (i))
|
||||
{
|
||||
case QVariant :: Int:
|
||||
case QVariant::Int:
|
||||
{
|
||||
int64_t val;
|
||||
if (tr_variantGetInt (b, &val))
|
||||
myPrefs.set (i, (int)val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: Double:
|
||||
case QVariant::Double:
|
||||
{
|
||||
double val;
|
||||
if (tr_variantGetReal (b, &val))
|
||||
myPrefs.set (i, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: Bool:
|
||||
case QVariant::Bool:
|
||||
{
|
||||
bool val;
|
||||
if (tr_variantGetBool (b, &val))
|
||||
myPrefs.set (i, (bool)val);
|
||||
break;
|
||||
}
|
||||
case TrTypes :: FilterModeType:
|
||||
case TrTypes :: SortModeType:
|
||||
case QVariant :: String:
|
||||
case TrTypes::FilterModeType:
|
||||
case TrTypes::SortModeType:
|
||||
case QVariant::String:
|
||||
{
|
||||
const char * val;
|
||||
if (tr_variantGetStr (b, &val, NULL))
|
||||
@@ -1044,14 +1044,14 @@ Session :: updateInfo (tr_variant * d)
|
||||
if (tr_variantDictFindStr (d, TR_KEY_version, &str, NULL) && (mySessionVersion != str))
|
||||
mySessionVersion = str;
|
||||
|
||||
//std::cerr << "Session :: updateInfo end" << std::endl;
|
||||
//std::cerr << "Session::updateInfo end" << std::endl;
|
||||
connect (&myPrefs, SIGNAL (changed (int)), this, SLOT (updatePref (int)));
|
||||
|
||||
emit sessionUpdated ();
|
||||
}
|
||||
|
||||
void
|
||||
Session :: setBlocklistSize (int64_t i)
|
||||
Session::setBlocklistSize (int64_t i)
|
||||
{
|
||||
myBlocklistSize = i;
|
||||
|
||||
@@ -1059,7 +1059,7 @@ Session :: setBlocklistSize (int64_t i)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: addTorrent (const AddData& addMe, tr_variant& top, bool trashOriginal)
|
||||
Session::addTorrent (const AddData& addMe, tr_variant& top, bool trashOriginal)
|
||||
{
|
||||
assert (tr_variantDictFind (&top, TR_KEY_method) == nullptr);
|
||||
assert (tr_variantDictFind (&top, TR_KEY_tag) == nullptr);
|
||||
@@ -1113,7 +1113,7 @@ Session :: addTorrent (const AddData& addMe, tr_variant& top, bool trashOriginal
|
||||
}
|
||||
|
||||
void
|
||||
Session :: addTorrent (const AddData& addMe)
|
||||
Session::addTorrent (const AddData& addMe)
|
||||
{
|
||||
tr_variant top;
|
||||
tr_variantInitDict (&top, 3);
|
||||
@@ -1124,7 +1124,7 @@ Session :: addTorrent (const AddData& addMe)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: addNewlyCreatedTorrent (const QString& filename, const QString& localPath)
|
||||
Session::addNewlyCreatedTorrent (const QString& filename, const QString& localPath)
|
||||
{
|
||||
const QByteArray b64 = AddData (filename).toBase64 ();
|
||||
const QByteArray localPathUtf8 = localPath.toUtf8 ();
|
||||
@@ -1141,7 +1141,7 @@ Session :: addNewlyCreatedTorrent (const QString& filename, const QString& local
|
||||
}
|
||||
|
||||
void
|
||||
Session :: removeTorrents (const QSet<int>& ids, bool deleteFiles)
|
||||
Session::removeTorrents (const QSet<int>& ids, bool deleteFiles)
|
||||
{
|
||||
if (!ids.isEmpty ())
|
||||
{
|
||||
@@ -1157,7 +1157,7 @@ Session :: removeTorrents (const QSet<int>& ids, bool deleteFiles)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: verifyTorrents (const QSet<int>& ids)
|
||||
Session::verifyTorrents (const QSet<int>& ids)
|
||||
{
|
||||
if (!ids.isEmpty ())
|
||||
{
|
||||
@@ -1172,7 +1172,7 @@ Session :: verifyTorrents (const QSet<int>& ids)
|
||||
}
|
||||
|
||||
void
|
||||
Session :: reannounceTorrents (const QSet<int>& ids)
|
||||
Session::reannounceTorrents (const QSet<int>& ids)
|
||||
{
|
||||
if (!ids.isEmpty ())
|
||||
{
|
||||
@@ -1191,7 +1191,7 @@ Session :: reannounceTorrents (const QSet<int>& ids)
|
||||
***/
|
||||
|
||||
void
|
||||
Session :: launchWebInterface ()
|
||||
Session::launchWebInterface ()
|
||||
{
|
||||
QUrl url;
|
||||
|
||||
@@ -1207,5 +1207,5 @@ Session :: launchWebInterface ()
|
||||
url.setPort (myPrefs.getInt (Prefs::RPC_PORT));
|
||||
}
|
||||
|
||||
QDesktopServices :: openUrl (url);
|
||||
QDesktopServices::openUrl (url);
|
||||
}
|
||||
|
||||
@@ -47,25 +47,25 @@
|
||||
#include "squeezelabel.h"
|
||||
|
||||
void
|
||||
SqueezeLabel :: init ()
|
||||
SqueezeLabel::init ()
|
||||
{
|
||||
setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
}
|
||||
|
||||
SqueezeLabel :: SqueezeLabel (const QString& text, QWidget *parent):
|
||||
SqueezeLabel::SqueezeLabel (const QString& text, QWidget * parent):
|
||||
QLabel (text, parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
SqueezeLabel :: SqueezeLabel (QWidget * parent):
|
||||
SqueezeLabel::SqueezeLabel (QWidget * parent):
|
||||
QLabel (parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void
|
||||
SqueezeLabel :: paintEvent (QPaintEvent * paintEvent)
|
||||
SqueezeLabel::paintEvent (QPaintEvent * paintEvent)
|
||||
{
|
||||
Q_UNUSED (paintEvent);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ enum
|
||||
REFRESH_INTERVAL_MSEC = (15*1000)
|
||||
};
|
||||
|
||||
StatsDialog :: StatsDialog (Session & session, QWidget * parent):
|
||||
StatsDialog::StatsDialog (Session& session, QWidget * parent):
|
||||
QDialog (parent, Qt::Dialog),
|
||||
mySession (session),
|
||||
myTimer (new QTimer (this))
|
||||
@@ -57,12 +57,12 @@ StatsDialog :: StatsDialog (Session & session, QWidget * parent):
|
||||
mySession.refreshSessionStats ();
|
||||
}
|
||||
|
||||
StatsDialog :: ~StatsDialog ()
|
||||
StatsDialog::~StatsDialog ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
StatsDialog :: setVisible (bool visible)
|
||||
StatsDialog::setVisible (bool visible)
|
||||
{
|
||||
myTimer->stop ();
|
||||
if (visible)
|
||||
@@ -71,13 +71,13 @@ StatsDialog :: setVisible (bool visible)
|
||||
}
|
||||
|
||||
void
|
||||
StatsDialog :: onTimer ()
|
||||
StatsDialog::onTimer ()
|
||||
{
|
||||
mySession.refreshSessionStats ();
|
||||
}
|
||||
|
||||
void
|
||||
StatsDialog :: updateStats ()
|
||||
StatsDialog::updateStats ()
|
||||
{
|
||||
const struct tr_session_stats& current (mySession.getStats ());
|
||||
const struct tr_session_stats& total (mySession.getCumulativeStats ());
|
||||
|
||||
@@ -44,11 +44,11 @@ enum
|
||||
***/
|
||||
|
||||
QSize
|
||||
TorrentDelegateMin :: sizeHint (const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
TorrentDelegateMin::sizeHint (const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
{
|
||||
const QStyle* style (QApplication::style());
|
||||
static const int iconSize (style->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
static const int iconSize (style->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
|
||||
QFont nameFont (option.font);
|
||||
const QFontMetrics nameFM (nameFont);
|
||||
@@ -71,13 +71,13 @@ TorrentDelegateMin :: sizeHint (const QStyleOptionViewItem & option,
|
||||
}
|
||||
|
||||
void
|
||||
TorrentDelegateMin :: drawTorrent (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
TorrentDelegateMin::drawTorrent (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
{
|
||||
const bool isPaused (tor.isPaused());
|
||||
const QStyle * style (QApplication::style());
|
||||
static const int iconSize (style->pixelMetric (QStyle :: PM_SmallIconSize));
|
||||
static const int iconSize (style->pixelMetric (QStyle::PM_SmallIconSize));
|
||||
|
||||
QFont nameFont (option.font);
|
||||
const QFontMetrics nameFM (nameFont);
|
||||
|
||||
@@ -31,14 +31,14 @@ enum
|
||||
BAR_HEIGHT = 12
|
||||
};
|
||||
|
||||
QColor TorrentDelegate :: greenBrush;
|
||||
QColor TorrentDelegate :: blueBrush;
|
||||
QColor TorrentDelegate :: silverBrush;
|
||||
QColor TorrentDelegate :: greenBack;
|
||||
QColor TorrentDelegate :: blueBack;
|
||||
QColor TorrentDelegate :: silverBack;
|
||||
QColor TorrentDelegate::greenBrush;
|
||||
QColor TorrentDelegate::blueBrush;
|
||||
QColor TorrentDelegate::silverBrush;
|
||||
QColor TorrentDelegate::greenBack;
|
||||
QColor TorrentDelegate::blueBack;
|
||||
QColor TorrentDelegate::silverBack;
|
||||
|
||||
TorrentDelegate :: TorrentDelegate (QObject * parent):
|
||||
TorrentDelegate::TorrentDelegate (QObject * parent):
|
||||
QStyledItemDelegate (parent),
|
||||
myProgressBarStyle (new QStyleOptionProgressBar)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ TorrentDelegate :: TorrentDelegate (QObject * parent):
|
||||
silverBack = QColor ("grey");
|
||||
}
|
||||
|
||||
TorrentDelegate :: ~TorrentDelegate ()
|
||||
TorrentDelegate::~TorrentDelegate ()
|
||||
{
|
||||
delete myProgressBarStyle;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ TorrentDelegate :: ~TorrentDelegate ()
|
||||
***/
|
||||
|
||||
QSize
|
||||
TorrentDelegate :: margin (const QStyle& style) const
|
||||
TorrentDelegate::margin (const QStyle& style) const
|
||||
{
|
||||
Q_UNUSED (style);
|
||||
|
||||
@@ -73,7 +73,7 @@ TorrentDelegate :: margin (const QStyle& style) const
|
||||
}
|
||||
|
||||
QString
|
||||
TorrentDelegate :: progressString (const Torrent& tor) const
|
||||
TorrentDelegate::progressString (const Torrent& tor) const
|
||||
{
|
||||
const bool isMagnet (!tor.hasMetadata());
|
||||
const bool isDone (tor.isDone ());
|
||||
@@ -172,7 +172,7 @@ TorrentDelegate :: progressString (const Torrent& tor) const
|
||||
}
|
||||
|
||||
QString
|
||||
TorrentDelegate :: shortTransferString (const Torrent& tor) const
|
||||
TorrentDelegate::shortTransferString (const Torrent& tor) const
|
||||
{
|
||||
QString str;
|
||||
const bool haveMeta (tor.hasMetadata());
|
||||
@@ -191,7 +191,7 @@ TorrentDelegate :: shortTransferString (const Torrent& tor) const
|
||||
}
|
||||
|
||||
QString
|
||||
TorrentDelegate :: shortStatusString (const Torrent& tor) const
|
||||
TorrentDelegate::shortStatusString (const Torrent& tor) const
|
||||
{
|
||||
QString str;
|
||||
static const QChar ratioSymbol (0x262F);
|
||||
@@ -219,7 +219,7 @@ TorrentDelegate :: shortStatusString (const Torrent& tor) const
|
||||
}
|
||||
|
||||
QString
|
||||
TorrentDelegate :: statusString (const Torrent& tor) const
|
||||
TorrentDelegate::statusString (const Torrent& tor) const
|
||||
{
|
||||
QString str;
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace
|
||||
}
|
||||
|
||||
QSize
|
||||
TorrentDelegate :: sizeHint (const QStyleOptionViewItem& option, const Torrent& tor) const
|
||||
TorrentDelegate::sizeHint (const QStyleOptionViewItem& option, const Torrent& tor) const
|
||||
{
|
||||
const QStyle* style (QApplication::style ());
|
||||
static const int iconSize (style->pixelMetric (QStyle::PM_MessageBoxIconSize));
|
||||
@@ -314,17 +314,17 @@ TorrentDelegate :: sizeHint (const QStyleOptionViewItem& option, const Torrent&
|
||||
}
|
||||
|
||||
QSize
|
||||
TorrentDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
TorrentDelegate::sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
const Torrent * tor (index.data (TorrentModel::TorrentRole).value<const Torrent*>());
|
||||
return sizeHint (option, *tor);
|
||||
}
|
||||
|
||||
void
|
||||
TorrentDelegate :: paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
TorrentDelegate::paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
const Torrent * tor (index.data (TorrentModel::TorrentRole).value<const Torrent*>());
|
||||
painter->save ();
|
||||
@@ -334,8 +334,8 @@ TorrentDelegate :: paint (QPainter * painter,
|
||||
}
|
||||
|
||||
void
|
||||
TorrentDelegate :: setProgressBarPercentDone (const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
TorrentDelegate::setProgressBarPercentDone (const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
{
|
||||
double seedRatioLimit;
|
||||
if (tor.isSeeding() && tor.getSeedRatio(seedRatioLimit))
|
||||
@@ -353,9 +353,9 @@ TorrentDelegate :: setProgressBarPercentDone (const QStyleOptionViewItem & optio
|
||||
}
|
||||
|
||||
void
|
||||
TorrentDelegate :: drawTorrent (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
TorrentDelegate::drawTorrent (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const Torrent & tor) const
|
||||
{
|
||||
const QStyle * style (QApplication::style ());
|
||||
static const int iconSize (style->pixelMetric (QStyle::PM_LargeIconSize));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "torrent-model.h"
|
||||
#include "utils.h"
|
||||
|
||||
TorrentFilter :: TorrentFilter (Prefs& prefs):
|
||||
TorrentFilter::TorrentFilter (Prefs& prefs):
|
||||
myPrefs (prefs)
|
||||
{
|
||||
// listen for changes to the preferences to know when to refilter / resort
|
||||
@@ -28,32 +28,32 @@ TorrentFilter :: TorrentFilter (Prefs& prefs):
|
||||
|
||||
// initialize our state from the current prefs
|
||||
QList<int> initKeys;
|
||||
initKeys << Prefs :: SORT_MODE
|
||||
<< Prefs :: FILTER_MODE
|
||||
<< Prefs :: FILTER_TRACKERS
|
||||
<< Prefs :: FILTER_TEXT;
|
||||
initKeys << Prefs::SORT_MODE
|
||||
<< Prefs::FILTER_MODE
|
||||
<< Prefs::FILTER_TRACKERS
|
||||
<< Prefs::FILTER_TEXT;
|
||||
foreach (int key, initKeys)
|
||||
refreshPref (key);
|
||||
}
|
||||
|
||||
TorrentFilter :: ~TorrentFilter ()
|
||||
TorrentFilter::~TorrentFilter ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TorrentFilter :: refreshPref (int key)
|
||||
TorrentFilter::refreshPref (int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Prefs :: FILTER_TEXT:
|
||||
case Prefs :: FILTER_MODE:
|
||||
case Prefs :: FILTER_TRACKERS:
|
||||
case Prefs::FILTER_TEXT:
|
||||
case Prefs::FILTER_MODE:
|
||||
case Prefs::FILTER_TRACKERS:
|
||||
invalidateFilter ();
|
||||
/* force a re-sort */
|
||||
sort (0, !myPrefs.getBool(Prefs::SORT_REVERSED) ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||
|
||||
case Prefs :: SORT_MODE:
|
||||
case Prefs :: SORT_REVERSED:
|
||||
case Prefs::SORT_MODE:
|
||||
case Prefs::SORT_REVERSED:
|
||||
sort (0, myPrefs.getBool(Prefs::SORT_REVERSED) ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||
invalidate ();
|
||||
break;
|
||||
@@ -79,7 +79,7 @@ namespace
|
||||
}
|
||||
|
||||
bool
|
||||
TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) const
|
||||
TorrentFilter::lessThan (const QModelIndex& left, const QModelIndex& right) const
|
||||
{
|
||||
int val = 0;
|
||||
const Torrent * a = sourceModel()->data (left, TorrentModel::TorrentRole).value<const Torrent*>();
|
||||
@@ -87,26 +87,26 @@ TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) co
|
||||
|
||||
switch (myPrefs.get<SortMode>(Prefs::SORT_MODE).mode())
|
||||
{
|
||||
case SortMode :: SORT_BY_QUEUE:
|
||||
case SortMode::SORT_BY_QUEUE:
|
||||
if (!val)
|
||||
val = -compare (a->queuePosition(), b->queuePosition());
|
||||
break;
|
||||
|
||||
case SortMode :: SORT_BY_SIZE:
|
||||
case SortMode::SORT_BY_SIZE:
|
||||
if (!val)
|
||||
val = compare (a->sizeWhenDone(), b->sizeWhenDone());
|
||||
break;
|
||||
|
||||
case SortMode :: SORT_BY_AGE:
|
||||
case SortMode::SORT_BY_AGE:
|
||||
val = compare (a->dateAdded().toTime_t(), b->dateAdded().toTime_t());
|
||||
break;
|
||||
|
||||
case SortMode :: SORT_BY_ID:
|
||||
case SortMode::SORT_BY_ID:
|
||||
if (!val)
|
||||
val = compare (a->id(), b->id());
|
||||
break;
|
||||
|
||||
case SortMode :: SORT_BY_ACTIVITY:
|
||||
case SortMode::SORT_BY_ACTIVITY:
|
||||
if (!val)
|
||||
val = compare (a->downloadSpeed() + a->uploadSpeed(), b->downloadSpeed() + b->uploadSpeed());
|
||||
if (!val)
|
||||
@@ -114,7 +114,7 @@ TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) co
|
||||
b->peersWeAreUploadingTo() + b->webseedsWeAreDownloadingFrom());
|
||||
// fall through
|
||||
|
||||
case SortMode :: SORT_BY_STATE:
|
||||
case SortMode::SORT_BY_STATE:
|
||||
if (!val)
|
||||
val = -compare (a->isPaused(), b->isPaused());
|
||||
if (!val)
|
||||
@@ -125,7 +125,7 @@ TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) co
|
||||
val = compare (a->hasError(), b->hasError());
|
||||
// fall through
|
||||
|
||||
case SortMode :: SORT_BY_PROGRESS:
|
||||
case SortMode::SORT_BY_PROGRESS:
|
||||
if (!val)
|
||||
val = compare (a->percentComplete(), b->percentComplete());
|
||||
if (!val)
|
||||
@@ -133,12 +133,12 @@ TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) co
|
||||
if (!val)
|
||||
val = -compare (a->queuePosition(), b->queuePosition());
|
||||
|
||||
case SortMode :: SORT_BY_RATIO:
|
||||
case SortMode::SORT_BY_RATIO:
|
||||
if (!val)
|
||||
val = a->compareRatio (*b);
|
||||
break;
|
||||
|
||||
case SortMode :: SORT_BY_ETA:
|
||||
case SortMode::SORT_BY_ETA:
|
||||
if (!val)
|
||||
val = a->compareETA (*b);
|
||||
break;
|
||||
@@ -162,13 +162,13 @@ TorrentFilter :: lessThan (const QModelIndex& left, const QModelIndex& right) co
|
||||
***/
|
||||
|
||||
bool
|
||||
TorrentFilter :: trackerFilterAcceptsTorrent (const Torrent * tor, const QString& tracker) const
|
||||
TorrentFilter::trackerFilterAcceptsTorrent (const Torrent * tor, const QString& tracker) const
|
||||
{
|
||||
return tracker.isEmpty() || tor->hasTrackerSubstring (tracker);
|
||||
}
|
||||
|
||||
bool
|
||||
TorrentFilter :: activityFilterAcceptsTorrent (const Torrent * tor, const FilterMode& m) const
|
||||
TorrentFilter::activityFilterAcceptsTorrent (const Torrent * tor, const FilterMode& m) const
|
||||
{
|
||||
bool accepts;
|
||||
|
||||
@@ -211,7 +211,7 @@ TorrentFilter :: activityFilterAcceptsTorrent (const Torrent * tor, const Filter
|
||||
}
|
||||
|
||||
bool
|
||||
TorrentFilter :: filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const
|
||||
TorrentFilter::filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const
|
||||
{
|
||||
QModelIndex childIndex = sourceModel()->index (sourceRow, 0, sourceParent);
|
||||
const Torrent * tor = childIndex.model()->data (childIndex, TorrentModel::TorrentRole).value<const Torrent*>();
|
||||
@@ -240,13 +240,13 @@ TorrentFilter :: filterAcceptsRow (int sourceRow, const QModelIndex& sourceParen
|
||||
}
|
||||
|
||||
int
|
||||
TorrentFilter :: hiddenRowCount () const
|
||||
TorrentFilter::hiddenRowCount () const
|
||||
{
|
||||
return sourceModel()->rowCount () - rowCount ();
|
||||
}
|
||||
|
||||
void
|
||||
TorrentFilter :: countTorrentsPerMode (int * setmeCounts) const
|
||||
TorrentFilter::countTorrentsPerMode (int * setmeCounts) const
|
||||
{
|
||||
std::fill_n (setmeCounts, static_cast<std::size_t>(FilterMode::NUM_MODES), 0);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "torrent-model.h"
|
||||
|
||||
void
|
||||
TorrentModel :: clear ()
|
||||
TorrentModel::clear ()
|
||||
{
|
||||
beginResetModel ();
|
||||
|
||||
@@ -30,7 +30,7 @@ TorrentModel :: clear ()
|
||||
}
|
||||
|
||||
int
|
||||
TorrentModel :: rowCount (const QModelIndex& parent) const
|
||||
TorrentModel::rowCount (const QModelIndex& parent) const
|
||||
{
|
||||
Q_UNUSED (parent);
|
||||
|
||||
@@ -38,7 +38,7 @@ TorrentModel :: rowCount (const QModelIndex& parent) const
|
||||
}
|
||||
|
||||
QVariant
|
||||
TorrentModel :: data (const QModelIndex& index, int role) const
|
||||
TorrentModel::data (const QModelIndex& index, int role) const
|
||||
{
|
||||
QVariant var;
|
||||
|
||||
@@ -73,19 +73,19 @@ TorrentModel :: data (const QModelIndex& index, int role) const
|
||||
***/
|
||||
|
||||
void
|
||||
TorrentModel :: addTorrent (Torrent * t)
|
||||
TorrentModel::addTorrent (Torrent * t)
|
||||
{
|
||||
myIdToTorrent.insert (t->id (), t);
|
||||
myIdToRow.insert (t->id (), myTorrents.size ());
|
||||
myTorrents.append (t);
|
||||
}
|
||||
|
||||
TorrentModel :: TorrentModel (Prefs& prefs):
|
||||
TorrentModel::TorrentModel (Prefs& prefs):
|
||||
myPrefs (prefs)
|
||||
{
|
||||
}
|
||||
|
||||
TorrentModel :: ~TorrentModel ()
|
||||
TorrentModel::~TorrentModel ()
|
||||
{
|
||||
clear ();
|
||||
}
|
||||
@@ -95,14 +95,14 @@ TorrentModel :: ~TorrentModel ()
|
||||
***/
|
||||
|
||||
Torrent*
|
||||
TorrentModel :: getTorrentFromId (int id)
|
||||
TorrentModel::getTorrentFromId (int id)
|
||||
{
|
||||
id_to_torrent_t::iterator it (myIdToTorrent.find (id));
|
||||
return it == myIdToTorrent.end() ? 0 : it.value ();
|
||||
}
|
||||
|
||||
const Torrent*
|
||||
TorrentModel :: getTorrentFromId (int id) const
|
||||
TorrentModel::getTorrentFromId (int id) const
|
||||
{
|
||||
id_to_torrent_t::const_iterator it (myIdToTorrent.find (id));
|
||||
return it == myIdToTorrent.end() ? 0 : it.value ();
|
||||
@@ -113,7 +113,7 @@ TorrentModel :: getTorrentFromId (int id) const
|
||||
***/
|
||||
|
||||
void
|
||||
TorrentModel :: onTorrentChanged (int torrentId)
|
||||
TorrentModel::onTorrentChanged (int torrentId)
|
||||
{
|
||||
const int row (myIdToRow.value (torrentId, -1));
|
||||
if (row >= 0)
|
||||
@@ -124,7 +124,7 @@ TorrentModel :: onTorrentChanged (int torrentId)
|
||||
}
|
||||
|
||||
void
|
||||
TorrentModel :: removeTorrents (tr_variant * torrents)
|
||||
TorrentModel::removeTorrents (tr_variant * torrents)
|
||||
{
|
||||
int i = 0;
|
||||
tr_variant * child;
|
||||
@@ -137,7 +137,7 @@ TorrentModel :: removeTorrents (tr_variant * torrents)
|
||||
}
|
||||
|
||||
void
|
||||
TorrentModel :: updateTorrents (tr_variant * torrents, bool isCompleteList)
|
||||
TorrentModel::updateTorrents (tr_variant * torrents, bool isCompleteList)
|
||||
{
|
||||
QList<Torrent*> newTorrents;
|
||||
QSet<int> oldIds;
|
||||
@@ -213,7 +213,7 @@ TorrentModel :: updateTorrents (tr_variant * torrents, bool isCompleteList)
|
||||
}
|
||||
|
||||
void
|
||||
TorrentModel :: removeTorrent (int id)
|
||||
TorrentModel::removeTorrent (int id)
|
||||
{
|
||||
const int row = myIdToRow.value (id, -1);
|
||||
if (row >= 0)
|
||||
@@ -235,10 +235,10 @@ TorrentModel :: removeTorrent (int id)
|
||||
}
|
||||
|
||||
void
|
||||
TorrentModel :: getTransferSpeed (Speed & uploadSpeed,
|
||||
size_t & uploadPeerCount,
|
||||
Speed & downloadSpeed,
|
||||
size_t & downloadPeerCount)
|
||||
TorrentModel::getTransferSpeed (Speed & uploadSpeed,
|
||||
size_t & uploadPeerCount,
|
||||
Speed & downloadSpeed,
|
||||
size_t & downloadPeerCount)
|
||||
{
|
||||
Speed upSpeed, downSpeed;
|
||||
size_t upCount=0, downCount=0;
|
||||
@@ -259,7 +259,7 @@ TorrentModel :: getTransferSpeed (Speed & uploadSpeed,
|
||||
}
|
||||
|
||||
QSet<int>
|
||||
TorrentModel :: getIds () const
|
||||
TorrentModel::getIds () const
|
||||
{
|
||||
QSet<int> ids;
|
||||
|
||||
@@ -271,7 +271,7 @@ TorrentModel :: getIds () const
|
||||
}
|
||||
|
||||
bool
|
||||
TorrentModel :: hasTorrent (const QString& hashString) const
|
||||
TorrentModel::hasTorrent (const QString& hashString) const
|
||||
{
|
||||
foreach (const Torrent * tor, myTorrents)
|
||||
if (tor->hashString () == hashString)
|
||||
|
||||
102
qt/torrent.cc
102
qt/torrent.cc
@@ -29,7 +29,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
Torrent :: Torrent (Prefs& prefs, int id):
|
||||
Torrent::Torrent (Prefs& prefs, int id):
|
||||
magnetTorrent (false),
|
||||
myPrefs (prefs)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ Torrent :: Torrent (Prefs& prefs, int id):
|
||||
setIcon (MIME_ICON, QApplication::style()->standardIcon (QStyle::SP_FileIcon));
|
||||
}
|
||||
|
||||
Torrent :: ~Torrent ()
|
||||
Torrent::~Torrent ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ Torrent :: ~Torrent ()
|
||||
****
|
||||
***/
|
||||
|
||||
Torrent :: Property
|
||||
Torrent :: myProperties[] =
|
||||
Torrent::Property
|
||||
Torrent::myProperties[] =
|
||||
{
|
||||
{ ID, TR_KEY_id, QVariant::Int, INFO, },
|
||||
{ UPLOAD_SPEED, TR_KEY_rateUpload, QVariant::ULongLong, STAT } /* Bps */,
|
||||
@@ -111,8 +111,8 @@ Torrent :: myProperties[] =
|
||||
{ QUEUE_POSITION, TR_KEY_queuePosition, QVariant::Int, STAT },
|
||||
};
|
||||
|
||||
Torrent :: KeyList
|
||||
Torrent :: buildKeyList (Group group)
|
||||
Torrent::KeyList
|
||||
Torrent::buildKeyList (Group group)
|
||||
{
|
||||
KeyList keys;
|
||||
|
||||
@@ -124,8 +124,8 @@ Torrent :: buildKeyList (Group group)
|
||||
return keys;
|
||||
}
|
||||
|
||||
const Torrent :: KeyList&
|
||||
Torrent :: getInfoKeys ()
|
||||
const Torrent::KeyList&
|
||||
Torrent::getInfoKeys ()
|
||||
{
|
||||
static KeyList keys;
|
||||
|
||||
@@ -135,15 +135,15 @@ Torrent :: getInfoKeys ()
|
||||
return keys;
|
||||
}
|
||||
|
||||
const Torrent :: KeyList&
|
||||
Torrent :: getStatKeys ()
|
||||
const Torrent::KeyList&
|
||||
Torrent::getStatKeys ()
|
||||
{
|
||||
static KeyList keys (buildKeyList(STAT));
|
||||
return keys;
|
||||
}
|
||||
|
||||
const Torrent :: KeyList&
|
||||
Torrent :: getExtraStatKeys()
|
||||
const Torrent::KeyList&
|
||||
Torrent::getExtraStatKeys()
|
||||
{
|
||||
static KeyList keys;
|
||||
|
||||
@@ -154,7 +154,7 @@ Torrent :: getExtraStatKeys()
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setInt (int i, int value)
|
||||
Torrent::setInt (int i, int value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -171,7 +171,7 @@ Torrent :: setInt (int i, int value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setBool (int i, bool value)
|
||||
Torrent::setBool (int i, bool value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -188,7 +188,7 @@ Torrent :: setBool (int i, bool value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setDouble (int i, double value)
|
||||
Torrent::setDouble (int i, double value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -205,7 +205,7 @@ Torrent :: setDouble (int i, double value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setDateTime (int i, const QDateTime& value)
|
||||
Torrent::setDateTime (int i, const QDateTime& value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -222,7 +222,7 @@ Torrent :: setDateTime (int i, const QDateTime& value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setSize (int i, qulonglong value)
|
||||
Torrent::setSize (int i, qulonglong value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -239,7 +239,7 @@ Torrent :: setSize (int i, qulonglong value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setString (int i, const char * value)
|
||||
Torrent::setString (int i, const char * value)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
@@ -256,7 +256,7 @@ Torrent :: setString (int i, const char * value)
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: setIcon (int i, const QIcon& value)
|
||||
Torrent::setIcon (int i, const QIcon& value)
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::Icon);
|
||||
@@ -266,7 +266,7 @@ Torrent :: setIcon (int i, const QIcon& value)
|
||||
}
|
||||
|
||||
int
|
||||
Torrent :: getInt (int i) const
|
||||
Torrent::getInt (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::Int);
|
||||
@@ -275,7 +275,7 @@ Torrent :: getInt (int i) const
|
||||
}
|
||||
|
||||
QDateTime
|
||||
Torrent :: getDateTime (int i) const
|
||||
Torrent::getDateTime (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::DateTime);
|
||||
@@ -284,7 +284,7 @@ Torrent :: getDateTime (int i) const
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: getBool (int i) const
|
||||
Torrent::getBool (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::Bool);
|
||||
@@ -293,7 +293,7 @@ Torrent :: getBool (int i) const
|
||||
}
|
||||
|
||||
qulonglong
|
||||
Torrent :: getSize (int i) const
|
||||
Torrent::getSize (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::ULongLong);
|
||||
@@ -301,7 +301,7 @@ Torrent :: getSize (int i) const
|
||||
return myValues[i].toULongLong ();
|
||||
}
|
||||
double
|
||||
Torrent :: getDouble (int i) const
|
||||
Torrent::getDouble (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::Double);
|
||||
@@ -309,7 +309,7 @@ Torrent :: getDouble (int i) const
|
||||
return myValues[i].toDouble ();
|
||||
}
|
||||
QString
|
||||
Torrent :: getString (int i) const
|
||||
Torrent::getString (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::String);
|
||||
@@ -317,7 +317,7 @@ Torrent :: getString (int i) const
|
||||
return myValues[i].toString ();
|
||||
}
|
||||
QIcon
|
||||
Torrent :: getIcon (int i) const
|
||||
Torrent::getIcon (int i) const
|
||||
{
|
||||
assert (0<=i && i<PROPERTY_COUNT);
|
||||
assert (myProperties[i].type == QVariant::Icon);
|
||||
@@ -330,7 +330,7 @@ Torrent :: getIcon (int i) const
|
||||
***/
|
||||
|
||||
bool
|
||||
Torrent :: getSeedRatio (double& ratio) const
|
||||
Torrent::getSeedRatio (double& ratio) const
|
||||
{
|
||||
bool isLimited;
|
||||
|
||||
@@ -342,8 +342,8 @@ Torrent :: getSeedRatio (double& ratio) const
|
||||
break;
|
||||
|
||||
case TR_RATIOLIMIT_GLOBAL:
|
||||
if ((isLimited = myPrefs.getBool (Prefs :: RATIO_ENABLED)))
|
||||
ratio = myPrefs.getDouble (Prefs :: RATIO);
|
||||
if ((isLimited = myPrefs.getBool (Prefs::RATIO_ENABLED)))
|
||||
ratio = myPrefs.getDouble (Prefs::RATIO);
|
||||
break;
|
||||
|
||||
default: // TR_RATIOLIMIT_UNLIMITED:
|
||||
@@ -355,7 +355,7 @@ Torrent :: getSeedRatio (double& ratio) const
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: hasFileSubstring (const QString& substr) const
|
||||
Torrent::hasFileSubstring (const QString& substr) const
|
||||
{
|
||||
foreach (const TrFile file, myFiles)
|
||||
if (file.filename.contains (substr, Qt::CaseInsensitive))
|
||||
@@ -365,7 +365,7 @@ Torrent :: hasFileSubstring (const QString& substr) const
|
||||
}
|
||||
|
||||
bool
|
||||
Torrent :: hasTrackerSubstring (const QString& substr) const
|
||||
Torrent::hasTrackerSubstring (const QString& substr) const
|
||||
{
|
||||
foreach (QString s, myValues[TRACKERS].toStringList())
|
||||
if (s.contains (substr, Qt::CaseInsensitive))
|
||||
@@ -375,7 +375,7 @@ Torrent :: hasTrackerSubstring (const QString& substr) const
|
||||
}
|
||||
|
||||
int
|
||||
Torrent :: compareSeedRatio (const Torrent& that) const
|
||||
Torrent::compareSeedRatio (const Torrent& that) const
|
||||
{
|
||||
double a;
|
||||
double b;
|
||||
@@ -389,7 +389,7 @@ Torrent :: compareSeedRatio (const Torrent& that) const
|
||||
}
|
||||
|
||||
int
|
||||
Torrent :: compareRatio (const Torrent& that) const
|
||||
Torrent::compareRatio (const Torrent& that) const
|
||||
{
|
||||
const double a = ratio ();
|
||||
const double b = that.ratio ();
|
||||
@@ -402,7 +402,7 @@ Torrent :: compareRatio (const Torrent& that) const
|
||||
}
|
||||
|
||||
int
|
||||
Torrent :: compareETA (const Torrent& that) const
|
||||
Torrent::compareETA (const Torrent& that) const
|
||||
{
|
||||
const bool haveA (hasETA ());
|
||||
const bool haveB (that.hasETA ());
|
||||
@@ -413,7 +413,7 @@ Torrent :: compareETA (const Torrent& that) const
|
||||
}
|
||||
|
||||
int
|
||||
Torrent :: compareTracker (const Torrent& that) const
|
||||
Torrent::compareTracker (const Torrent& that) const
|
||||
{
|
||||
Q_UNUSED (that);
|
||||
|
||||
@@ -426,7 +426,7 @@ Torrent :: compareTracker (const Torrent& that) const
|
||||
***/
|
||||
|
||||
void
|
||||
Torrent :: updateMimeIcon ()
|
||||
Torrent::updateMimeIcon ()
|
||||
{
|
||||
const FileList& files (myFiles);
|
||||
|
||||
@@ -435,7 +435,7 @@ Torrent :: updateMimeIcon ()
|
||||
if (files.size () > 1)
|
||||
icon = QFileIconProvider().icon (QFileIconProvider::Folder);
|
||||
else if (files.size () == 1)
|
||||
icon = Utils :: guessMimeIcon (files.at(0).filename);
|
||||
icon = Utils::guessMimeIcon (files.at(0).filename);
|
||||
else
|
||||
icon = QIcon ();
|
||||
|
||||
@@ -447,7 +447,7 @@ Torrent :: updateMimeIcon ()
|
||||
***/
|
||||
|
||||
void
|
||||
Torrent :: notifyComplete () const
|
||||
Torrent::notifyComplete () const
|
||||
{
|
||||
// if someone wants to implement notification, here's the hook.
|
||||
}
|
||||
@@ -457,7 +457,7 @@ Torrent :: notifyComplete () const
|
||||
***/
|
||||
|
||||
void
|
||||
Torrent :: update (tr_variant * d)
|
||||
Torrent::update (tr_variant * d)
|
||||
{
|
||||
static bool lookup_initialized = false;
|
||||
static int key_to_property_index[TR_N_KEYS];
|
||||
@@ -487,51 +487,51 @@ Torrent :: update (tr_variant * d)
|
||||
|
||||
switch (myProperties[property_index].type)
|
||||
{
|
||||
case QVariant :: Int:
|
||||
case QVariant::Int:
|
||||
{
|
||||
int64_t val;
|
||||
if (tr_variantGetInt (child, &val))
|
||||
changed |= setInt (property_index, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: Bool:
|
||||
case QVariant::Bool:
|
||||
{
|
||||
bool val;
|
||||
if (tr_variantGetBool (child, &val))
|
||||
changed |= setBool (property_index, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: String:
|
||||
case QVariant::String:
|
||||
{
|
||||
const char * val;
|
||||
if (tr_variantGetStr(child, &val, NULL))
|
||||
changed |= setString (property_index, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: ULongLong:
|
||||
case QVariant::ULongLong:
|
||||
{
|
||||
int64_t val;
|
||||
if (tr_variantGetInt (child, &val))
|
||||
changed |= setSize (property_index, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: Double:
|
||||
case QVariant::Double:
|
||||
{
|
||||
double val;
|
||||
if (tr_variantGetReal (child, &val))
|
||||
changed |= setDouble (property_index, val);
|
||||
break;
|
||||
}
|
||||
case QVariant :: DateTime:
|
||||
case QVariant::DateTime:
|
||||
{
|
||||
int64_t val;
|
||||
if (tr_variantGetInt (child, &val) && val)
|
||||
changed |= setDateTime (property_index, QDateTime :: fromTime_t(val));
|
||||
changed |= setDateTime (property_index, QDateTime::fromTime_t(val));
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant :: StringList:
|
||||
case TrTypes :: PeerList:
|
||||
case QVariant::StringList:
|
||||
case TrTypes::PeerList:
|
||||
// handled below
|
||||
break;
|
||||
|
||||
@@ -764,7 +764,7 @@ Torrent :: update (tr_variant * d)
|
||||
}
|
||||
|
||||
QString
|
||||
Torrent :: activityString () const
|
||||
Torrent::activityString () const
|
||||
{
|
||||
QString str;
|
||||
|
||||
@@ -783,7 +783,7 @@ Torrent :: activityString () const
|
||||
}
|
||||
|
||||
QString
|
||||
Torrent :: getError () const
|
||||
Torrent::getError () const
|
||||
{
|
||||
QString s = getString (ERROR_STRING);
|
||||
|
||||
@@ -799,7 +799,7 @@ Torrent :: getError () const
|
||||
}
|
||||
|
||||
QPixmap
|
||||
TrackerStat :: getFavicon () const
|
||||
TrackerStat::getFavicon () const
|
||||
{
|
||||
MyApp * myApp = dynamic_cast<MyApp*>(QApplication::instance());
|
||||
return myApp->favicons.find (QUrl (announce));
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace
|
||||
}
|
||||
|
||||
QSize
|
||||
TrackerDelegate :: margin (const QStyle& style) const
|
||||
TrackerDelegate::margin (const QStyle& style) const
|
||||
{
|
||||
Q_UNUSED (style);
|
||||
|
||||
@@ -45,14 +45,14 @@ TrackerDelegate :: margin (const QStyle& style) const
|
||||
***/
|
||||
|
||||
QSize
|
||||
TrackerDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
const TrackerInfo & info) const
|
||||
TrackerDelegate::sizeHint (const QStyleOptionViewItem & option,
|
||||
const TrackerInfo & info) const
|
||||
{
|
||||
Q_UNUSED (option);
|
||||
|
||||
QPixmap favicon = info.st.getFavicon ();
|
||||
|
||||
const QString text = TrackerDelegate :: getText(info);
|
||||
const QString text = TrackerDelegate::getText(info);
|
||||
QTextDocument textDoc;
|
||||
textDoc.setHtml (text);
|
||||
const QSize textSize = textDoc.size().toSize();
|
||||
@@ -62,17 +62,17 @@ TrackerDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
}
|
||||
|
||||
QSize
|
||||
TrackerDelegate :: sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
TrackerDelegate::sizeHint (const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
const TrackerInfo trackerInfo = index.data (TrackerModel::TrackerRole).value<TrackerInfo>();
|
||||
return sizeHint (option, trackerInfo);
|
||||
}
|
||||
|
||||
void
|
||||
TrackerDelegate :: paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
TrackerDelegate::paint (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
const TrackerInfo trackerInfo = index.data (TrackerModel::TrackerRole).value<TrackerInfo>();
|
||||
painter->save();
|
||||
@@ -84,9 +84,9 @@ TrackerDelegate :: paint (QPainter * painter,
|
||||
}
|
||||
|
||||
void
|
||||
TrackerDelegate :: drawTracker (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const TrackerInfo & inf) const
|
||||
TrackerDelegate::drawTracker (QPainter * painter,
|
||||
const QStyleOptionViewItem & option,
|
||||
const TrackerInfo & inf) const
|
||||
{
|
||||
painter->save();
|
||||
|
||||
@@ -110,7 +110,7 @@ TrackerDelegate :: drawTracker (QPainter * painter,
|
||||
}
|
||||
|
||||
void
|
||||
TrackerDelegate :: setShowMore (bool b)
|
||||
TrackerDelegate::setShowMore (bool b)
|
||||
{
|
||||
myShowMore = b;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ namespace
|
||||
}
|
||||
|
||||
QString
|
||||
TrackerDelegate :: getText (const TrackerInfo& inf) const
|
||||
TrackerDelegate::getText (const TrackerInfo& inf) const
|
||||
{
|
||||
QString key;
|
||||
QString str;
|
||||
|
||||
@@ -10,22 +10,22 @@
|
||||
#include "tracker-model.h"
|
||||
#include "tracker-model-filter.h"
|
||||
|
||||
TrackerModelFilter :: TrackerModelFilter (QObject * parent):
|
||||
TrackerModelFilter::TrackerModelFilter (QObject * parent):
|
||||
QSortFilterProxyModel (parent),
|
||||
myShowBackups (false)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TrackerModelFilter :: setShowBackupTrackers (bool b)
|
||||
TrackerModelFilter::setShowBackupTrackers (bool b)
|
||||
{
|
||||
myShowBackups = b;
|
||||
invalidateFilter ();
|
||||
}
|
||||
|
||||
bool
|
||||
TrackerModelFilter :: filterAcceptsRow (int sourceRow,
|
||||
const QModelIndex & sourceParent) const
|
||||
TrackerModelFilter::filterAcceptsRow (int sourceRow,
|
||||
const QModelIndex & sourceParent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
const TrackerInfo trackerInfo = index.data(TrackerModel::TrackerRole).value<TrackerInfo>();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "tracker-model.h"
|
||||
|
||||
int
|
||||
TrackerModel :: rowCount (const QModelIndex& parent) const
|
||||
TrackerModel::rowCount (const QModelIndex& parent) const
|
||||
{
|
||||
Q_UNUSED (parent);
|
||||
|
||||
@@ -23,7 +23,7 @@ TrackerModel :: rowCount (const QModelIndex& parent) const
|
||||
}
|
||||
|
||||
QVariant
|
||||
TrackerModel :: data (const QModelIndex& index, int role) const
|
||||
TrackerModel::data (const QModelIndex& index, int role) const
|
||||
{
|
||||
QVariant var;
|
||||
|
||||
@@ -77,7 +77,7 @@ struct CompareTrackers
|
||||
};
|
||||
|
||||
void
|
||||
TrackerModel :: refresh (const TorrentModel& torrentModel, const QSet<int>& ids)
|
||||
TrackerModel::refresh (const TorrentModel& torrentModel, const QSet<int>& ids)
|
||||
{
|
||||
// build a list of the TrackerInfos
|
||||
QVector<TrackerInfo> trackers;
|
||||
@@ -152,7 +152,7 @@ TrackerModel :: refresh (const TorrentModel& torrentModel, const QSet<int>& ids)
|
||||
}
|
||||
|
||||
int
|
||||
TrackerModel :: find (int torrentId, const QString& url) const
|
||||
TrackerModel::find (int torrentId, const QString& url) const
|
||||
{
|
||||
for (int i=0, n=myRows.size(); i<n; ++i)
|
||||
{
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
#include "hig.h"
|
||||
#include "triconpushbutton.h"
|
||||
|
||||
TrIconPushButton :: TrIconPushButton (QWidget * parent):
|
||||
TrIconPushButton::TrIconPushButton (QWidget * parent):
|
||||
QPushButton (parent)
|
||||
{
|
||||
}
|
||||
|
||||
TrIconPushButton :: TrIconPushButton (const QIcon& icon, QWidget * parent):
|
||||
TrIconPushButton::TrIconPushButton (const QIcon& icon, QWidget * parent):
|
||||
QPushButton (parent)
|
||||
{
|
||||
setIcon (icon);
|
||||
}
|
||||
|
||||
QSize
|
||||
TrIconPushButton :: sizeHint () const
|
||||
TrIconPushButton::sizeHint () const
|
||||
{
|
||||
QSize s = iconSize ();
|
||||
s.rwidth() += HIG::PAD_SMALL*2;
|
||||
@@ -36,7 +36,7 @@ TrIconPushButton :: sizeHint () const
|
||||
}
|
||||
|
||||
void
|
||||
TrIconPushButton :: paintEvent (QPaintEvent *)
|
||||
TrIconPushButton::paintEvent (QPaintEvent *)
|
||||
{
|
||||
QStylePainter p (this);
|
||||
QStyleOptionButton opt;
|
||||
|
||||
12
qt/utils.cc
12
qt/utils.cc
@@ -40,7 +40,7 @@ extern QPixmap qt_pixmapFromWinHICON(HICON icon);
|
||||
#endif
|
||||
|
||||
QString
|
||||
Utils :: remoteFileChooser (QWidget * parent, const QString& title, const QString& myPath, bool dir, bool local)
|
||||
Utils::remoteFileChooser (QWidget * parent, const QString& title, const QString& myPath, bool dir, bool local)
|
||||
{
|
||||
QString path;
|
||||
|
||||
@@ -60,7 +60,7 @@ Utils :: remoteFileChooser (QWidget * parent, const QString& title, const QStrin
|
||||
}
|
||||
|
||||
void
|
||||
Utils :: toStderr (const QString& str)
|
||||
Utils::toStderr (const QString& str)
|
||||
{
|
||||
std::cerr << qPrintable(str) << std::endl;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace
|
||||
#endif
|
||||
|
||||
QIcon
|
||||
Utils :: guessMimeIcon (const QString& filename)
|
||||
Utils::guessMimeIcon (const QString& filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
QIcon icon;
|
||||
@@ -133,7 +133,7 @@ Utils :: guessMimeIcon (const QString& filename)
|
||||
|
||||
if (fileIcons[0].isNull ())
|
||||
{
|
||||
fallback = QApplication::style()->standardIcon (QStyle :: SP_FileIcon);
|
||||
fallback = QApplication::style()->standardIcon (QStyle::SP_FileIcon);
|
||||
|
||||
suffixes[DISK] << QString::fromLatin1("iso");
|
||||
fileIcons[DISK]= QIcon::fromTheme (QString::fromLatin1("media-optical"), fallback);
|
||||
@@ -188,7 +188,7 @@ Utils :: guessMimeIcon (const QString& filename)
|
||||
}
|
||||
|
||||
bool
|
||||
Utils :: isValidUtf8 (const char *s)
|
||||
Utils::isValidUtf8 (const char * s)
|
||||
{
|
||||
int n; // number of bytes in a UTF-8 sequence
|
||||
|
||||
@@ -211,7 +211,7 @@ Utils :: isValidUtf8 (const char *s)
|
||||
}
|
||||
|
||||
QString
|
||||
Utils :: removeTrailingDirSeparator (const QString& path)
|
||||
Utils::removeTrailingDirSeparator (const QString& path)
|
||||
{
|
||||
return path.endsWith (QDir::separator ())
|
||||
? path.left (path.length()-1)
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
****
|
||||
***/
|
||||
|
||||
WatchDir :: WatchDir (const TorrentModel& model):
|
||||
WatchDir::WatchDir (const TorrentModel& model):
|
||||
myModel (model),
|
||||
myWatcher (0)
|
||||
{
|
||||
}
|
||||
|
||||
WatchDir :: ~WatchDir ()
|
||||
WatchDir::~WatchDir ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ WatchDir :: ~WatchDir ()
|
||||
***/
|
||||
|
||||
int
|
||||
WatchDir :: metainfoTest (const QString& filename) const
|
||||
WatchDir::metainfoTest (const QString& filename) const
|
||||
{
|
||||
int ret;
|
||||
tr_info inf;
|
||||
@@ -62,7 +62,7 @@ WatchDir :: metainfoTest (const QString& filename) const
|
||||
}
|
||||
|
||||
void
|
||||
WatchDir :: onTimeout ()
|
||||
WatchDir::onTimeout ()
|
||||
{
|
||||
QTimer * t = qobject_cast<QTimer*>(sender());
|
||||
const QString filename = t->objectName ();
|
||||
@@ -74,7 +74,7 @@ WatchDir :: onTimeout ()
|
||||
}
|
||||
|
||||
void
|
||||
WatchDir :: setPath (const QString& path, bool isEnabled)
|
||||
WatchDir::setPath (const QString& path, bool isEnabled)
|
||||
{
|
||||
// clear out any remnants of the previous watcher, if any
|
||||
myWatchDirFiles.clear ();
|
||||
@@ -97,7 +97,7 @@ WatchDir :: setPath (const QString& path, bool isEnabled)
|
||||
}
|
||||
|
||||
void
|
||||
WatchDir :: watcherActivated (const QString& path)
|
||||
WatchDir::watcherActivated (const QString& path)
|
||||
{
|
||||
const QDir dir(path);
|
||||
|
||||
@@ -142,7 +142,7 @@ WatchDir :: watcherActivated (const QString& path)
|
||||
}
|
||||
|
||||
void
|
||||
WatchDir :: rescanAllWatchedDirectories ()
|
||||
WatchDir::rescanAllWatchedDirectories ()
|
||||
{
|
||||
if (myWatcher == nullptr)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user