Commit 5ab00d60 authored by Scott Petrovic's avatar Scott Petrovic

Determine dev build if version has git hash

parent 3ddf2b6e
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <QListWidget> #include <QListWidget>
#include <QListWidgetItem> #include <QListWidgetItem>
#include "kis_icon_utils.h" #include "kis_icon_utils.h"
#include "krita_utils.h" #include "krita_utils.h"
#include "KoStore.h" #include "KoStore.h"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
#include <kis_paint_device.h> #include <kis_paint_device.h>
#include <KisPart.h> #include <KisPart.h>
KisWelcomePageWidget::KisWelcomePageWidget(QWidget *parent) KisWelcomePageWidget::KisWelcomePageWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
...@@ -134,6 +136,13 @@ void KisWelcomePageWidget::setMainWindow(KisMainWindow* mainWin) ...@@ -134,6 +136,13 @@ void KisWelcomePageWidget::setMainWindow(KisMainWindow* mainWin)
} }
} }
bool KisWelcomePageWidget::isDevelopmentBuild()
{
// dev builds contain GIT hash in it and the word git
// stable versions do not contain this
return qApp->applicationVersion().contains("git");
}
void KisWelcomePageWidget::showDropAreaIndicator(bool show) void KisWelcomePageWidget::showDropAreaIndicator(bool show)
{ {
if (!show) { if (!show) {
...@@ -315,13 +324,25 @@ void KisWelcomePageWidget::slotUpdateVersionMessage() ...@@ -315,13 +324,25 @@ void KisWelcomePageWidget::slotUpdateVersionMessage()
// find out if we need an update...or if this is a development version // find out if we need an update...or if this is a development version
// TODO: show app version if dev version. Show version number available and provide link // TODO: show app version if dev version. Show version number available and provide link
QString versionText = ""; QString versionText = "";
if (newsWidget->isDevelopmentBuild()) { if (isDevelopmentBuild()) {
// Development build
versionText = i18n("DEV BUILD"); versionText = i18n("DEV BUILD");
versionNotificationLabel->setVisible(true); versionNotificationLabel->setVisible(true);
versionNotificationLabel->setText(versionText); // no link
} else if (newsWidget->hasUpdateAvailable()) { } else if (newsWidget->hasUpdateAvailable()) {
versionText = i18n("New Update Available"); // Version update available
versionText = QString("Krita " + newsWidget->versionNumber() + " ")
.append(i18n("Available!"));
versionNotificationLabel->setVisible(true); versionNotificationLabel->setVisible(true);
versionNotificationLabel->setText(QString("<a style=\"color: " +
blendedColor.name() +
" \" href=\" " +
newsWidget->versionLink() +
analyticsString + "version-update" + "\">")
.append(versionText).append("</a>"));
} else { } else {
// message needed... exit
versionNotificationLabel->setVisible(false); versionNotificationLabel->setVisible(false);
return; return;
} }
...@@ -330,8 +351,6 @@ void KisWelcomePageWidget::slotUpdateVersionMessage() ...@@ -330,8 +351,6 @@ void KisWelcomePageWidget::slotUpdateVersionMessage()
versionNotificationLabel->setStyleSheet(blendedStyle); versionNotificationLabel->setStyleSheet(blendedStyle);
} }
versionNotificationLabel->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://userbase.kde.org/What_is_KDE?" + analyticsString + "what-is-kde" + "\">")
.append(versionText).append("</a>"));
} }
void KisWelcomePageWidget::dragEnterEvent(QDragEnterEvent *event) void KisWelcomePageWidget::dragEnterEvent(QDragEnterEvent *event)
......
...@@ -39,6 +39,8 @@ class KRITAUI_EXPORT KisWelcomePageWidget : public QWidget, public Ui::KisWelcom ...@@ -39,6 +39,8 @@ class KRITAUI_EXPORT KisWelcomePageWidget : public QWidget, public Ui::KisWelcom
void setMainWindow(KisMainWindow* m_mainWindow); void setMainWindow(KisMainWindow* m_mainWindow);
bool isDevelopmentBuild();
public Q_SLOTS: public Q_SLOTS:
/// if a document is placed over this area, a dotted line will appear as an indicator /// if a document is placed over this area, a dotted line will appear as an indicator
/// that it is a droppable area. KisMainwindow is what triggers this /// that it is a droppable area. KisMainwindow is what triggers this
......
...@@ -97,14 +97,19 @@ void KisNewsWidget::setAnalyticsTracking(QString text) ...@@ -97,14 +97,19 @@ void KisNewsWidget::setAnalyticsTracking(QString text)
analyticsTrackingParameters = text; analyticsTrackingParameters = text;
} }
bool KisNewsWidget::isDevelopmentBuild() bool KisNewsWidget::hasUpdateAvailable()
{ {
return isDevelopmentVersion; return needsVersionUpdate;
} }
bool KisNewsWidget::hasUpdateAvailable() QString KisNewsWidget::versionNumber()
{ {
return needsVersionUpdate; return newVersionNumber;
}
QString KisNewsWidget::versionLink()
{
return newVersionLink;
} }
void KisNewsWidget::toggleNews(bool toggle) void KisNewsWidget::toggleNews(bool toggle)
...@@ -194,20 +199,12 @@ void KisNewsWidget::calculateVersionUpdateStatus() ...@@ -194,20 +199,12 @@ void KisNewsWidget::calculateVersionUpdateStatus()
needsVersionUpdate = true; // we are a major version behind needsVersionUpdate = true; // we are a major version behind
return; return;
} }
else if (onlineReleaseAnnouncement[0] < currentVersionParts[0] ) {
isDevelopmentVersion = true;
return;
}
// major versions are the same, so check minor versions // major versions are the same, so check minor versions
if (onlineReleaseAnnouncement[1] > currentVersionParts[1] ) { if (onlineReleaseAnnouncement[1] > currentVersionParts[1] ) {
needsVersionUpdate = true; // we are a minor version behind needsVersionUpdate = true; // we are a minor version behind
return; return;
} }
else if (onlineReleaseAnnouncement[1] < currentVersionParts[1] ) {
isDevelopmentVersion = true;
return;
}
// minor versions are the same, so maybe bugfix version is different // minor versions are the same, so maybe bugfix version is different
// sometimes we don't communicate this, implictly make 0 if it doesn't exist // sometimes we don't communicate this, implictly make 0 if it doesn't exist
...@@ -222,8 +219,5 @@ void KisNewsWidget::calculateVersionUpdateStatus() ...@@ -222,8 +219,5 @@ void KisNewsWidget::calculateVersionUpdateStatus()
needsVersionUpdate = true; // we are a bugfix version behind needsVersionUpdate = true; // we are a bugfix version behind
return; return;
} }
else if (onlineReleaseAnnouncement[2] < currentVersionParts[2] ) {
isDevelopmentVersion = true;
return;
}
} }
...@@ -46,8 +46,9 @@ public: ...@@ -46,8 +46,9 @@ public:
void setAnalyticsTracking(QString text); void setAnalyticsTracking(QString text);
bool isDevelopmentBuild();
bool hasUpdateAvailable(); bool hasUpdateAvailable();
QString versionNumber();
QString versionLink();
Q_SIGNALS: Q_SIGNALS:
void newsDataChanged(); void newsDataChanged();
...@@ -67,7 +68,6 @@ private: ...@@ -67,7 +68,6 @@ private:
// version checking logic tells us we need to update our Krita // version checking logic tells us we need to update our Krita
void calculateVersionUpdateStatus(); void calculateVersionUpdateStatus();
bool isDevelopmentVersion = false;
bool needsVersionUpdate = false; bool needsVersionUpdate = false;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment