From b26ecdd55561104bc1c0c3348f4363e23e2ed254 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Tue, 24 Jan 2023 14:45:28 -0800 Subject: [PATCH 1/5] add create Icon when there is no cluster running --- src/basicview.cpp | 20 ++++++++++++++------ src/cluster.h | 2 +- src/constants.h | 1 + src/fonts.cpp | 12 +++++++++--- src/fonts.h | 2 +- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/basicview.cpp b/src/basicview.cpp index 4c870d7..ed14e9a 100644 --- a/src/basicview.cpp +++ b/src/basicview.cpp @@ -29,7 +29,7 @@ BasicView::BasicView() { basicView = new QWidget(); - topStatus = new QLabel("nil"); + topStatus = new QLabel("Loading ..."); QVBoxLayout *topBar = new QVBoxLayout; topStatus->setAlignment(Qt::AlignCenter); @@ -99,8 +99,12 @@ static QString getPauseLabel(bool isPaused) return Constants::pauseIcon; } -static QString getStartLabel(bool isRunning, bool isPaused) +static QString getStartLabel(bool exists, bool isRunning, bool isPaused) { + if (!exists) { + return Constants::createIcon; + } + if (isRunning || isPaused) { return Constants::reloadIcon; } @@ -115,12 +119,16 @@ static QString getPauseToolTip(bool isPaused) return "Pause Kubernetes cluster"; } -static QString getStartToolTip(bool isRunning, bool isPaused) +static QString getStartToolTip(bool exists,bool isRunning, bool isPaused) { + if (!exists) { + return "Create a new cluster"; + } + if (isRunning || isPaused) { return "Restart (reconfigure) an already running cluster"; } - return "Start the default cluster"; + return "Start the cluster"; } void BasicView::update(Cluster cluster) @@ -145,8 +153,8 @@ void BasicView::update(Cluster cluster) #endif pauseButton->setText(getPauseLabel(isPaused)); pauseButton->setToolTip(getPauseToolTip(isPaused)); - startButton->setText(getStartLabel(isRunning, isPaused)); - startButton->setToolTip(getStartToolTip(isRunning, isPaused)); + startButton->setText(getStartLabel(exists,isRunning, isPaused)); + startButton->setToolTip(getStartToolTip(exists,isRunning, isPaused)); } void BasicView::disableButtons() diff --git a/src/cluster.h b/src/cluster.h index 6ac2521..73e1a17 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -28,7 +28,7 @@ class Cluster Cluster() : Cluster("") { } Cluster(const QString &name) : m_name(name), - m_status(""), + m_status("No Cluster Exists"), m_driver(""), m_container_runtime(""), m_k8s_version(""), diff --git a/src/constants.h b/src/constants.h index 4eacc11..d9a1246 100644 --- a/src/constants.h +++ b/src/constants.h @@ -30,6 +30,7 @@ class Constants inline static const QString unPauseIcon = "\uf04b"; inline static const QString deleteIcon = "\uf1f8"; inline static const QString reloadIcon = "\uf021"; + inline static const QString createIcon = "\uf0fe"; }; #endif // CONSTANTS_H diff --git a/src/fonts.cpp b/src/fonts.cpp index 1a99ca5..2197ca7 100644 --- a/src/fonts.cpp +++ b/src/fonts.cpp @@ -19,13 +19,14 @@ limitations under the License. #include #include #include +#include QFont Fonts::fontAwesome; void Fonts::initFonts() { loadFontAwesome(); - setToolTipFont(); + setToolTipStyle(); } void Fonts::loadFontAwesome() @@ -36,11 +37,16 @@ void Fonts::loadFontAwesome() fontAwesome.setPixelSize(20); } -void Fonts::setToolTipFont() +void Fonts::setToolTipStyle() { QFont tooltipFont = QToolTip::font(); - tooltipFont.setPointSize(20); + tooltipFont.setPointSize(18); QToolTip::setFont(tooltipFont); + QPalette palette; + palette.setColor(QPalette::ToolTipText, Qt::black); + palette.setColor(QPalette::ToolTipBase, Qt::lightGray); + QToolTip::setPalette(palette); + } void Fonts::setFontAwesome(QWidget *wid) diff --git a/src/fonts.h b/src/fonts.h index efc30be..fd5812f 100644 --- a/src/fonts.h +++ b/src/fonts.h @@ -28,7 +28,7 @@ class Fonts private: static void loadFontAwesome(); - static void setToolTipFont(); + static void setToolTipStyle(); static QFont fontAwesome; }; From d19f4320907ceb5733a35ae90c04014134a371cf Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Tue, 24 Jan 2023 16:33:43 -0800 Subject: [PATCH 2/5] Update src/basicview.cpp Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com> --- src/basicview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basicview.cpp b/src/basicview.cpp index ed14e9a..e04fb6f 100644 --- a/src/basicview.cpp +++ b/src/basicview.cpp @@ -153,7 +153,7 @@ void BasicView::update(Cluster cluster) #endif pauseButton->setText(getPauseLabel(isPaused)); pauseButton->setToolTip(getPauseToolTip(isPaused)); - startButton->setText(getStartLabel(exists,isRunning, isPaused)); + startButton->setText(getStartLabel(exists, isRunning, isPaused)); startButton->setToolTip(getStartToolTip(exists,isRunning, isPaused)); } From f73c4d12eefc6ab446c0a4c90d8c123b0e390cc3 Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Tue, 24 Jan 2023 16:33:55 -0800 Subject: [PATCH 3/5] Update src/basicview.cpp Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com> --- src/basicview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basicview.cpp b/src/basicview.cpp index e04fb6f..e1a7c89 100644 --- a/src/basicview.cpp +++ b/src/basicview.cpp @@ -119,7 +119,7 @@ static QString getPauseToolTip(bool isPaused) return "Pause Kubernetes cluster"; } -static QString getStartToolTip(bool exists,bool isRunning, bool isPaused) +static QString getStartToolTip(bool exists, bool isRunning, bool isPaused) { if (!exists) { return "Create a new cluster"; From 4276dc0435904f64da3e06dc0f2b6b0e0ccc2681 Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Tue, 24 Jan 2023 16:34:08 -0800 Subject: [PATCH 4/5] Update src/basicview.cpp Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com> --- src/basicview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basicview.cpp b/src/basicview.cpp index e1a7c89..84c01d8 100644 --- a/src/basicview.cpp +++ b/src/basicview.cpp @@ -154,7 +154,7 @@ void BasicView::update(Cluster cluster) pauseButton->setText(getPauseLabel(isPaused)); pauseButton->setToolTip(getPauseToolTip(isPaused)); startButton->setText(getStartLabel(exists, isRunning, isPaused)); - startButton->setToolTip(getStartToolTip(exists,isRunning, isPaused)); + startButton->setToolTip(getStartToolTip(exists, isRunning, isPaused)); } void BasicView::disableButtons() From 841b5e461a3562f36bf67277d02c54043f86f64f Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Tue, 24 Jan 2023 16:34:15 -0800 Subject: [PATCH 5/5] Update src/cluster.h Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com> --- src/cluster.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cluster.h b/src/cluster.h index 73e1a17..d24f7c1 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -28,7 +28,7 @@ class Cluster Cluster() : Cluster("") { } Cluster(const QString &name) : m_name(name), - m_status("No Cluster Exists"), + m_status("No Existing Cluster"), m_driver(""), m_container_runtime(""), m_k8s_version(""),