diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml new file mode 100644 index 0000000..8682e3c --- /dev/null +++ b/.github/workflows/linux.yaml @@ -0,0 +1,41 @@ +# Build lumberjack application and plugins + +name: Build + +on: + push: + branches: + - master + release: + types: + - created + +jobs: + linux: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + submodules: 'recursive' + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: '6.8.1' + cache: true + - name: Build Qwt + run: | + cd qwt + qmake qwt.pro + make + sudo make install + - name: Build Lumberjack + run: | + qmake lumberjack.pro + make + - name: Build Plugins + run: | + cd plugins + qmake plugins.pro + make diff --git a/.github/workflows/linux.yaml.todo b/.github/workflows/linux.yaml.todo deleted file mode 100644 index 9499c41..0000000 --- a/.github/workflows/linux.yaml.todo +++ /dev/null @@ -1,50 +0,0 @@ -# Run unit tests - -name: Linux - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install Qt - uses: jurplel/install-qt-action@v2 - with: - version: 5.13.2 - - name: Build qwt - run: | - cd qwt - qmake qwt.pro - make - - name: Run Unit Tests - run: | - ls qwt/lib - cd unit_test - qmake unit_test.pro CONFIG+=release - make - cp ../qwt/src/lib/* . - ls - ./unit_test - - name: Generate Code Coverage Data - run: | - sudo apt-get install lcov - lcov --coverage --directory unit_test --output-file coverage.info - lcov -r coverage.info "moc_*" - - name: Upload Code Coverage Data - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: "coverage.info" diff --git a/.github/workflows/build.yaml b/.github/workflows/windows.yaml similarity index 54% rename from .github/workflows/build.yaml rename to .github/workflows/windows.yaml index ee95b1d..fca0938 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/windows.yaml @@ -1,6 +1,6 @@ -# Build lumberjack application and plugins +# Compile windows installer -name: Build +name: Windows Installer on: push: @@ -9,38 +9,8 @@ on: release: types: - created - jobs: - linux: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: '6.8.1' - cache: true - - name: Build Qwt - run: | - cd qwt - qmake qwt.pro - make - sudo make install - - name: Build Lumberjack - run: | - qmake lumberjack.pro - make - - name: Build Plugins - run: | - cd plugins - qmake plugins.pro - make - - windows: + installer: runs-on: windows-latest steps: @@ -67,10 +37,14 @@ jobs: mingw32-make install - name: Build Lumberjack run: | - qmake lumberjack.pro + qmake lumberjack.pro CONFIG+=release mingw32-make - name: Build Plugins run: | cd plugins - qmake plugins.pro + qmake plugins.pro CONFIG+=release mingw32-make + - name: Build Installer + uses: Minionguyjpro/Inno-Setup-Action@v1.2.2 + with: + path: lumberjack.iss \ No newline at end of file diff --git a/.gitignore b/.gitignore index 36883c3..9dabcef 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,8 @@ ui_tmp build/ debug/ release/ -unit_test/debug -unit_test/release +install/ +Output/ # Custom plugins directory - ignore custom/ diff --git a/lumberjack.iss b/lumberjack.iss new file mode 100644 index 0000000..c86d461 --- /dev/null +++ b/lumberjack.iss @@ -0,0 +1,147 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyBaseAppId "{BA395D89-E5A9-441A-8869-E9151B8EACE6}" + +#define MyAppName "Lumberjack" +#define MyAppPublisher "Lumberjack" +#define MyAppURL "https://github.com/SchrodingersGat/lumberjack/" +#define MyAppExeName "Lumberjack.exe" +#define MyAppVersion ReadIni("resource/version.ini", "General", "version", "0.0.0"); + +#define BuildDir "build/release" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={code:GetAppId} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +DefaultDirName={autopf}\{#MyAppName} +DisableProgramGroupPage=yes +LicenseFile=README.md + +; Remove the following line to run in administrative install mode (install for all users.) +PrivilegesRequired=lowest +PrivilegesRequiredOverridesAllowed=dialog +UsePreviousPrivileges=no +UsePreviousLanguage=no +OutputBaseFilename=lumberjack_{#MyAppVersion} +SetupIconFile=logo\lumberjack.ico +Compression=lzma +SolidCompression=yes +WizardStyle=modern +ArchitecturesInstallIn64BitMode=x64 +ArchitecturesAllowed=x64 + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +; Application executable +Source: "{#BuildDir}\lumberjack.exe"; DestDir: "{app}"; Flags: ignoreversion + +; DLL files +Source: "{#BuildDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion + +; Plugins +Source: "plugins\build\release\*.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion + +; Qt directories +Source: "{#BuildDir}\generic\*"; DestDir: "{app}\generic"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\networkinformation\*"; DestDir: "{app}\networkinformation"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\styles\*"; DestDir: "{app}\styles"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\tls\*"; DestDir: "{app}\tls"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#BuildDir}\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs + +[Icons] +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent + +[Code] +// The following code is to optionally allow multiple versions to be +// installed on the one computer. If a previous installation is +// detected, a dialogue box asks the user whether they want to overwrite the +// existing installation, or install a new one. +var + AppId: string; + DefaultDirName: string; + +// Getter for AppId +function GetAppId(Param: string): string; +begin + Result := AppId; + Log('AppId = ' + Result); +end; + +// Getter for DefaultDirName +function GetDefaultDirName(Param: string): string; +begin + Result := DefaultDirName; + Log('DefaultDirName = ' + Result); +end; + +// Impletement the event function InitializeSetup. This is called by Inno +// Setup "during Setup's initialisation". +function InitializeSetup(): Boolean; +var + PrevVersion: string; + CurVersion: string; + Message: string; + R: Integer; + +begin + CurVersion := '{#MyAppVersion}'; + Log(Format('Installing "%s"', [CurVersion])); + + // Returning True means that installation will proceed + Result := True; + + AppId := '{#MyBaseAppId}'; + DefaultDirName := ExpandConstant('{autopf}\Lumberjack\{#MyAppName}'); + + // Look in the registry to see if program is already installed + if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or + RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or + RegQueryStringValue(HKLM, 'Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or + RegQueryStringValue(HKCU, 'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) then + begin + Message := + Format( + 'Version is %s already installed. Do you want to upgrade to %s?'#13#10#13#10+ + 'Press Yes, to replace %0:s with %1:s.'#13#10+ + 'Press No, to keep %0:s and add separate installation of %1:s.'#13#10, [ + PrevVersion, CurVersion]); + R := MsgBox(Message, mbConfirmation, MB_YESNOCANCEL); + if R = IDYES then + begin + Log('User chose to replace previous installation'); + end + else if R = IDNO then + begin + AppId := AppId + CurVersion; + DefaultDirName := DefaultDirName + ' ' + CurVersion; + Log('User chose to install new copy - using ID ' + AppId); + end + else + begin + Log('User chose to cancel installation'); + + // Returning False will cancel the installation + Result := False; + end; + end; +end; \ No newline at end of file diff --git a/lumberjack.pro b/lumberjack.pro index 8027def..a7b4a59 100644 --- a/lumberjack.pro +++ b/lumberjack.pro @@ -40,6 +40,7 @@ SOURCES += \ src/data_source.cpp \ src/lumberjack_debug.cpp \ src/lumberjack_settings.cpp \ + src/lumberjack_version.cpp \ src/plot_curve.cpp \ src/plot_legend.cpp \ src/plot_widget.cpp \ @@ -169,12 +170,12 @@ COPIES += dllFiles CONFIG(debug, debug | release) { win32 { # Copy required .DLL files - QMAKE_POST_LINK += $$[QT_INSTALL_BINS]\windeployqt --debug --compiler-runtime $$shell_path($$quote($$DESTDIR))\lumberjack.exe $$escape_expand(\n\t) + QMAKE_POST_LINK += $$[QT_INSTALL_BINS]\windeployqt --debug --opengl --openglwidgets --widgets --compiler-runtime $$shell_path($$quote($$DESTDIR))\lumberjack.exe $$escape_expand(\n\t) } } else { win32 { # Copy required .DLL files - QMAKE_POST_LINK += $$[QT_INSTALL_BINS]\windeployqt --release --compiler-runtime $$shell_path($$quote($$DESTDIR))\lumberjack.exe $$escape_expand(\n\t) + QMAKE_POST_LINK += $$[QT_INSTALL_BINS]\windeployqt --release --opengl --openglwidgets --widgets --compiler-runtime $$shell_path($$quote($$DESTDIR))\lumberjack.exe $$escape_expand(\n\t) } } diff --git a/plugins/csv_exporter/csv_exporter.pro b/plugins/csv_exporter/csv_exporter.pro index 74dd6c5..18af1c8 100644 --- a/plugins/csv_exporter/csv_exporter.pro +++ b/plugins/csv_exporter/csv_exporter.pro @@ -36,7 +36,7 @@ CONFIG(debug, debug|release) { } else { CONFIG += release - DESTDIR = build/release + DESTDIR = ../build/release } RCC_DIR = $$DESDIR diff --git a/plugins/csv_importer/csv_importer.pro b/plugins/csv_importer/csv_importer.pro index 5519d8c..e36743c 100644 --- a/plugins/csv_importer/csv_importer.pro +++ b/plugins/csv_importer/csv_importer.pro @@ -39,7 +39,7 @@ CONFIG(debug, debug|release) { } else { CONFIG += release - DESTDIR = build/release + DESTDIR = ../build/release } RCC_DIR = $$DESDIR diff --git a/plugins/offset_filter/offset_filter.pro b/plugins/offset_filter/offset_filter.pro index e47957e..638422a 100644 --- a/plugins/offset_filter/offset_filter.pro +++ b/plugins/offset_filter/offset_filter.pro @@ -33,7 +33,7 @@ CONFIG(debug, debug|release) { } else { CONFIG += release - DESTDIR = build/release + DESTDIR = ../build/release } RCC_DIR = $$DESDIR diff --git a/plugins/scaler_filter/scaler_filter.pro b/plugins/scaler_filter/scaler_filter.pro index 0456202..47b156d 100644 --- a/plugins/scaler_filter/scaler_filter.pro +++ b/plugins/scaler_filter/scaler_filter.pro @@ -33,7 +33,7 @@ CONFIG(debug, debug|release) { } else { CONFIG += release - DESTDIR = build/release + DESTDIR = ../build/release } RCC_DIR = $$DESDIR diff --git a/resource/version.ini b/resource/version.ini new file mode 100644 index 0000000..80557ad --- /dev/null +++ b/resource/version.ini @@ -0,0 +1,2 @@ +[General] +version="0.16.0" diff --git a/resources.qrc b/resources.qrc index b746b4c..9cbda95 100644 --- a/resources.qrc +++ b/resources.qrc @@ -1,5 +1,6 @@ logo/lumberjack.svg + resource/version.ini diff --git a/src/lumberjack_version.cpp b/src/lumberjack_version.cpp new file mode 100644 index 0000000..66037cb --- /dev/null +++ b/src/lumberjack_version.cpp @@ -0,0 +1,22 @@ +#include + + +#include "lumberjack_version.hpp" + +static QString _version; + + +QString getLumberjackVersion(void) +{ + if (_version.isEmpty()) + { + QSettings settings(":/resource/version.ini", QSettings::IniFormat); + _version = settings.value("version", "_").toString(); + } + + if (_version == "_") { + return QString(); + } + + return _version; +} diff --git a/src/lumberjack_version.hpp b/src/lumberjack_version.hpp index fe892f1..bde1952 100644 --- a/src/lumberjack_version.hpp +++ b/src/lumberjack_version.hpp @@ -3,7 +3,6 @@ #include -// TODO: Move this into external .ini file -const QString LUMBERJACK_VERSION_STRING = "0.5.0"; +QString getLumberjackVersion(void); #endif // LUMBERJACK_VERSION_HPP diff --git a/src/main.cpp b/src/main.cpp index 0c46f28..3e344dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,10 +28,10 @@ int main(int argc, char *argv[]) // Configure application properties a.setApplicationName("lumberjack"); a.setApplicationDisplayName("lumberjack"); - a.setApplicationVersion(LUMBERJACK_VERSION_STRING); + a.setApplicationVersion(getLumberjackVersion()); QCoreApplication::setApplicationName("Lumberjack"); - QCoreApplication::setApplicationVersion(LUMBERJACK_VERSION_STRING); + QCoreApplication::setApplicationVersion(getLumberjackVersion()); // Command line parser QCommandLineParser parser; @@ -53,10 +53,10 @@ int main(int argc, char *argv[]) if (!parser.isSet(debugCmdOption)) { // Install custom debug handler - // registerLumberjackDebugHandler(); + registerLumberjackDebugHandler(); } - qDebug() << "Lumberjack:" << LUMBERJACK_VERSION_STRING; + qDebug() << "Lumberjack:" << getLumberjackVersion(); MainWindow w; w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 937e50c..9e9513b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,7 +36,7 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); - setWindowTitle("Lumberjack v" + LUMBERJACK_VERSION_STRING); + setWindowTitle("Lumberjack v" + getLumberjackVersion()); initMenus(); initDocks(); diff --git a/src/widgets/about_dialog.cpp b/src/widgets/about_dialog.cpp index 49f8933..b9bfc32 100644 --- a/src/widgets/about_dialog.cpp +++ b/src/widgets/about_dialog.cpp @@ -10,9 +10,9 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) setWindowModality(Qt::ApplicationModal); - setWindowTitle("Lumberjack v" + LUMBERJACK_VERSION_STRING); + setWindowTitle("Lumberjack v" + getLumberjackVersion()); - ui.softwareVersion->setText(LUMBERJACK_VERSION_STRING); + ui.softwareVersion->setText(getLumberjackVersion()); ui.buildDate->setText(__DATE__); QString compileInfo = QString(COMPILER);