-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
89 lines (70 loc) · 2.16 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPointer>
#include "settings/settingvalue.h"
class QLabel;
class QToolButton;
class TorrentTransferTableView;
namespace Ui
{
class MainWindow;
}
class MainWindow final : public QMainWindow
{
Q_OBJECT
Q_DISABLE_COPY(MainWindow)
public:
/*! Constructor. */
explicit MainWindow(QWidget *parent = nullptr);
/*! Virtual destructor. */
~MainWindow() noexcept final;
inline HWND qBittorrentHwnd() const noexcept;
// NOLINTNEXTLINE(readability-redundant-access-specifiers)
public slots:
void show();
signals:
void torrentsAddedOrRemoved();
void torrentsChanged(const QVector<QString> &torrentInfoHashes);
void qBittorrentHwndChanged(HWND hwnd);
void qBittorrentUp(bool initial = false);
void qBittorrentDown(bool initial = false);
private:
void initFilterTorrentsLineEdit();
void createStatusBar();
quint64 selectTorrentsCount() const;
quint64 selectTorrentFilesCount() const;
inline bool isqBittorrentUp() const noexcept;
HWND m_qBittorrentHwnd = nullptr;
std::unique_ptr<Ui::MainWindow> m_ui;
QPointer<QLabel> m_torrentsCountLabel;
QPointer<QLabel> m_torrentFilesCountLabel;
QPointer<QLabel> m_qBittorrentConnectedLabel;
QPointer<QToolButton> m_searchButton;
QPointer<TorrentTransferTableView> m_tableView;
Settings::CachedSettingValue<bool> m_regexTorrentsFilter;
// NOLINTNEXTLINE(readability-redundant-access-specifiers)
private slots:
void focusTorrentsFilterLineEdit() const;
void refreshStatusBar() const;
inline void updateqBittorrentHwnd(HWND hwnd) noexcept;
void applicationStateChanged(Qt::ApplicationState state) const;
void setGeometry(bool initial = false);
void qBittorrentConnected() const;
void qBittorrentDisconnected() const;
void showFilterContextMenu();
};
HWND MainWindow::qBittorrentHwnd() const noexcept
{
return m_qBittorrentHwnd;
}
bool MainWindow::isqBittorrentUp() const noexcept
{
return m_qBittorrentHwnd != nullptr;
}
void MainWindow::updateqBittorrentHwnd(HWND hwnd) noexcept
{
m_qBittorrentHwnd = hwnd;
}
#endif // MAINWINDOW_H