From ce38d5155853e9c091b4104c17e3b674a58cc0d7 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sat, 21 Nov 2015 14:35:42 +0100 Subject: improved gui made items resizable and added a refresh button for the list of hackerspaces --- build/linux/qspacestatus | Bin 72448 -> 77200 bytes mainwindow.cpp | 10 ++- mainwindow.h | 3 +- mainwindow.ui | 154 +++++++++++++++++++++++++++++++++-------------- 4 files changed, 117 insertions(+), 50 deletions(-) diff --git a/build/linux/qspacestatus b/build/linux/qspacestatus index ddc4755..6598427 100755 Binary files a/build/linux/qspacestatus and b/build/linux/qspacestatus 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) : { ui->setupUi(this); ui->menuBar->setVisible(false); - qDebug() << "Using: " << this->qsettings.fileName(); this->qsystemtrayicon = new QSystemTrayIcon(this->windowIcon(), 0); @@ -17,7 +16,7 @@ MainWindow::MainWindow(QWidget *parent) : this->qsystemtrayicon->setToolTip(this->windowTitle()); this->connect(this->qsystemtrayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason))); this->updateStatus(); - this->updateSpaceList(this->qsettings.value("hackerspace").toString()); + this->updateSpaceList(); @@ -33,8 +32,11 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::updateSpaceList(QString defaultSpace) +void MainWindow::updateSpaceList() { + qDebug() << "updateSpaceList()"; + QString defaultSpace = this->qsettings.value("hackerspace").toString(); + QUrl url("http://spaceapi.net/directory.json"); QJsonObject json = QJsonDocument::fromJson(this->download(url)).object(); @@ -171,3 +173,5 @@ void MainWindow::on_comboBox_currentIndexChanged(const QString &arg1) this->updateStatus(); this->saveSettings(); } + + 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 public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); - void updateSpaceList(QString defaultSpace); private: Ui::MainWindow *ui; @@ -47,8 +46,8 @@ private slots: void slotActivated(QSystemTrayIcon::ActivationReason); void on_comboBox_currentIndexChanged(const QString &arg1); void updateStatus(); + void updateSpaceList(); void exitApplication(); - }; #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 @@ 0 0 - 670 - 442 + 952 + 497 @@ -18,8 +18,8 @@ - 670 - 442 + 5535334 + 16777215 @@ -32,44 +32,97 @@ - - - QComboBox::InsertAlphabetically - - - QComboBox::AdjustToMinimumContentsLength - - + + + + + + 0 + 0 + + + + QComboBox::InsertAlphabetically + + + QComboBox::AdjustToMinimumContentsLength + + + + + + + + 0 + 0 + + + + + 0 + 31 + + + + + 16777215 + 16777215 + + + + + 0 + 0 + + + + refresh + + + + + + false + + + + + + + TextLabel + + + + - - - TextLabel + + + Qt::Horizontal - - - true + + + 25 + + + 25 + + + 25 + + + 25 - - - - 0 - 0 - 648 - 305 - - + - - - 10 - 10 - 120 + + + 140 120 - + TextLabel @@ -78,15 +131,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + - - - 140 - 10 - 501 - 311 - - false @@ -94,8 +141,8 @@ true - - + + @@ -107,7 +154,7 @@ 0 0 - 670 + 952 29 @@ -167,7 +214,7 @@ actionUpdate_Status triggered() MainWindow - updateStatus() + updateSpaceList() -1 @@ -179,9 +226,26 @@ + + button_refresh + clicked() + MainWindow + updateSpaceList() + + + 635 + 54 + + + 334 + 220 + + + exitApplication() updateStatus() + updateSpaceList() -- cgit v1.2.3