2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QSet>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2015-09-01 20:19:26 +00:00
|
|
|
#include "BaseDialog.h"
|
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "ui_DetailsDialog.h"
|
2014-12-14 18:12:21 +00:00
|
|
|
|
2009-04-09 18:55:47 +00:00
|
|
|
class QTreeWidgetItem;
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
class Prefs;
|
2009-04-09 18:55:47 +00:00
|
|
|
class Session;
|
|
|
|
class Torrent;
|
2009-04-18 23:18:28 +00:00
|
|
|
class TorrentModel;
|
2010-07-27 19:43:32 +00:00
|
|
|
class TrackerDelegate;
|
|
|
|
class TrackerModel;
|
2010-07-28 14:43:47 +00:00
|
|
|
class TrackerModelFilter;
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
class DetailsDialog : public BaseDialog
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2013-01-26 01:19:54 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
2017-04-20 16:02:19 +00:00
|
|
|
DetailsDialog(Session&, Prefs&, TorrentModel const&, QWidget* parent = nullptr);
|
2017-04-19 12:04:45 +00:00
|
|
|
virtual ~DetailsDialog();
|
2015-06-12 22:12:12 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
void setIds(QSet<int> const& ids);
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
// QWidget
|
2017-04-19 12:04:45 +00:00
|
|
|
virtual QSize sizeHint() const
|
|
|
|
{
|
|
|
|
return QSize(440, 460);
|
|
|
|
}
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
|
|
|
void initPeersTab();
|
|
|
|
void initTrackerTab();
|
|
|
|
void initInfoTab();
|
|
|
|
void initFilesTab();
|
|
|
|
void initOptionsTab();
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void getNewData();
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
QIcon getStockIcon(QString const& freedesktop_name, int fallback);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private slots:
|
|
|
|
void refresh();
|
|
|
|
void refreshPref(int key);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void onTorrentChanged();
|
|
|
|
void onTimer();
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2015-06-12 22:12:12 +00:00
|
|
|
// Tracker tab
|
2017-04-19 12:04:45 +00:00
|
|
|
void onTrackerSelectionChanged();
|
|
|
|
void onAddTrackerClicked();
|
|
|
|
void onEditTrackerClicked();
|
|
|
|
void onRemoveTrackerClicked();
|
|
|
|
void onShowTrackerScrapesToggled(bool);
|
|
|
|
void onShowBackupTrackersToggled(bool);
|
2013-01-26 01:19:54 +00:00
|
|
|
|
2015-06-12 22:12:12 +00:00
|
|
|
// Files tab
|
2017-04-20 16:02:19 +00:00
|
|
|
void onFilePriorityChanged(QSet<int> const& fileIndices, int);
|
|
|
|
void onFileWantedChanged(QSet<int> const& fileIndices, bool);
|
|
|
|
void onPathEdited(QString const& oldpath, QString const& newname);
|
|
|
|
void onOpenRequested(QString const& path);
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
// Options tab
|
2017-04-19 12:04:45 +00:00
|
|
|
void onBandwidthPriorityChanged(int);
|
|
|
|
void onHonorsSessionLimitsToggled(bool);
|
|
|
|
void onDownloadLimitedToggled(bool);
|
|
|
|
void onSpinBoxEditingFinished();
|
|
|
|
void onUploadLimitedToggled(bool);
|
|
|
|
void onRatioModeChanged(int);
|
|
|
|
void onIdleModeChanged(int);
|
|
|
|
void onIdleLimitChanged();
|
|
|
|
|
|
|
|
private:
|
2015-06-12 22:12:12 +00:00
|
|
|
Session& mySession;
|
|
|
|
Prefs& myPrefs;
|
2017-04-20 16:02:19 +00:00
|
|
|
TorrentModel const& myModel;
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
Ui::DetailsDialog ui;
|
|
|
|
|
|
|
|
QSet<int> myIds;
|
|
|
|
QTimer myTimer;
|
|
|
|
bool myChangedTorrents;
|
|
|
|
bool myHavePendingRefresh;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
TrackerModel* myTrackerModel;
|
|
|
|
TrackerModelFilter* myTrackerFilter;
|
|
|
|
TrackerDelegate* myTrackerDelegate;
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
QMap<QString, QTreeWidgetItem*> myPeers;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|