diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra modules and scripts for CMake" URL "git://anongit.kde.org/extra-cmake-modules") -set(PROJECT_VERSION "16.08.0") +set(PROJECT_VERSION "0.90.0") set(KF5_DEP_VERSION "5.24.0") # handled by release scripts set(REQUIRED_QT_VERSION 5.4.0) @@ -47,7 +47,7 @@ VARIABLE_PREFIX ATCORE VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/atcore_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/AtCoreConfigVersion.cmake" - SOVERSION 1 + SOVERSION ${PROJECT_VERSION_MAJOR} ) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") diff --git a/src/atcore.h b/src/atcore.h --- a/src/atcore.h +++ b/src/atcore.h @@ -52,6 +52,7 @@ class ATCORE_EXPORT AtCore : public QObject { Q_OBJECT + Q_PROPERTY(QString version READ version) Q_PROPERTY(QStringList availableFirmwarePlugins READ availableFirmwarePlugins) Q_PROPERTY(quint16 serialTimerInterval READ serialTimerInterval WRITE setSerialTimerInterval) Q_PROPERTY(QStringList serialPorts READ serialPorts NOTIFY portsChanged) @@ -98,6 +99,12 @@ */ explicit AtCore(QObject *parent = nullptr); + /** + * @brief version + * @return Version number + */ + QString version() const; + /** * @brief Returns a List of detected serial ports * @return List of detected ports diff --git a/src/atcore.cpp b/src/atcore.cpp --- a/src/atcore.cpp +++ b/src/atcore.cpp @@ -33,6 +33,7 @@ #include #include "atcore.h" +#include "atcore_version.h" #include "seriallayer.h" #include "gcodecommands.h" #include "printthread.h" @@ -93,6 +94,11 @@ setState(AtCore::DISCONNECTED); } +QString AtCore::version() const +{ + return QString::fromLatin1(ATCORE_VERSION_STRING); +} + SerialLayer *AtCore::serial() const { return d->serial; diff --git a/testclient/CMakeLists.txt b/testclient/CMakeLists.txt --- a/testclient/CMakeLists.txt +++ b/testclient/CMakeLists.txt @@ -1,3 +1,5 @@ +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) include_directories(../src) @@ -18,7 +20,7 @@ SerialPort ) if (NOT APPLE) - add_executable(AtCoreTest ${AtCoreTestClient_SRCS}) + add_executable(AtCoreTest ${AtCoreTestClient_SRCS} icons.qrc) install(TARGETS AtCoreTest RUNTIME DESTINATION bin) @@ -31,7 +33,7 @@ DESTINATION share/applications) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11") - add_executable(AtCoreTest MACOSX_BUNDLE ${AtCoreTestClient_SRCS}) + add_executable(AtCoreTest MACOSX_BUNDLE ${AtCoreTestClient_SRCS} icons.qrc) install(TARGETS AtCoreTest BUNDLE DESTINATION bin) endif() diff --git a/testclient/icons.qrc b/testclient/icons.qrc new file mode 100644 --- /dev/null +++ b/testclient/icons.qrc @@ -0,0 +1,6 @@ + + + ../doc/atcore.png + + + diff --git a/testclient/mainwindow.h b/testclient/mainwindow.h --- a/testclient/mainwindow.h +++ b/testclient/mainwindow.h @@ -166,6 +166,11 @@ * @brief show/hide dock titlebars */ void toggleDockTitles(); + + /** + * @brief Show the about dialog + */ + void about(); signals: /** * @brief printFile emit ready to print a file to atcore diff --git a/testclient/mainwindow.cpp b/testclient/mainwindow.cpp --- a/testclient/mainwindow.cpp +++ b/testclient/mainwindow.cpp @@ -25,11 +25,13 @@ #include #include #include +#include #include "mainwindow.h" #include "seriallayer.h" #include "gcodecommands.h" #include "widgets/axiscontrol.h" +#include "widgets/about.h" Q_LOGGING_CATEGORY(TESTCLIENT_MAINWINDOW, "org.kde.atelier.core") @@ -42,6 +44,7 @@ logFile(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/AtCore_"))) { ui->setupUi(this); + QCoreApplication::setApplicationVersion(core->version()); ui->serialPortCB->setEditable(true); QValidator *validator = new QIntValidator(); ui->baudRateLE->setValidator(validator); @@ -121,6 +124,7 @@ connect(ui->actionQuit, &QAction::triggered, this, &MainWindow::close); connect(ui->actionShowDockTitles, &QAction::toggled, this, &MainWindow::toggleDockTitles); + connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::about); ui->menuView->insertAction(nullptr, ui->connectDock->toggleViewAction()); ui->menuView->insertAction(nullptr, ui->tempControlsDock->toggleViewAction()); @@ -554,6 +558,13 @@ ui->printDock->setTitleBarWidget(new QWidget()); } } + +void MainWindow::about() +{ + About *aboutDialog = new About(this); + aboutDialog->exec(); +} + void MainWindow::axisControlClicked(QChar axis, int value) { core->setRelativePosition(); diff --git a/testclient/mainwindow.ui b/testclient/mainwindow.ui --- a/testclient/mainwindow.ui +++ b/testclient/mainwindow.ui @@ -766,11 +766,11 @@ - - - Wait Untill Temperature Stablizes - - + + + Wait Untill Temperature Stablizes + + @@ -914,8 +914,15 @@ + + + Help + + + + @@ -933,6 +940,14 @@ &Show Dock Titles + + + About + + + F1 + + diff --git a/testclient/widgets/CMakeLists.txt b/testclient/widgets/CMakeLists.txt --- a/testclient/widgets/CMakeLists.txt +++ b/testclient/widgets/CMakeLists.txt @@ -1,6 +1,7 @@ set(widgets_SRCS plotwidget.cpp axiscontrol.cpp + about.cpp ) add_library(AtCoreTestWidgets STATIC ${widgets_SRCS}) diff --git a/testclient/widgets/about.h b/testclient/widgets/about.h new file mode 100644 --- /dev/null +++ b/testclient/widgets/about.h @@ -0,0 +1,33 @@ +/* AtCore Test Client + Copyright (C) <2016> + + Authors: + Chris Rizzitello + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef ABOUT_H +#define ABOUT_H + +#include + +class About : public QDialog +{ + Q_OBJECT +public: + explicit About(QWidget *parent = 0); + ~About(); +}; +#endif // ABOUT_H diff --git a/testclient/widgets/about.cpp b/testclient/widgets/about.cpp new file mode 100644 --- /dev/null +++ b/testclient/widgets/about.cpp @@ -0,0 +1,69 @@ +/* AtCore Test Client + Copyright (C) <2016> + + Authors: + Chris Rizzitello + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include +#include +#include +#include +#include +#include + +#include "about.h" + +About::About(QWidget *parent) : + QDialog(parent) +{ + setWindowTitle(QStringLiteral("About Atcore")); + setWindowIcon(QIcon::fromTheme(QStringLiteral("help-about"), style()->standardIcon(QStyle::SP_MessageBoxInformation))); + + QLabel *lbl_version = new QLabel(QString::fromLatin1("Version: %1").arg(QCoreApplication::applicationVersion())); + QLabel *lbl_git_version = new QLabel(QString::fromLatin1("GitID: %1").arg(QStringLiteral("GIDIDHERE"))); + QLabel *lbl_qt_version = new QLabel(QString::fromLatin1("Using Qt: %1").arg(QString::fromLatin1(qVersion()))); + QLabel *lbl_authors = new QLabel(QStringLiteral("Authors:\n\tChris Rizzitello \n\tPatrick José Pereira \n\tLays Rodrigues \n\tTomaz Canabrava ")); + + QLabel *lbl_icon = new QLabel(); + lbl_icon->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + lbl_icon->setScaledContents(true); + lbl_icon->setPixmap(QPixmap(QStringLiteral(":/icon/atcore"))); + + QPushButton *btn_close = new QPushButton(QStringLiteral("&Close")); + connect(btn_close, &QPushButton::clicked, this, &QDialog::close); + + QHBoxLayout *versionInfo = new QHBoxLayout; + versionInfo->addWidget(lbl_version); + versionInfo->addWidget(lbl_git_version); + versionInfo->addWidget(lbl_qt_version); + + QVBoxLayout *topLayout = new QVBoxLayout; + topLayout->setContentsMargins(0, 0, 0, 0); + topLayout->addWidget(lbl_icon); + topLayout->addItem(versionInfo); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addItem(topLayout); + mainLayout->addWidget(lbl_authors); + mainLayout->addWidget(btn_close); + + setLayout(mainLayout); +} + +About::~About() +{ + +}