2015-04-22 19:32:04 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <c++utilities/chrono/timespan.h>
|
|
|
|
|
2019-12-30 22:27:20 +01:00
|
|
|
#include <QElapsedTimer>
|
2017-05-01 03:22:50 +02:00
|
|
|
#include <QList>
|
2015-04-22 19:32:04 +02:00
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QLabel;
|
|
|
|
class QMenu;
|
|
|
|
class QSpinBox;
|
|
|
|
class QToolButton;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2019-06-10 22:50:15 +02:00
|
|
|
namespace QtUtilities {
|
2015-04-22 19:32:04 +02:00
|
|
|
class AboutDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Network {
|
|
|
|
class Download;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
class DownloadInteraction;
|
|
|
|
class AddDownloadDialog;
|
|
|
|
class AddMultipleDownloadsWizard;
|
|
|
|
class SettingsDialog;
|
|
|
|
class ProgressBarItemDelegate;
|
|
|
|
class ComboBoxItemDelegate;
|
|
|
|
class DownloadModel;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
class MainWindow : public QMainWindow {
|
2015-04-22 19:32:04 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor, Destructor
|
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void downloadChangedStatus(Network::Download *download);
|
|
|
|
void downloadChangedProgress(Network::Download *download);
|
|
|
|
|
|
|
|
void updateOverallStatus(Network::Download *download);
|
|
|
|
void checkForDownloadsToStartAutomatically();
|
|
|
|
void startOrStopSelectedDownloads();
|
|
|
|
void interruptOrResumeSelectedDownloads();
|
|
|
|
void removeSelectedDownloads();
|
|
|
|
|
|
|
|
// methods to show the dialogs and messages
|
|
|
|
void showAboutDialog();
|
|
|
|
void showAddDownloadDialog();
|
|
|
|
void addDownloadDialogResults();
|
|
|
|
void showAddMultipleDownloadsDialog();
|
|
|
|
void addMultipleDownloadsWizardResults();
|
|
|
|
void showSettingsDialog();
|
|
|
|
void settingsAccepted();
|
|
|
|
void showTrayIconMessage();
|
|
|
|
|
|
|
|
// methods for misc gui functionalities
|
|
|
|
void copyDownloadUrl();
|
|
|
|
void setDownloadRange();
|
|
|
|
void setTargetPath();
|
|
|
|
void clearTargetPath();
|
|
|
|
void showYoutubeItagsInfo();
|
|
|
|
void resetGroovesharkSession();
|
|
|
|
void exploreDownloadsDir();
|
|
|
|
void updateSelectionMode();
|
|
|
|
void updateStartStopControls();
|
|
|
|
void showDownloadsTreeViewContextMenu(const QPoint &pos);
|
|
|
|
void trayIconActivated();
|
|
|
|
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
|
|
|
void trayIconDestroyed(QObject *);
|
|
|
|
void clipboardDataChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// methods to handle downloads
|
|
|
|
void addDownload(Network::Download *download);
|
|
|
|
QList<Network::Download *> selectedDownloads() const;
|
|
|
|
void setupTrayIcon();
|
|
|
|
|
|
|
|
// fields
|
|
|
|
// ui
|
|
|
|
std::unique_ptr<Ui::MainWindow> m_ui;
|
|
|
|
QSystemTrayIcon *m_trayIcon;
|
|
|
|
QMenu *m_trayIconMenu;
|
|
|
|
QMenu *m_downloadsTreeViewContextMenu;
|
|
|
|
QSpinBox *m_autoSpinBox;
|
|
|
|
QLabel *m_downloadStatusLabel;
|
|
|
|
QToolButton *m_superviseClipboardToolButton;
|
|
|
|
bool m_internalClipboardChange;
|
|
|
|
// model, deleagtes
|
|
|
|
DownloadModel *m_model;
|
|
|
|
ProgressBarItemDelegate *m_progressBarDelegate;
|
|
|
|
ComboBoxItemDelegate *m_comboBoxDelegate;
|
|
|
|
// overall download status
|
|
|
|
int m_activeDownloads;
|
|
|
|
int m_downloadsToStart;
|
|
|
|
int m_initiatingDownloads;
|
|
|
|
double m_totalSpeed;
|
|
|
|
qint64 m_stillToReceive;
|
2019-06-10 22:50:15 +02:00
|
|
|
CppUtilities::TimeSpan m_remainingTime;
|
2019-12-30 22:27:20 +01:00
|
|
|
QElapsedTimer m_elapsedTime;
|
2015-04-22 19:32:04 +02:00
|
|
|
DownloadInteraction *m_downloadInteraction;
|
|
|
|
AddDownloadDialog *m_addDownloadDlg;
|
|
|
|
AddMultipleDownloadsWizard *m_addMultipleDownloadsWizard;
|
|
|
|
SettingsDialog *m_settingsDlg;
|
2019-06-10 22:50:15 +02:00
|
|
|
QtUtilities::AboutDialog *m_aboutDlg;
|
2015-04-22 19:32:04 +02:00
|
|
|
};
|
2019-07-20 20:20:58 +02:00
|
|
|
} // namespace QtGui
|
2015-04-22 19:32:04 +02:00
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|