Skip to content

Commit

Permalink
Merge pull request #4 from bloguetronica/v2.1
Browse files Browse the repository at this point in the history
V2.1
  • Loading branch information
samuelfmlourenco authored Apr 21, 2024
2 parents 48fd2e7 + cc931b9 commit 6ff0f1a
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 50 deletions.
13 changes: 6 additions & 7 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ installation, you must certify that your system is Debian based (or at least
uses apt-get) and that you have an active Internet connection. It is important
to note that you should also have the control commands for the function
generator already installed, but you can always install them later (please
refer to the packages "gf2-1.1.tar.gz" or "gf2-1.0.tar.gz" to do so).
refer to the package "gf2-2.0.tar.gz" to do so).

A list of the included scripts follows:
– install.sh;
Expand All @@ -15,16 +15,15 @@ A list of the included scripts follows:
In order to compile and install GF2 GUI for the first time, all you have to do
is to run "install.sh" by invoking "sudo ./install.sh" on a terminal window,
after changing your working directory to the current one. This script will
first obtain and install the required "build-essential" and "qt5-default"
packages (if they are not installed yet). Then it will compile the application
and move it to "/usr/local/bin/".
first obtain and install the required "build-essential" and
"qt5-default"/"qtbase5-dev" packages (if they are not installed yet). Then it
will compile the application and move it to "/usr/local/bin/".

Conversely, to uninstall, you should run "uninstall.sh" by invoking "sudo
./uninstall.sh", again on a terminal window after making sure that your
working directory is this one. This will delete the previously installed
application and source code. However it won't remove the "build-essential" and
"qt5-default" packages, since they could be already installed prior to the
first installation.
application and source code. However it won't remove the packages mentioned
above, since they could be already installed before the first installation.

P.S.:
Since the GUI was designed having KDE in mind, you should get the best
Expand Down
8 changes: 6 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ echo Obtaining required packages...
apt-get -qq update
apt-get -qq install build-essential
apt-get -qq install qt5-default
apt-get -qq install qtbase5-dev
echo Copying source code files...
mkdir -p /usr/local/src/gf2-gui/icons
mkdir -p /usr/local/src/gf2-gui/misc
cp -f src/about.cpp /usr/local/src/gf2-gui/.
cp -f src/about.h /usr/local/src/gf2-gui/.
cp -f src/about.ui /usr/local/src/gf2-gui/.
cp -f src/gf2-gui.pro /usr/local/src/gf2-gui/.
cp -f src/GPL.txt /usr/local/src/gf2-gui/.
cp -f src/icons/active64.png /usr/local/src/gf2-gui/icons/.
cp -f src/icons/gf2-gui.png /usr/local/src/gf2-gui/icons/.
cp -f src/icons/greyed64.png /usr/local/src/gf2-gui/icons/.
cp -f src/icons/selected64.png /usr/local/src/gf2-gui/icons/.
cp -f src/main.cpp /usr/local/src/gf2-gui/.
cp -f src/mainwindow.cpp /usr/local/src/gf2-gui/.
cp -f src/mainwindow.h /usr/local/src/gf2-gui/.
cp -f src/mainwindow.ui /usr/local/src/gf2-gui/.
cp -f src/misc/gf2-gui.desktop /usr/local/src/gf2-gui/misc/.
cp -f src/resources.qrc /usr/local/src/gf2-gui/.
cp -f src/README.txt /usr/local/src/gf2-gui/.
cp -f src/serial.cpp /usr/local/src/gf2-gui/.
Expand All @@ -26,6 +30,6 @@ cp -f src/serial.ui /usr/local/src/gf2-gui/.
echo Building and installing application...
cd /usr/local/src/gf2-gui
qmake
make all clean
mv -f gf2-gui /usr/local/bin/.
make install clean
rm -f gf2-gui
echo Done!
25 changes: 19 additions & 6 deletions src/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,37 @@ of relevant files follows:
– about.ui;
– gf2-gui.pro;
– icons/active64.png
– icons/gf2-gui.png
– icons/greyed64.png
– icons/selected64.png
– main.cpp;
– mainwindow.cpp;
– mainwindow.h;
– mainwindow.ui;
– misc/gf2-gui.desktop;
– resources.qrc;
– serial.cpp;
– serial.h;
– serial.ui.

