forked from easysoft/zenshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstarterui.h
129 lines (101 loc) · 3.25 KB
/
starterui.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
#pragma once
#include "starter.h"
#include "setting/settingdlg.h"
#include "setting/zentaosetting.h"
#include "preview/zentaosubmit.h"
#include "preview/zentaotips.h"
#include "httprequest/zhttprequest.h"
#include "usrmetatype.h"
#include <QDialog>
#include <QSystemTrayIcon>
#include <list>
#include <string>
class StarterUI : public QDialog {
Q_OBJECT
public:
StarterUI();
virtual ~StarterUI();
int UsrLogin(string_ptr url, string_ptr usr, string_ptr pass, QString& err_token);
signals:
void SatrtShot();
void ShotDone(Starter* starer);
void CheckHotKey(uint32_t value);
#if !NZENTAO_VER_
void StopShot(Starter* starter);
void Thumbnail(std::shared_ptr<QPixmap> pixmap);
void Login(string_ptr url, string_ptr usr, string_ptr pass);
void SubmitLoginResult(bool result);
void ReqProduct();
void ProductItems(zproduct_item_vec_ptr products);
void ReqModule(uint32_t product_id, string_ptr view_type);
void ModuleItems(zmodule_item_vec_ptr modules);
void ReqPri();
void ReqSeverity();
void ReqVersion(uint32_t product_id, string_ptr type);
void VersionItems(zversion_item_vec_ptr modules);
void ReqModules(string_ptr type);
void ModulesItems(zpri_item_vec_ptr pris, zseverity_item_vec_ptr serveritys, zos_item_vec_ptr oss, zbrowser_item_vec_ptr browers, ztype_item_vec_ptr types);
void UploadImageDone(bool success, string_ptr url);
#endif
private slots:
void OnStartShot();
void OnShotDone(Starter* starer);
void OnExitShot();
void OnShowSetting();
void OnIconActivated(QSystemTrayIcon::ActivationReason reason);
#if !NZENTAO_VER_
void OnShowZenTaoSetting();
void OnShowPreview(Workspace* w);
void OnLogin(string_ptr url, string_ptr usr, string_ptr pass);
void OnSubmitLogin(string_ptr name);
void OnHttpProduct();
void OnHttpModule(uint32_t product_id, string_ptr view_type);
void OnHttpVersion(uint32_t product_id, string_ptr type);
void OnHttpModules(string_ptr type);
void OnSubmitDemandJson(uint32_t product_id, string_ptr json);
void OnSubmitBugJson(uint32_t product_id, string_ptr json);
void OnUploadImage();
void OnOpenZentaoUrl();
void OnTipZentaoHide();
void OnSubmitZentaoHide();
#endif // NZENTAO_VER_
protected:
void closeEvent(QCloseEvent*) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result);
#else
virtual bool nativeEvent(const QByteArray& eventType, void* message, long* result);
#endif
private:
void createActions();
void createTrayIcon();
#if !NZENTAO_VER_
bool IsSameUsr(const std::string& usr, const std::string& url)
{
return m_CurrentUsr == usr && m_CurrentUrl == url;
}
#endif // NZENTAO_VER_
void SetupSignal();
private:
std::list<Starter*> m_Starer;
bool m_Shotting;
QAction* settingAction;
#if !NZENTAO_VER_
QAction* zentaoSettingAction;
ZTSettingDlg m_ZTSettingDlg;
ZTSubmitDlg m_ZTSubmitDlg;
ZTTipsDlg m_ZTTipsDlg;
ZHttpRequest m_HttpReq;
std::string m_CurrentUsr;
std::string m_CurrentUrl;
std::string m_LastSubmitUrl;
std::shared_ptr<QPixmap> m_CurrentShot;
Starter* m_CurrentStarter;
#endif // NZENTAO_VER_
QAction* shotAction;
QAction* quitAction;
QSystemTrayIcon* trayIcon;
QMenu* trayIconMenu;
SettingDlg m_SettingDlg;
}; // StarterUI
extern StarterUI* g_start_ui_;