forked from simulationcraft/simc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsc_importWidget.hpp
83 lines (64 loc) · 2.25 KB
/
sc_importWidget.hpp
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
// ==========================================================================
// Dedmonwakeen's Raid DPS/TPS Simulator.
// Send questions to [email protected]
// ==========================================================================
#ifndef SC_IMPORTWIDGET_HPP
#define SC_IMPORTWIDGET_HPP
#include <QtWidgets/QtWidgets>
#include <QStandardItemModel>
#include <QMap>
#include <QVector>
#include <QFile>
#include <QRegExpValidator>
#include <QDebug>
#include <QSettings>
class BattleNetImportWidget : public QWidget
{
Q_OBJECT
typedef QMap<QString, QStandardItemModel*> RealmDataModel;
// Simple horizontal layout for the widget
QHBoxLayout* m_layout;
// Components
QLabel* m_regionLabel;
QComboBox* m_regionCombo;
QLabel* m_realmLabel;
QComboBox* m_realmCombo;
QLabel* m_characterLabel;
QLineEdit* m_character;
QLabel* m_specializationLabel;
QComboBox* m_specializationCombo;
QPushButton* m_importButton;
// Data
RealmDataModel m_realmModels;
QSettings m_settings;
public:
BattleNetImportWidget( QWidget* parent = nullptr );
QLineEdit* characterWidget() const
{ return m_character; }
// Accessors that sanitize the input to a form simc understands
QString region() const
{ return m_regionCombo -> currentText().toLower(); }
QString realm() const
{ return m_realmCombo -> currentData( Qt::UserRole ).toString(); }
QString character() const
{ return m_character -> displayText(); }
QString specialization() const
{ return m_specializationCombo -> currentData( Qt::DisplayRole ).toString().toLower(); }
bool validateInput() const;
signals:
void importTriggeredOut( const QString&, const QString&, const QString&, const QString& );
void armoryRegionChangedOut( const QString& );
public slots:
void armoryRegionChangedIn( const QString& );
private slots:
void returnPressed();
void buttonClicked();
void realmIndexChanged( int );
private:
void parseRealmListFile( QFile& file );
void loadRealmData();
void populateSpecialization();
void populateRegion();
void selectRegion( const QString& );
};
#endif /* SC_IMPORTWIDGET_HPP */