In order to compile successfully, you must have the packages "build-essential"
and "qt5-default" already installed. Given that, if you wish to simply
compile, change your working directory to the current one on a terminal
window, and invoke "qmake", followed by "make" or "make all". Notice that
invoking "qmake" is necessary to generate the Makefile, but only needs to be
done once.
and "qt5-default" (or "qtbase5-dev") already installed. Given that, if you
wish to simply compile, change your working directory to the current one on a
terminal window, and invoke "qmake", followed by "make" or "make all". Notice
that invoking "qmake" is necessary to generate the Makefile, but only needs to
be done once.

You can also install using make. To do so, after invoking "qmake", you should
simply run "sudo make install". If you wish to force a rebuild before the
installation, then you must invoke "sudo make clean install" instead.

It may be necessary to undo any previous operations. Invoking "make clean"
will delete all object code generated during earlier compilations. However,
the previously generated binary is preserved.
the previously generated binary is preserved. It is important to note that it
is possible to undo previous installation operations as well, by invoking
"sudo make uninstall". Such approach is not recommended, though.

P.S.:
Notice that any make operation containing the actions "install" or "uninstall"
(e.g. "make install" or "make uninstall") requires root permissions, or in
other words, must be run with sudo.
4 changes: 2 additions & 2 deletions src/about.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down
4 changes: 2 additions & 2 deletions src/about.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down
2 changes: 1 addition & 1 deletion src/about.ui
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;GF2 Graphical User Interface - Version 2.0&lt;br/&gt;Copyright © 2018-2019 Samuel Lourenço&lt;/p&gt;&lt;p&gt;This program is distributed under the terms of the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0-standalone.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;GNU GPL v3&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;GF2 Graphical User Interface - Version 2.1&lt;br/&gt;Copyright © 2018-2024 Samuel Lourenço&lt;/p&gt;&lt;p&gt;This program is distributed under the terms of the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-3.0-standalone.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;GNU GPL v3&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
Expand Down
48 changes: 44 additions & 4 deletions src/gf2-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,62 @@ QT += core gui xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

# Added to provide backwards compatibility (C++11 support)
greaterThan(QT_MAJOR_VERSION, 4) {
CONFIG += c++11
} else {
QMAKE_CXXFLAGS += -std=c++11
}

TARGET = gf2-gui
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += main.cpp\
mainwindow.cpp \
SOURCES += \
main.cpp\
mainwindow.cpp \
serial.cpp \
about.cpp

HEADERS += mainwindow.h \
HEADERS += \
mainwindow.h \
serial.h \
about.h

FORMS += mainwindow.ui \
FORMS += \
mainwindow.ui \
about.ui \
serial.ui

RESOURCES += \
resources.qrc

# Added installation option
unix {
isEmpty(PREFIX) {
PREFIX = /usr/local
}
target.path = $$PREFIX/bin
icon.files += icons/gf2-gui.png
icon.path = $$PREFIX/share/icons/hicolor/128x128/apps
shortcut.files = misc/gf2-gui.desktop
shortcut.path = $$PREFIX/share/applications
INSTALLS += icon
INSTALLS += shortcut
}

!isEmpty(target.path): INSTALLS += target

