aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2015-11-21 14:35:42 +0100
committerMax Christian Pohle2015-11-21 14:35:42 +0100
commitce38d5155853e9c091b4104c17e3b674a58cc0d7 (patch)
treed5c074c53aba6fd74759c8ec67cc4bc4a123e3be
parentbca14f8fdb25a5e230e083896f969aa431cf43f5 (diff)
downloadqspacestatus-ce38d5155853e9c091b4104c17e3b674a58cc0d7.tar.bz2
qspacestatus-ce38d5155853e9c091b4104c17e3b674a58cc0d7.zip
improved gui
made items resizable and added a refresh button for the list of hackerspaces
-rwxr-xr-xbuild/linux/qspacestatusbin72448 -> 77200 bytes
-rw-r--r--mainwindow.cpp10
-rw-r--r--mainwindow.h3
-rw-r--r--mainwindow.ui154
4 files changed, 117 insertions, 50 deletions
diff --git a/build/linux/qspacestatus b/build/linux/qspacestatus
index ddc4755..6598427 100755
--- a/build/linux/qspacestatus
+++ b/build/linux/qspacestatus
Binary files differ
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 2590d4f..55a9769 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -8,7 +8,6 @@ MainWindow::MainWindow(QWidget *parent) :
8{ 8{
9 ui->setupUi(this); 9 ui->setupUi(this);
10 ui->menuBar->setVisible(false); 10 ui->menuBar->setVisible(false);
11
12 qDebug() << "Using: " << this->qsettings.fileName(); 11 qDebug() << "Using: " << this->qsettings.fileName();
13 12
14 this->qsystemtrayicon = new QSystemTrayIcon(this->windowIcon(), 0); 13 this->qsystemtrayicon = new QSystemTrayIcon(this->windowIcon(), 0);
@@ -17,7 +16,7 @@ MainWindow::MainWindow(QWidget *parent) :
17 this->qsystemtrayicon->setToolTip(this->windowTitle()); 16 this->qsystemtrayicon->setToolTip(this->windowTitle());
18 this->connect(this->qsystemtrayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason))); 17 this->connect(this->qsystemtrayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason)));
19 this->updateStatus(); 18 this->updateStatus();
20 this->updateSpaceList(this->qsettings.value("hackerspace").toString()); 19 this->updateSpaceList();
21 20
22 21
23 22
@@ -33,8 +32,11 @@ MainWindow::~MainWindow()
33 delete ui; 32 delete ui;
34} 33}
35 34
36void MainWindow::updateSpaceList(QString defaultSpace) 35void MainWindow::updateSpaceList()
37{ 36{
37 qDebug() << "updateSpaceList()";
38 QString defaultSpace = this->qsettings.value("hackerspace").toString();
39
38 QUrl url("http://spaceapi.net/directory.json"); 40 QUrl url("http://spaceapi.net/directory.json");
39 QJsonObject json = QJsonDocument::fromJson(this->download(url)).object(); 41 QJsonObject json = QJsonDocument::fromJson(this->download(url)).object();
40 42
@@ -171,3 +173,5 @@ void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1)
171 this->updateStatus(); 173 this->updateStatus();
172 this->saveSettings(); 174 this->saveSettings();
173} 175}
176
177
diff --git a/mainwindow.h b/mainwindow.h
index 9656734..0ff1884 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -31,7 +31,6 @@ class MainWindow : public QMainWindow
31public: 31public:
32 explicit MainWindow(QWidget *parent = 0); 32 explicit MainWindow(QWidget *parent = 0);
33 ~MainWindow(); 33 ~MainWindow();
34 void updateSpaceList(QString defaultSpace);
35 34
36private: 35private:
37 Ui::MainWindow *ui; 36 Ui::MainWindow *ui;
@@ -47,8 +46,8 @@ private slots:
47 void slotActivated(QSystemTrayIcon::ActivationReason); 46 void slotActivated(QSystemTrayIcon::ActivationReason);
48 void on_comboBox_currentIndexChanged(const QString &arg1); 47 void on_comboBox_currentIndexChanged(const QString &arg1);
49 void updateStatus(); 48 void updateStatus();
49 void updateSpaceList();
50 void exitApplication(); 50 void exitApplication();
51
52}; 51};
53 52
54#endif // MAINWINDOW_H 53#endif // MAINWINDOW_H
diff --git a/mainwindow.ui b/mainwindow.ui
index 27a41ad..4bd49e4 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,8 +6,8 @@
6 <rect> 6 <rect>
7 <x>0</x> 7 <x>0</x>
8 <y>0</y> 8 <y>0</y>
9 <width>670</width> 9 <width>952</width>
10 <height>442</height> 10 <height>497</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="sizePolicy"> 13 <property name="sizePolicy">
@@ -18,8 +18,8 @@
18 </property> 18 </property>
19 <property name="maximumSize"> 19 <property name="maximumSize">
20 <size> 20 <size>
21 <width>670</width> 21 <width>5535334</width>
22 <height>442</height> 22 <height>16777215</height>
23 </size> 23 </size>
24 </property> 24 </property>
25 <property name="windowTitle"> 25 <property name="windowTitle">
@@ -32,44 +32,97 @@
32 <widget class="QWidget" name="centralWidget"> 32 <widget class="QWidget" name="centralWidget">
33 <layout class="QVBoxLayout" name="verticalLayout"> 33 <layout class="QVBoxLayout" name="verticalLayout">
34 <item> 34 <item>
35 <widget class="QComboBox" name="comboBox"> 35 <layout class="QGridLayout" name="gridLayout">
36 <property name="insertPolicy"> 36 <item row="0" column="0">
37 <enum>QComboBox::InsertAlphabetically</enum> 37 <widget class="QComboBox" name="comboBox">
38 </property> 38 <property name="sizePolicy">
39 <property name="sizeAdjustPolicy"> 39 <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
40 <enum>QComboBox::AdjustToMinimumContentsLength</enum> 40 <horstretch>0</horstretch>
41 </property> 41 <verstretch>0</verstretch>
42 </widget> 42 </sizepolicy>
43 </property>
44 <property name="insertPolicy">
45 <enum>QComboBox::InsertAlphabetically</enum>
46 </property>
47 <property name="sizeAdjustPolicy">
48 <enum>QComboBox::AdjustToMinimumContentsLength</enum>
49 </property>
50 </widget>
51 </item>
52 <item row="0" column="1">
53 <widget class="QPushButton" name="button_refresh">
54 <property name="sizePolicy">
55 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
56 <horstretch>0</horstretch>
57 <verstretch>0</verstretch>
58 </sizepolicy>
59 </property>
60 <property name="minimumSize">
61 <size>
62 <width>0</width>
63 <height>31</height>
64 </size>
65 </property>
66 <property name="maximumSize">
67 <size>
68 <width>16777215</width>
69 <height>16777215</height>
70 </size>
71 </property>
72 <property name="baseSize">
73 <size>
74 <width>0</width>
75 <height>0</height>
76 </size>
77 </property>
78 <property name="text">
79 <string>refresh</string>
80 </property>
81 <property name="icon">
82 <iconset theme="view-refresh"/>
83 </property>
84 <property name="flat">
85 <bool>false</bool>
86 </property>
87 </widget>
88 </item>
89 <item row="1" column="0">
90 <widget class="QLabel" name="label_url_json">
91 <property name="text">
92 <string>TextLabel</string>
93 </property>
94 </widget>
95 </item>
96 </layout>
43 </item> 97 </item>
44 <item> 98 <item>
45 <widget class="QLabel" name="label_url_json"> 99 <widget class="Line" name="line">
46 <property name="text"> 100 <property name="orientation">
47 <string>TextLabel</string> 101 <enum>Qt::Horizontal</enum>
48 </property> 102 </property>
49 </widget> 103 </widget>
50 </item> 104 </item>
51 <item> 105 <item>
52 <widget class="QScrollArea" name="scrollArea"> 106 <layout class="QHBoxLayout" name="horizontalLayout">
53 <property name="widgetResizable"> 107 <property name="leftMargin">
54 <bool>true</bool> 108 <number>25</number>
109 </property>
110 <property name="topMargin">
111 <number>25</number>
112 </property>
113 <property name="rightMargin">
114 <number>25</number>
115 </property>
116 <property name="bottomMargin">
117 <number>25</number>
55 </property> 118 </property>
56 <widget class="QWidget" name="scrollAreaWidgetContents"> 119 <item>
57 <property name="geometry">
58 <rect>
59 <x>0</x>
60 <y>0</y>
61 <width>648</width>
62 <height>305</height>
63 </rect>
64 </property>
65 <widget class="QLabel" name="label_icon"> 120 <widget class="QLabel" name="label_icon">
66 <property name="geometry"> 121 <property name="minimumSize">
67 <rect> 122 <size>
68 <x>10</x> 123 <width>140</width>
69 <y>10</y>
70 <width>120</width>
71 <height>120</height> 124 <height>120</height>
72 </rect> 125 </size>
73 </property> 126 </property>
74 <property name="text"> 127 <property name="text">
75 <string>TextLabel</string> 128 <string>TextLabel</string>
@@ -78,15 +131,9 @@
78 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> 131 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
79 </property> 132 </property>
80 </widget> 133 </widget>
134 </item>
135 <item>
81 <widget class="QPlainTextEdit" name="plainTextEdit"> 136 <widget class="QPlainTextEdit" name="plainTextEdit">
82 <property name="geometry">
83 <rect>
84 <x>140</x>
85 <y>10</y>
86 <width>501</width>
87 <height>311</height>
88 </rect>
89 </property>
90 <property name="acceptDrops"> 137 <property name="acceptDrops">
91 <bool>false</bool> 138 <bool>false</bool>
92 </property> 139 </property>
@@ -94,8 +141,8 @@
94 <bool>true</bool> 141 <bool>true</bool>
95 </property> 142 </property>
96 </widget> 143 </widget>
97 </widget> 144 </item>
98 </widget> 145 </layout>
99 </item> 146 </item>
100 </layout> 147 </layout>
101 </widget> 148 </widget>
@@ -107,7 +154,7 @@
107 <rect> 154 <rect>
108 <x>0</x> 155 <x>0</x>
109 <y>0</y> 156 <y>0</y>
110 <width>670</width> 157 <width>952</width>
111 <height>29</height> 158 <height>29</height>
112 </rect> 159 </rect>
113 </property> 160 </property>
@@ -167,7 +214,7 @@
167 <sender>actionUpdate_Status</sender> 214 <sender>actionUpdate_Status</sender>
168 <signal>triggered()</signal> 215 <signal>triggered()</signal>
169 <receiver>MainWindow</receiver> 216 <receiver>MainWindow</receiver>
170 <slot>updateStatus()</slot> 217 <slot>updateSpaceList()</slot>
171 <hints> 218 <hints>
172 <hint type="sourcelabel"> 219 <hint type="sourcelabel">
173 <x>-1</x> 220 <x>-1</x>
@@ -179,9 +226,26 @@
179 </hint> 226 </hint>
180 </hints> 227 </hints>
181 </connection> 228 </connection>
229 <connection>
230 <sender>button_refresh</sender>
231 <signal>clicked()</signal>
232 <receiver>MainWindow</receiver>
233 <slot>updateSpaceList()</slot>
234 <hints>
235 <hint type="sourcelabel">
236 <x>635</x>
237 <y>54</y>
238 </hint>
239 <hint type="destinationlabel">
240 <x>334</x>
241 <y>220</y>
242 </hint>
243 </hints>
244 </connection>
182 </connections> 245 </connections>
183 <slots> 246 <slots>
184 <slot>exitApplication()</slot> 247 <slot>exitApplication()</slot>
185 <slot>updateStatus()</slot> 248 <slot>updateStatus()</slot>
249 <slot>updateSpaceList()</slot>
186 </slots> 250 </slots>
187</ui> 251</ui>
..