-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGuiCompactSettingsWindow.h
74 lines (62 loc) · 2.06 KB
/
GuiCompactSettingsWindow.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
#ifndef GUICOMPACTSETTINGSWINDOW_H
#define GUICOMPACTSETTINGSWINDOW_H
#include <QDialog>
#include <QFile>
#include <QLineEdit>
#include <QPushButton>
#include <QGridLayout>
#include <QListWidget>
#include <QComboBox>
#include <QIODevice>
#include <string>
#include "GuiBase.h"
#include "QtConfig.h"
#include "GuiSettingsWindow.h"
#include <QMessageBox>
#include <QPainter>
#include "QtComboBoxWithTreeView.h"
#include "QtSessionTreeModel.h"
class GuiMainWindow;
class QtCompleterWithAdvancedCompletion;
class GuiCompactSettingsWindow : public QDialog
{
Q_OBJECT
QtComboBoxWithTreeView *cb_session_list;
QComboBox *cb_connection_type;
QComboBox *cb_hostname;
GuiBase::SplitType openMode;
QtCompleterWithAdvancedCompletion *hostname_completer;
QtSessionTreeModel *session_list_model;
void setConnectionType(int conntype);
int getConnectionType();
public:
explicit GuiCompactSettingsWindow(QWidget *parent, GuiBase::SplitType openmode = GuiBase::TYPE_LEAF);
signals:
void signal_on_open(Config cfg, GuiBase::SplitType splittype);
void signal_on_close();
void signal_on_detail(Config cfg, GuiBase::SplitType splittype);
public slots:
void on_open_clicked();
void on_close_clicked();
void on_details_clicked();
void on_cb_session_list_activated(int);
void on_cb_hostname_activated(QString);
void on_hostname_completion_activated(QString str);
};
class QtHostNameCompleterItemDelegate : public QStyledItemDelegate
{
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QStringList split = index.model()->data(index).toString().split('|');
if (split.length() != 2)
return;
if (option.state & QStyle::State_Selected)
painter->fillRect(option.rect, option.palette.highlight());
QString hostname = split[0];
QString sessname = split[1];
painter->drawText(option.rect, hostname);
painter->drawText(option.rect, Qt::AlignRight, sessname);
}
};
#endif // GUICOMPACTSETTINGSWINDOW_H