DISTFILES += \
icons/gf2-gui.png \
misc/gf2-gui.desktop
Binary file added src/icons/gf2-gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down
31 changes: 13 additions & 18 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down Expand Up @@ -55,8 +55,7 @@ void MainWindow::on_actionLoad_triggered()
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QMessageBox errorRead;
errorRead.critical(this, tr("Error"), tr("Could not read from %1.\n\nPlease verify that you have read access to this file.").arg(QDir::toNativeSeparators(filename)));
QMessageBox::critical(this, tr("Error"), tr("Could not read from %1.\n\nPlease verify that you have read access to this file.").arg(QDir::toNativeSeparators(filename)));
}
else
{
Expand All @@ -65,24 +64,21 @@ void MainWindow::on_actionLoad_triggered()
file.close();
if (error)
{
QMessageBox errorInvalid;
errorInvalid.critical(this, tr("Error"), tr("Invalid XML. The file might be corrupted or incomplete."));
QMessageBox::critical(this, tr("Error"), tr("Invalid XML. The file might be corrupted or incomplete."));
}
else
{
QDomElement root = document.firstChildElement();
if (root.tagName() != "settings" || root.attribute("target") != "GF2")
{
QMessageBox errorNoSettings;
errorNoSettings.critical(this, tr("Error"), tr("The selected file is not a GF2 settings file."));
QMessageBox::critical(this, tr("Error"), tr("The selected file is not a GF2 settings file."));
}
else
{
int errorcount = implementSettings(root);
if (errorcount > 0)
{
QMessageBox warningDebug;
warningDebug.warning(this, tr("Warning"), tr("Found %1 setting(s) with invalid attribute values.\n\nPlease check your settings file for out-of-bounds or unsupported attribute values.").arg(errorcount));
QMessageBox::warning(this, tr("Warning"), tr("Found %1 setting(s) with invalid attribute values.\n\nPlease check your settings file for out-of-bounds or unsupported attribute values.").arg(errorcount));
}
filepath_ = filename;
}
Expand Down Expand Up @@ -134,8 +130,7 @@ void MainWindow::on_actionSave_triggered()
QFile file(filename);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
QMessageBox errorWrite;
errorWrite.critical(this, tr("Error"), tr("Could not write to %1.\n\nPlease verify that you have write access to this file.").arg(QDir::toNativeSeparators(filename)));
QMessageBox::critical(this, tr("Error"), tr("Could not write to %1.\n\nPlease verify that you have write access to this file.").arg(QDir::toNativeSeparators(filename)));
}
else
{
Expand All @@ -152,13 +147,13 @@ void MainWindow::on_actionSerial_triggered()
{
Serial serial;
serial.setSerialLineEditText(serialstr_);
if (serial.exec() == QDialog::Accepted)
{
if (serial.exec() == QDialog::Accepted) {
QString title = tr("GF2 Function Generator");
serialstr_ = serial.serialLineEditText();
if (serialstr_.isEmpty())
this->setWindowTitle("GF2 Function Generator");
else
this->setWindowTitle("GF2 Function Generator (S/N: " + serialstr_ + ")");
if (!serialstr_.isEmpty()) {
title.append(tr(" (S/N: %1)").arg(serialstr_));
}
this->setWindowTitle(title);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down
8 changes: 8 additions & 0 deletions src/misc/gf2-gui.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=GF2 GUI
Icon=gf2-gui
Exec=gf2-gui
Terminal=false
Categories=Development;Electronics;
6 changes: 4 additions & 2 deletions src/serial.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand All @@ -20,6 +20,8 @@

// Includes
#include <QProcess>
#include <QRegExp>
#include <QRegExpValidator>
#include "serial.h"
#include "ui_serial.h"

Expand Down
4 changes: 2 additions & 2 deletions src/serial.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GF2 GUI - Version 2.0 for Debian Linux
Copyright (c) 2018-2019 Samuel Lourenço
/* GF2 GUI - Version 2.1 for Debian Linux
Copyright (c) 2018-2024 Samuel Lourenço
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
Expand Down
7 changes: 7 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/sh

echo Removing application...
rm -f /usr/local/share/applications/gf2-gui.desktop
rmdir --ignore-fail-on-non-empty /usr/local/share/applications
rm -f /usr/local/share/icons/hicolor/128x128/apps/gf2-gui.png
rmdir --ignore-fail-on-non-empty /usr/local/share/icons/hicolor/128x128/apps
rmdir --ignore-fail-on-non-empty /usr/local/share/icons/hicolor/128x128
rmdir --ignore-fail-on-non-empty /usr/local/share/icons/hicolor
rmdir --ignore-fail-on-non-empty /usr/local/share/icons
rm -f /usr/local/bin/gf2-gui
echo Removing source code files...
rm -rf /usr/local/src/gf2-gui
Expand Down

0 comments on commit 6ff0f1a

Please sign in to comment.