From 84f6f1a8205d34661ad3fac40185e1cb23deb736 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 28 Sep 2015 19:27:55 +0300 Subject: [PATCH] * add commit SHA information * allow to open link in quotes editor * fix bug with no data updates in configuration ui --- sources/CMakeLists.txt | 8 +++++++- .../package/contents/ui/dataengine.qml | 2 +- .../awesome-widget/package/contents/ui/widget.qml | 14 +++----------- sources/awesome-widget/plugin/awactions.cpp | 9 ++++++--- sources/awesome-widget/plugin/awkeys.cpp | 2 ++ sources/awesomewidgets/extitemaggregator.h | 2 +- sources/awesomewidgets/extquotes.ui | 3 +++ sources/checkgit.cmake | 11 +++++++++++ sources/desktop-panel/plugin/dpadds.cpp | 5 +++-- sources/version.h.in | 8 ++++++++ 10 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 sources/checkgit.cmake diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index f3ecb3f..e9c2753 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -17,6 +17,9 @@ set(PROJECT_VERSION_MAJOR "2") set(PROJECT_VERSION_MINOR "4") set(PROJECT_VERSION_PATCH "0") set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +set(PROJECT_COMMIT_SHA "Commit hash" CACHE INTERNAL "") +# append git version if any +include(checkgit.cmake) string(TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC) string(TIMESTAMP CURRENT_YEAR "%Y") @@ -25,10 +28,13 @@ message(STATUS "Project: ${PROJECT_NAME}") message(STATUS "Version: ${PROJECT_VERSION}") message(STATUS "Build date: ${CURRENT_DATE}") -option(BUILD_FUTURE "Build with the features which will be marked as stable later" OFF) +# components option(BUILD_PLASMOIDS "Build plasmoids" ON) option(BUILD_DEB_PACKAGE "Build deb package" OFF) option(BUILD_RPM_PACKAGE "Build rpm package" OFF) +# build details +option(BUILD_FUTURE "Build with the features which will be marked as stable later" OFF) +option(BUILD_TEST "Build with additional test abilities" OFF) # flags if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/sources/awesome-widget/package/contents/ui/dataengine.qml b/sources/awesome-widget/package/contents/ui/dataengine.qml index 377aadf..e8b21c6 100644 --- a/sources/awesome-widget/package/contents/ui/dataengine.qml +++ b/sources/awesome-widget/package/contents/ui/dataengine.qml @@ -345,7 +345,7 @@ Item { if (debug) console.debug() // init submodule - awKeys.initKeys(plasmoid.configuration.text) + awKeys.initKeys(plasmoid.configuration.text, plasmoid.configuration.queueLimit) } Component.onDestruction: { diff --git a/sources/awesome-widget/package/contents/ui/widget.qml b/sources/awesome-widget/package/contents/ui/widget.qml index aeb680b..23b6009 100644 --- a/sources/awesome-widget/package/contents/ui/widget.qml +++ b/sources/awesome-widget/package/contents/ui/widget.qml @@ -349,11 +349,7 @@ Item { engine: "systemmonitor" connectedSources: systemmonitorDE.sources interval: 5000 - - onNewData: { - if (debug) console.debug("Update source", sourceName) - awKeys.dataUpdateReceived(sourceName, data) - } + onNewData: awKeys.dataUpdateReceived(sourceName, data) } PlasmaCore.DataSource { @@ -365,7 +361,6 @@ Item { onNewData: { // even after a disconnect it is possible that we'll receive an update if (sourceName == "update") return - if (debug) console.debug("Update source", sourceName) awKeys.dataUpdateReceived(sourceName, data) } } @@ -375,11 +370,7 @@ Item { engine: "time" connectedSources: ["Local"] interval: 5000 - - onNewData: { - if (debug) console.debug("Update source", sourceName) - awKeys.dataUpdateReceived(sourceName, data) - } + onNewData: awKeys.dataUpdateReceived(sourceName, data) } @@ -398,6 +389,7 @@ Item { awKeys.setAggregatorProperty("customUptime", plasmoid.configuration.customUptime) awKeys.setAggregatorProperty("tempUnits", plasmoid.configuration.tempUnits) awKeys.setAggregatorProperty("translate", plasmoid.configuration.translateStrings) + awKeys.unlock() } onDropSource: { diff --git a/sources/awesome-widget/plugin/awactions.cpp b/sources/awesome-widget/plugin/awactions.cpp index 1388b93..19498a5 100644 --- a/sources/awesome-widget/plugin/awactions.cpp +++ b/sources/awesome-widget/plugin/awactions.cpp @@ -118,9 +118,10 @@ QString AWActions::getAboutText(const QString type) const QString text; if (type == QString("header")) text = QString(NAME); - else if (type == QString("version")) + else if (type == QString("version")) { text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE)); - else if (type == QString("description")) + if (!QString(COMMIT_SHA).isEmpty()) text += QString(" (%1)").arg(QString(COMMIT_SHA)); + } else if (type == QString("description")) text = i18n("A set of minimalistic plasmoid widgets"); else if (type == QString("links")) text = i18n("Links:") + QString("
") + @@ -237,6 +238,7 @@ void AWActions::showInfo(const QString version) const qCDebug(LOG_AW) << "Version" << version; QString text = i18n("You are using the actual version %1", version); + if (!QString(COMMIT_SHA).isEmpty()) text += QString(" (%1)").arg(QString(COMMIT_SHA)); QMessageBox::information(nullptr, i18n("No new version found"), text); } @@ -248,7 +250,8 @@ void AWActions::showUpdates(const QString version) const qCDebug(LOG_AW) << "Version" << version; QString text; - text += i18n("Current version : %1", QString(VERSION)) + QString("\n"); + text += i18n("Current version : %1", QString(VERSION)); + text += QString(COMMIT_SHA).isEmpty() ? QString("\n") : QString(" (%1)\n").arg(QString(COMMIT_SHA)); text += i18n("New version : %1", version) + QString("\n\n"); text += i18n("Click \"Ok\" to download"); diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp index 11ced2a..089c88f 100644 --- a/sources/awesome-widget/plugin/awkeys.cpp +++ b/sources/awesome-widget/plugin/awkeys.cpp @@ -464,6 +464,7 @@ void AWKeys::reinitKeys() // init QStringList allKeys = dictKeys(); +#ifdef BUILD_TEST // not documented feature - place all available tags m_pattern = m_pattern.replace(QString("$ALL"), [allKeys]() { QStringList strings; @@ -471,6 +472,7 @@ void AWKeys::reinitKeys() strings.append(QString("%1: $%1").arg(tag)); return strings.join(QString(" | ")); }()); +#endif /* BUILD_TEST */ // append lists // bars diff --git a/sources/awesomewidgets/extitemaggregator.h b/sources/awesomewidgets/extitemaggregator.h index 3eb8f0c..70de0ad 100644 --- a/sources/awesomewidgets/extitemaggregator.h +++ b/sources/awesomewidgets/extitemaggregator.h @@ -176,7 +176,7 @@ private: } // sort items - std::sort(items.begin(), items.end(), [](const T *lhs, const T *rhs){ + std::sort(items.begin(), items.end(), [](const T *lhs, const T *rhs) { return lhs->number() < rhs->number(); }); return items; diff --git a/sources/awesomewidgets/extquotes.ui b/sources/awesomewidgets/extquotes.ui index b019371..aef15a1 100644 --- a/sources/awesomewidgets/extquotes.ui +++ b/sources/awesomewidgets/extquotes.ui @@ -92,6 +92,9 @@ true + + true + diff --git a/sources/checkgit.cmake b/sources/checkgit.cmake new file mode 100644 index 0000000..e6fc555 --- /dev/null +++ b/sources/checkgit.cmake @@ -0,0 +1,11 @@ +exec_program( + "git" + ${CMAKE_CURRENT_SOURCE_DIR} + ARGS "log" "-1" "--format=\"%h\"" + OUTPUT_VARIABLE COMMIT_SHA + RETURN_VALUE GIT_RETURN +) + +if(${GIT_RETURN} EQUAL "0") + set(PROJECT_COMMIT_SHA "${COMMIT_SHA}") +endif() diff --git a/sources/desktop-panel/plugin/dpadds.cpp b/sources/desktop-panel/plugin/dpadds.cpp index b269420..82bd782 100644 --- a/sources/desktop-panel/plugin/dpadds.cpp +++ b/sources/desktop-panel/plugin/dpadds.cpp @@ -248,9 +248,10 @@ QString DPAdds::getAboutText(const QString type) const QString text; if (type == QString("header")) text = QString(NAME); - else if (type == QString("version")) + else if (type == QString("version")) { text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE)); - else if (type == QString("description")) + if (!QString(COMMIT_SHA).isEmpty()) text += QString(" (%1)").arg(QString(COMMIT_SHA)); + } else if (type == QString("description")) text = i18n("A set of minimalistic plasmoid widgets"); else if (type == QString("links")) text = i18n("Links:") + QString("
") + diff --git a/sources/version.h.in b/sources/version.h.in index 6d94491..551c2a3 100644 --- a/sources/version.h.in +++ b/sources/version.h.in @@ -4,6 +4,7 @@ // information #define NAME "Awesome Widgets" #define VERSION "@PROJECT_VERSION@" +#define COMMIT_SHA "@PROJECT_COMMIT_SHA@" #define AUTHOR "@PROJECT_AUTHOR@" #define TRANSLATORS "Ernesto Aviles Vzqz (Spanish), Mermouy (French), underr (Brazillian Portuguese), Viktor Slobodyan (Ukrainian), Lemueler (Chinese), Heimen Stoffels (Dutch)" #define EMAIL "@PROJECT_CONTACT@" @@ -24,6 +25,7 @@ // available time keys #define TIME_KEYS "dddd,ddd,dd,d,MMMM,MMM,MM,M,yyyy,yy,hh,h,HH,H,mm,m,ss,s,t,ap,a,AP,A" #cmakedefine BUILD_FUTURE +#cmakedefine BUILD_TEST // links #define HOMEPAGE "https://arcanis.name/projects/awesome-widgets/" @@ -42,6 +44,12 @@ // cmake properties #define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" #define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" +// components #define BUILD_PLASMOIDS "@BUILD_PLASMOIDS@" +#define BUILD_DEB_PACKAGE "@BUILD_DEB_PACKAGE@" +#define BUILD_RPM_PACKAGE "@BUILD_RPM_PACKAGE@" +// additional functions +#define PROP_FUTURE "@BUILD_FUTURE@" +#define PROP_TEST "@BUILD_TEST@" #endif /* VERSION_H */