Skip to content

Commit

Permalink
Merge pull request #13 from kubernetes-sigs/status_button
Browse files Browse the repository at this point in the history
add a status bar at the top
  • Loading branch information
medyagh committed Jan 24, 2023
2 parents 6e9db6b + 529d4a4 commit c538a2f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/basicview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ limitations under the License.
#include <QFontDatabase>
#include <QToolTip>
#include <QVBoxLayout>
#include <QLabel>

BasicView::BasicView()
{
basicView = new QWidget();

topStatus = new QLabel("nil");
QVBoxLayout *topBar = new QVBoxLayout;
topStatus->setAlignment(Qt::AlignCenter);

topBar->addWidget(topStatus);

startButton = new QPushButton(Constants::startIcon);
stopButton = new QPushButton(Constants::stopIcon);
pauseButton = new QPushButton(Constants::pauseIcon);
Expand Down Expand Up @@ -65,6 +73,7 @@ BasicView::BasicView()
buttonLayoutRow2->addWidget(advancedButton);

QVBoxLayout *BasicLayout = new QVBoxLayout;
BasicLayout->addLayout(topBar);
BasicLayout->addLayout(buttonLayoutRow1);
BasicLayout->addLayout(buttonLayoutRow2);
basicView->setLayout(BasicLayout);
Expand Down Expand Up @@ -122,6 +131,7 @@ void BasicView::update(Cluster cluster)
bool exists = !cluster.isEmpty();
bool isRunning = cluster.status() == "Running";
bool isPaused = cluster.status() == "Paused";
topStatus->setText(cluster.status());
stopButton->setEnabled(isRunning || isPaused);
pauseButton->setEnabled(isRunning || isPaused);
deleteButton->setEnabled(exists);
Expand Down
2 changes: 2 additions & 0 deletions src/basicview.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ limitations under the License.

#include <QObject>
#include <QPushButton>
#include <QLabel>

class BasicView : public QObject
{
Expand All @@ -44,6 +45,7 @@ class BasicView : public QObject
void advanced();

private:
QLabel *topStatus;
QPushButton *startButton;
QPushButton *stopButton;
QPushButton *pauseButton;
Expand Down

0 comments on commit c538a2f

Please sign in to comment.