This repository was archived by the owner on Aug 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathmainwindow.h
executable file
·174 lines (155 loc) · 4.88 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
Copyright 2014 Ilya Zhuravlev
This file is part of Acquisition.
Acquisition is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Acquisition is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Acquisition. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>
#include <QLabel>
#include <QMainWindow>
#include <QMenu>
#include <QPushButton>
#include <QCloseEvent>
#ifdef Q_OS_WIN
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif
#include "autoonline.h"
#include "bucket.h"
#include "items_model.h"
#include "porting.h"
#include "updatechecker.h"
#include "tabcache.h"
class QNetworkAccessManager;
class QNetworkReply;
class QVBoxLayout;
class Application;
class Column;
class Filter;
class FlowLayout;
class ImageCache;
class Search;
class QStringListModel;
struct Buyout;
namespace Ui {
class MainWindow;
}
enum class TreeState {
kExpand,
kCollapse
};
enum class ProgramState {
Unknown,
CharactersReceived,
ItemsReceive,
ItemsPaused,
ItemsCompleted,
ShopSubmitting,
ShopCompleted,
UpdateCancelled
};
struct CurrentStatusUpdate {
ProgramState state;
int progress{}, total{}, cached{};
};
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(std::unique_ptr<Application> app);
~MainWindow();
std::vector<Column*> columns;
public slots:
void OnTreeChange(const QModelIndex &index, const QModelIndex &prev);
void OnSearchFormChange();
void OnDelayedSearchFormChange();
void OnTabChange(int index);
void OnImageFetched(QNetworkReply *reply);
void OnItemsRefreshed();
void OnStatusUpdate(const CurrentStatusUpdate &status);
void OnBuyoutChange();
void ResizeTreeColumns();
void OnExpandAll();
void OnCollapseAll();
void OnCheckAll();
void OnUncheckAll();
void OnCheckSelected() { CheckSelected(true); };
void OnUncheckSelected() { CheckSelected(false); };
void OnRefreshSelected();
void OnUpdateAvailable();
void OnOnlineUpdate(bool online);
void OnUploadFinished();
private slots:
void on_actionForum_shop_thread_triggered();
void on_actionCopy_shop_data_to_clipboard_triggered();
void on_actionItems_refresh_interval_triggered();
void on_actionRefresh_triggered();
void on_actionRefresh_checked_triggered();
void on_actionAutomatically_refresh_items_triggered();
void on_actionUpdate_shop_triggered();
void on_actionShop_template_triggered();
void on_actionAutomatically_update_shop_triggered();
void on_actionControl_poe_xyz_is_URL_triggered();
void on_actionRemoteScript_triggered();
void on_actionAutomatically_refresh_online_status_triggered();
void on_actionList_currency_triggered();
void on_actionDark_triggered(bool toggle);
void on_actionLight_triggered(bool toggle);
void on_actionExport_currency_triggered();
void on_uploadTooltipButton_clicked();
void on_pobTooltipButton_clicked();
private:
void ModelViewRefresh();
void UpdateCurrentBucket();
void UpdateCurrentItem();
void UpdateCurrentBuyout();
void NewSearch();
void SetCurrentSearch(Search *search);
void InitializeLogging();
void InitializeSearchForm();
void InitializeUi();
void AddSearchGroup(QLayout *layout, const std::string &name);
bool eventFilter(QObject *o, QEvent *e);
void UpdateShopMenu();
void UpdateBuyoutWidgets(const Buyout &bo);
void ExpandCollapse(TreeState state);
void UpdateOnlineGui();
void closeEvent();
void CheckSelected(bool value);
std::unique_ptr<Application> app_;
Ui::MainWindow *ui;
std::shared_ptr<Item> current_item_;
Bucket current_bucket_;
std::vector<Search*> searches_;
Search *current_search_;
Search *previous_search_{nullptr};
QTabBar *tab_bar_;
std::vector<std::unique_ptr<Filter>> filters_;
int search_count_;
QNetworkAccessManager *image_network_manager_;
ImageCache *image_cache_;
QLabel *status_bar_label_;
QVBoxLayout *search_form_layout_;
QMenu context_menu_;
UpdateChecker update_checker_;
QPushButton update_button_;
QPushButton refresh_button_;
AutoOnline auto_online_;
QLabel online_label_;
QNetworkAccessManager *network_manager_;
QTimer delayed_update_current_item_;
QTimer delayed_search_form_change_;
QStringListModel *category_string_model_;
QStringListModel *rarity_search_model_;
#ifdef Q_OS_WIN32
QWinTaskbarButton *taskbar_button_;
#endif
};