diff --git a/CMakeLists.txt b/CMakeLists.txt index 317ec82dc..b464f8544 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ file (STRINGS "${qucs-suite_SOURCE_DIR}/VERSION" QUCS_VERSION) message(STATUS "Configuring Qucs: VERSION ${QUCS_VERSION}") set(GIT unknown) -if(EXISTS ${CMAKE_SOURCE_DIR}/../.git ) +if(EXISTS ${CMAKE_SOURCE_DIR}/.git ) find_package(Git) # Get the latest abbreviated commit hash of the working branch execute_process( diff --git a/VERSION b/VERSION index 7ec1d6db4..7c974b0f4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0 +24.1.0 diff --git a/qucs/CMakeLists.txt b/qucs/CMakeLists.txt index b5348a806..7c167df99 100755 --- a/qucs/CMakeLists.txt +++ b/qucs/CMakeLists.txt @@ -27,19 +27,19 @@ set(PROJECT_DOMAIN_FIRST "qucs") set(PROJECT_DOMAIN_SECOND "org") # If Git hash not defined, try to define it -IF(NOT GIT) - IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.git ) - FIND_PACKAGE(Git) - # Get the latest abbreviated commit hash of the working branch - execute_process( - COMMAND ${GIT_EXECUTABLE} log --pretty=format:%h -n 1u - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_HASH - ) - set(GIT ${GIT_COMMIT_HASH}) - message(STATUS "Found Git repository, last commit hash: ${GIT}") - ENDIF() -ENDIF() +#IF(NOT GIT) +# IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.git ) +# FIND_PACKAGE(Git) +# # Get the latest abbreviated commit hash of the working branch +# execute_process( +# COMMAND ${GIT_EXECUTABLE} log --pretty=format:%h -n 1u +# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} +# OUTPUT_VARIABLE GIT_COMMIT_HASH +# ) +# set(GIT ${GIT_COMMIT_HASH}) +# message(STATUS "Found Git repository, last commit hash: ${GIT}") +# ENDIF() +#ENDIF() if(UNIX AND NOT APPLE) #string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE) diff --git a/qucs/main.cpp b/qucs/main.cpp index f1a579533..7281b9f66 100644 --- a/qucs/main.cpp +++ b/qucs/main.cpp @@ -1016,7 +1016,7 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { #ifdef GIT - fprintf(stdout, "Qucs " PACKAGE_VERSION " (" GIT ")" "\n"); + fprintf(stdout, "qucs s" PACKAGE_VERSION " (" GIT ")" "\n"); #else fprintf(stdout, "Qucs " PACKAGE_VERSION "\n"); #endif diff --git a/qucs/misc.cpp b/qucs/misc.cpp index 7dbd66585..d51bda733 100644 --- a/qucs/misc.cpp +++ b/qucs/misc.cpp @@ -37,6 +37,23 @@ #include +QString misc::getWindowTitle() +{ + QString title = QUCS_NAME " " PACKAGE_VERSION; + if (title.endsWith(".0")) { + title.chop(2); + } +#if defined(GIT) + QString hash = GIT; + if (hash != "unknown") { + title = title + "-" + hash; + } +#endif + + return title; +} + + bool misc::isDarkTheme() { QLabel *lbl = new QLabel("check dark"); diff --git a/qucs/misc.h b/qucs/misc.h index c5047c39a..9ecb8e33f 100644 --- a/qucs/misc.h +++ b/qucs/misc.h @@ -93,6 +93,7 @@ namespace misc { QStringList parseCmdArgs(const QString &program); QString getIconPath(const QString &file, int icon_type); bool isDarkTheme(); + QString getWindowTitle(); QString wildcardToRegularExpression(const QString &wc_str, const bool enableEscaping); bool simulatorExists(const QString &exe_file); diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index a0525b119..f4a0bf298 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -101,7 +101,8 @@ QucsApp::QucsApp() QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); #endif - setWindowTitle(QUCS_NAME " " PACKAGE_VERSION); + windowTitle = misc::getWindowTitle(); + setWindowTitle(windowTitle); QucsSettings.hasDarkTheme = misc::isDarkTheme(); @@ -1422,7 +1423,7 @@ void QucsApp::openProject(const QString& Path) QDir parentDir = QucsSettings.QucsWorkDir; parentDir.cdUp(); // show name in title of main window - setWindowTitle(QUCS_NAME " " PACKAGE_VERSION " - " + tr("Project: ") + ProjName + " (" + parentDir.absolutePath() + ")"); + setWindowTitle( tr("Project: ") + ProjName + " (" + parentDir.absolutePath() + ") - " + windowTitle); } // ---------------------------------------------------------- @@ -1482,7 +1483,7 @@ void QucsApp::slotMenuProjClose() view->drawn = false; slotResetWarnings(); - setWindowTitle(QUCS_NAME " " PACKAGE_VERSION " - " + tr("No project")); + setWindowTitle(windowTitle); QucsSettings.QucsWorkDir.setPath(QDir::homePath()+QDir::toNativeSeparators ("/.qucs")); octave->adjustDirectory(); @@ -2003,6 +2004,19 @@ void QucsApp::slotChangeView() } Doc->becomeCurrent(true); + +// TODO proper window title +// QFileInfo Info (Doc-> DocName); +// +// if (!ProjName.isEmpty()) { +// QDir parentDir = QucsSettings.QucsWorkDir; +// parentDir.cdUp(); +// setWindowTitle(tr("Project: ") + ProjName + " (" + parentDir.absolutePath() + ") " +// + windowTitle); +// } else { +// setWindowTitle(Info.fileName() + " (" + Info.filePath() +") - " + windowTitle); +// } + view->drawn = false; HierarchyHistory.clear(); diff --git a/qucs/qucs.h b/qucs/qucs.h index 6918964c7..3a34eb5af 100644 --- a/qucs/qucs.h +++ b/qucs/qucs.h @@ -228,6 +228,7 @@ private slots: QAction *activeAction; // pointer to the action selected by the user bool TuningMode; + QString windowTitle; private: // ********* Widgets on the main area **********************************