Add Qt6 compatibility.

master
Teuniz 2023-02-08 21:22:28 +01:00
rodzic 0004291efa
commit 76e3679c4f
47 zmienionych plików z 1666 dodań i 2486 usunięć

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -57,7 +57,7 @@ UI_Aboutwindow::UI_Aboutwindow()
textedit1->setPlainText(
"\n " PROGRAM_NAME " " PROGRAM_VERSION "\n"
"\n This program is made by Teunis van Beelen.\n"
"\n Copyright (C) 2015 - 2021 Teunis van Beelen.\n"
"\n Copyright (C) 2015 - 2023 Teunis van Beelen.\n"
"\n Email: teuniz@protonmail.com\n"
"\n Disclaimer:\n"
" Despite this software is intend to be useful, there is no warranty, use this software at your own risk!\n");

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -30,16 +30,7 @@
#define UI_DECODE_DIALOG_H
#include <QtGlobal>
#include <QApplication>
#include <QObject>
#include <QWidget>
#include <QDialog>
#include <QTabWidget>
#include <QLabel>
#include <QComboBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include "qt_headers.h"
#include <stdio.h>
#include <stdlib.h>

Wyświetl plik

@ -2,11 +2,11 @@
contains(QT_MAJOR_VERSION, 4) {
LIST = 0 1 2 3 4 5 6
for(a, LIST):contains(QT_MINOR_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1")
for(a, LIST):contains(QT_MINOR_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
contains(QT_MINOR_VERSION, 7) {
LIST = 0
for(a, LIST):contains(QT_PATCH_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1")
for(a, LIST):contains(QT_PATCH_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
}
}
@ -14,11 +14,23 @@ contains(QT_MINOR_VERSION, 7) {
contains(QT_MAJOR_VERSION, 5) {
LIST = 0 1 2 3 4 5 6 7 8
for(a, LIST):contains(QT_MINOR_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1")
for(a, LIST):contains(QT_MINOR_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
contains(QT_MINOR_VERSION, 9) {
LIST = 0
for(a, LIST):contains(QT_PATCH_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1")
for(a, LIST):contains(QT_PATCH_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
}
}
contains(QT_MAJOR_VERSION, 6) {
LIST = 0 1 2 3
for(a, LIST):contains(QT_MINOR_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
contains(QT_MINOR_VERSION, 4) {
LIST = 0
for(a, LIST):contains(QT_PATCH_VERSION, $$a):error("This project needs Qt4 version >= 4.7.1 or Qt5 version >= 5.9.1 or Qt6 version >= 6.4.1")
}
}
@ -36,11 +48,14 @@ CONFIG += largefile
QT += widgets
QT += network
QMAKE_CXXFLAGS += -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -Wfatal-errors
QMAKE_CXXFLAGS += -Wextra -Wshadow -Wformat -Wformat-nonliteral -Wformat-security -Wtype-limits -Wfatal-errors -Wdeprecated-declarations
QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -Wfatal-errors -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
OBJECTS_DIR = ./objects
MOC_DIR = ./moc
HEADERS += qt_headers.h
HEADERS += global.h
HEADERS += mainwindow.h
HEADERS += about_dialog.h

2148
edflib.c

Plik diff jest za duży Load Diff

915
edflib.h

Plik diff jest za duży Load Diff

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.37_2105301226"
#define PROGRAM_VERSION "0.38_2302082035"
#define MAX_PATHLEN (1024)

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -9,18 +9,74 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
#if !defined(__GNUC__)
#error "Wrong compiler or platform!"
#endif
// app.setAttribute(Qt::AA_DontUseNativeMenuBar);
#if CHAR_BIT != 8
#error "unsupported char size"
#endif
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
#error "system is not little endian!"
#endif
char str[512]={""};
union
{
char four[4];
int one;
} byte_order_test_var;
/* avoid surprises! */
if((sizeof(char) != 1) ||
(sizeof(short) != 2) ||
(sizeof(int) != 4) ||
(sizeof(long) != 8) ||
(sizeof(long long) != 8) ||
(sizeof(float) != 4) ||
(sizeof(double) != 8))
{
fprintf(stderr, "Wrong compiler or platform!\n");
return EXIT_FAILURE;
}
/* check endianness! */
byte_order_test_var.one = 0x03020100;
if((byte_order_test_var.four[0] != 0) ||
(byte_order_test_var.four[1] != 1) ||
(byte_order_test_var.four[2] != 2) ||
(byte_order_test_var.four[3] != 3))
{
fprintf(stderr, "Wrong compiler or platform!\n");
return EXIT_FAILURE;
}
QApplication app(argc, argv);
#if QT_VERSION >= 0x050000
qApp->setStyle(QStyleFactory::create("Fusion"));
#endif
qApp->setStyleSheet("QLabel, QMessageBox { messagebox-text-interaction-flags: 5; }");
class UI_Mainwindow MainWindow;
UI_Mainwindow *MainWindow = new UI_Mainwindow;
if(MainWindow == NULL)
{
snprintf(str, 512, "Malloc error.\nFile: %s line: %i", __FILE__, __LINE__);
return app.exec();
fprintf(stderr, "%s\n", str);
QMessageBox::critical(NULL, "Error", str);
return EXIT_FAILURE;
}
int ret = app.exec();
delete MainWindow;
return ret;
}

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -85,7 +85,7 @@ void UI_Mainwindow::open_connection()
{
strlcpy(dev_str, "/dev/usbtmc0", 256);
settings.setValue("connection/device", dev_str);
settings.setValue("connection/device", QString(dev_str));
}
device = tmc_open_usb(dev_str);

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -30,43 +30,6 @@
#define UI_VIEW_MAINFORM_H
#include <QtGlobal>
#include <QApplication>
#include <QObject>
#include <QtGui>
#include <QWidget>
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QFont>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QFileDialog>
#include <QAction>
#include <QActionGroup>
#include <QImage>
#include <QSplashScreen>
#include <QTimer>
#include <QDesktopServices>
#include <QUrl>
#include <QLibrary>
#include <QString>
#include <QVBoxLayout>
#include <QList>
#include <QDockWidget>
#include <QPalette>
#include <QGroupBox>
#include <QMessageBox>
#include <QPoint>
#include <QDial>
#include <QSettings>
#include <QProcess>
#include <QProgressDialog>
#include <QKeySequence>
#include <QEventLoop>
#include <QRect>
#include <QPixmap>
#include <stdio.h>
#include <stdlib.h>
@ -78,6 +41,7 @@
#include <unistd.h>
#include <pthread.h>
#include "qt_headers.h"
#include "global.h"
#include "about_dialog.h"
#include "utils.h"

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -188,7 +188,11 @@ UI_Mainwindow::UI_Mainwindow()
devicemenu->setTitle("Device");
devicemenu->addAction("Connect", this, SLOT(open_connection()));
devicemenu->addAction("Disconnect", this, SLOT(close_connection()));
#if QT_VERSION < 0x060000
devicemenu->addAction("Exit", this, SLOT(close()), QKeySequence::Quit);
#else
devicemenu->addAction("Exit", QKeySequence::Quit, this, SLOT(close()));
#endif
menubar->addMenu(devicemenu);
settingsmenu = new QMenu(this);
@ -495,7 +499,11 @@ UI_Mainwindow::UI_Mainwindow()
addAction(chan_scale_plus_act);
chan_scale_plus_all_channels_act = new QAction(this);
#if QT_VERSION < 0x060000
chan_scale_plus_all_channels_act->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Minus));
#else
chan_scale_plus_all_channels_act->setShortcut(QKeySequence(Qt::SHIFT | Qt::Key_Minus));
#endif
connect(chan_scale_plus_all_channels_act, SIGNAL(triggered()), this, SLOT(chan_scale_plus_all()));
addAction(chan_scale_plus_all_channels_act);
@ -505,7 +513,11 @@ UI_Mainwindow::UI_Mainwindow()
addAction(chan_scale_minus_act);
chan_scale_minus_all_channels_act = new QAction(this);
#if QT_VERSION < 0x060000
chan_scale_minus_all_channels_act->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Plus));
#else
chan_scale_minus_all_channels_act->setShortcut(QKeySequence(Qt::SHIFT | Qt::Key_Plus));
#endif
connect(chan_scale_minus_all_channels_act, SIGNAL(triggered()), this, SLOT(chan_scale_minus_all()));
addAction(chan_scale_minus_all_channels_act);
@ -655,7 +667,7 @@ UI_Mainwindow::~UI_Mainwindow()
{
QSettings settings;
settings.setValue("path/savedir", recent_savedir);
settings.setValue("path/savedir", QString(recent_savedir));
delete scrn_thread;
delete appfont;

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2017 - 2021 Teunis van Beelen
* Copyright (C) 2017 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2017 - 2021 Teunis van Beelen
* Copyright (C) 2017 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -30,16 +30,7 @@
#define UI_PLAYBACK_DIALOG_H
#include <QtGlobal>
#include <QApplication>
#include <QObject>
#include <QWidget>
#include <QDialog>
#include <QLabel>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QTimer>
#include <QMessageBox>
#include "qt_headers.h"
#include <stdio.h>
#include <stdlib.h>

143
qt_headers.h 100644
Wyświetl plik

@ -0,0 +1,143 @@
/*
***************************************************************************
*
* author: Teunis van Beelen
*
* email: teuniz@protonmail.com
*
***************************************************************************
*/
#ifndef QT_HEADERS_INCLUDE_H
#define QT_HEADERS_INCLUDE_H
#include <QtGlobal>
#include <QObject>
#include <QApplication>
#if QT_VERSION < 0x060000
#include <QDesktopWidget>
#endif
#if QT_VERSION >= 0x050000
#include <QGuiApplication>
#endif
#include <QScreen>
#include <QStyle>
#include <QStyleFactory>
#include <QEvent>
#include <QEventLoop>
#include <QMouseEvent>
#include <QPainter>
#include <QColor>
#include <QPen>
#include <QThread>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QLocale>
#include <QtGui>
#include <QWidget>
#include <QFrame>
#include <QStackedLayout>
#include <QStackedWidget>
#include <QMainWindow>
#include <QDialog>
#include <QMessageBox>
#include <QMenuBar>
#include <QMenu>
#include <QProgressDialog>
#include <QList>
#include <QProcess>
#include <QProcessEnvironment>
#include <QVariant>
#include <QTcpSocket>
#include <QHostAddress>
#include <QFont>
#include <QToolBar>
#include <QStatusBar>
#include <QLabel>
#include <QFileDialog>
#include <QAction>
#include <QActionGroup>
#include <QPixmap>
#include <QSplashScreen>
#include <QTimer>
#include <QDesktopServices>
#include <QUrl>
#include <QLibrary>
#include <QString>
#include <QStringList>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QFormLayout>
#include <QPushButton>
#include <QTabWidget>
#include <QCloseEvent>
#include <QDir>
#include <QRect>
#include <QFontMetrics>
#include <QSize>
#include <QToolTip>
#include <QKeySequence>
#include <QKeyEvent>
#include <QTableWidget>
#include <QListWidget>
#include <QListWidgetItem>
#include <QRadioButton>
#include <QButtonGroup>
#include <QGroupBox>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QSlider>
#include <QByteArray>
#include <QCursor>
#include <QDate>
#include <QTime>
#include <QDateTime>
#include <QDateTimeEdit>
#include <QFile>
#include <QLayout>
#include <QSslConfiguration>
#include <QTextEdit>
#include <QTextCursor>
#include <QProgressBar>
#include <QLCDNumber>
#include <QPalette>
#include <QDockWidget>
#include <QScrollBar>
#include <QTimeEdit>
#include <QRectF>
#include <QPoint>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QCompleter>
#include <QStringListModel>
#include <QTreeView>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QIcon>
#include <QPlainTextEdit>
#include <QLinearGradient>
#include <QBrush>
#include <QColorDialog>
#include <QElapsedTimer>
#include <QPainterPath>
#include <QShortcut>
#include <QTcpServer>
#include <QModelIndex>
#include <QAbstractItemModel>
#include <QMutex>
#if QT_VERSION >= 0x050200
#include <QFontDatabase>
#endif
#endif

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -135,7 +135,7 @@ void UI_Mainwindow::save_screenshot()
if(devparms.modelserie == 1)
{
painter.begin(&screenXpm);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
painter.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
@ -150,7 +150,7 @@ void UI_Mainwindow::save_screenshot()
else if(devparms.modelserie == 6)
{
painter.begin(&screenXpm);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
painter.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -779,7 +779,7 @@ void screen_thread::run()
if(n < 0)
{
printf("Can not read from device.\n");
printf("Can not read from device. (n is %i)\n", n);
line = __LINE__;
goto OUT_ERROR;
}

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -277,17 +277,17 @@ void UI_settings_window::applyButtonClicked()
mainwindow->devparms.connectiontype = 1;
}
settings.setValue("connection/device", dev_str);
settings.setValue("connection/device", QString(dev_str));
snprintf(dev_str, 256, "%i.%i.%i.%i",
ipSpinbox1->value(), ipSpinbox2->value(), ipSpinbox3->value(), ipSpinbox4->value());
settings.setValue("connection/ip", dev_str);
settings.setValue("connection/ip", QString(dev_str));
strncpy(mainwindow->devparms.hostname, HostLineEdit->text().toLatin1().data(), 63);
mainwindow->devparms.hostname[63] = 0;
settings.setValue("connection/hostname", mainwindow->devparms.hostname);
settings.setValue("connection/hostname", QString(mainwindow->devparms.hostname));
if(invScrShtCheckbox->checkState() == Qt::Checked)
{

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -33,17 +33,7 @@
#include <QApplication>
#include <QObject>
#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QComboBox>
#include <QCheckBox>
#include <QSettings>
#include <QRadioButton>
#include <QSpinBox>
#include <QLineEdit>
#include "qt_headers.h"
#include <stdio.h>
#include <stdlib.h>

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2010 - 2021 Teunis van Beelen
* Copyright (C) 2010 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -142,7 +142,7 @@ void SignalCurve::paintEvent(QPaintEvent *)
if(updates_enabled == false) return;
QPainter paint(this);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
paint.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
@ -172,7 +172,7 @@ int SignalCurve::print_to_image(const char *path)
QPixmap pixmap(w_p, h_p);
QPainter paint(&pixmap);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
paint.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
@ -1676,10 +1676,13 @@ void SignalCurve::mousePressEvent(QMouseEvent *press_event)
w = width() - (2 * bordersize);
h = height() - (2 * bordersize);
#if QT_VERSION < 0x060000
m_x = press_event->x() - bordersize;
m_y = press_event->y() - bordersize;
#else
m_x = press_event->position().x() - bordersize;
m_y = press_event->position().y() - bordersize;
#endif
if(devparms == NULL)
{
return;
@ -1811,10 +1814,13 @@ void SignalCurve::mouseReleaseEvent(QMouseEvent *release_event)
w = width() - (2 * bordersize);
h = height() - (2 * bordersize);
#if QT_VERSION < 0x060000
mouse_x = release_event->x() - bordersize;
mouse_y = release_event->y() - bordersize;
#else
mouse_x = release_event->position().x() - bordersize;
mouse_y = release_event->position().y() - bordersize;
#endif
if(devparms == NULL)
{
return;
@ -2075,10 +2081,13 @@ void SignalCurve::mouseMoveEvent(QMouseEvent *move_event)
{
return;
}
#if QT_VERSION < 0x060000
mouse_x = move_event->x() - bordersize;
mouse_y = move_event->y() - bordersize;
#else
mouse_x = move_event->position().x() - bordersize;
mouse_y = move_event->position().y() - bordersize;
#endif
if(devparms == NULL)
{
return;

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -58,7 +58,7 @@ void TDial::paintEvent(QPaintEvent *)
double r1, r2, r3, r4, dtmp;
QPainter p(this);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
p.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
@ -162,8 +162,11 @@ void TDial::mousePressEvent(QMouseEvent *press_event)
{
slider_down = true;
setMouseTracking(true);
#if QT_VERSION < 0x060000
mouse_grad_old = polar_to_degr(press_event->x() - (width() / 2), press_event->y() - (height() / 2));
#else
mouse_grad_old = polar_to_degr(press_event->position().x() - (width() / 2), press_event->position().y() - (height() / 2));
#endif
}
press_event->accept();
@ -190,9 +193,11 @@ void TDial::mouseMoveEvent(QMouseEvent *move_event)
gr_diff;
if(slider_down == false) return;
#if QT_VERSION < 0x060000
gr_new = polar_to_degr(move_event->x() - (width() / 2), move_event->y() - (height() / 2));
#else
gr_new = polar_to_degr(move_event->position().x() - (width() / 2), move_event->position().y() - (height() / 2));
#endif
gr_diff = gr_new - mouse_grad_old;
mouse_grad_old = gr_new;

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2014 - 2021 Teunis van Beelen
* Copyright (C) 2014 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -43,7 +43,7 @@ TLed::TLed(QWidget *p) : QWidget(p)
void TLed::paintEvent(QPaintEvent *)
{
QPainter paint(this);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
paint.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
drawLed(&paint);

2
tled.h
Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2014 - 2021 Teunis van Beelen
* Copyright (C) 2014 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -238,7 +238,7 @@ int tmcdev_read(struct tmcdev *dev)
dev->buf[0] = 0;
return -1;
return -2;
}
dev->hdrbuf[size] = 0;
@ -265,7 +265,7 @@ int tmcdev_read(struct tmcdev *dev)
{
blockhdr[31] = 0;
return -1;
return -3;
}
blockhdr[len + 2] = 0;
@ -279,7 +279,7 @@ int tmcdev_read(struct tmcdev *dev)
{
blockhdr[31] = 0;
return -1;
return -4;
}
size += read_size;
@ -291,7 +291,7 @@ int tmcdev_read(struct tmcdev *dev)
{
blockhdr[31] = 0;
return -1;
return -5;
}
dev->buf = dev->hdrbuf + len + 2;

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2015 - 2021 Teunis van Beelen
* Copyright (C) 2015 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

559
utils.c
Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2009 - 2021 Teunis van Beelen
* Copyright (C) 2009 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -34,8 +34,134 @@
#define FLT_ROUNDS 1
/* size is size of destination */
/* dest points to src2 relative to src1 */
void get_relative_path_from_absolut_paths(char *dest, const char *src1, const char *src2, int size)
{
int i, len1, len2, len_min, delim_shared=0, delim1=0, delim2=0;
/* removes extension including the dot */
if(size < 1) return;
dest[0] = 0;
len1 = strlen(src1);
len2 = strlen(src2);
len_min = (len1 > len2) ? len2 : len1;
if(!len_min) return;
for(i=0; i<len_min; i++)
{
if(src1[i] != src2[i])
{
break;
}
else
{
if((src1[i] == '/') || (src1[i] == '\\'))
{
delim_shared++;
}
}
}
for(; i<len1; i++)
{
if((src1[i] == '/') || (src1[i] == '\\'))
{
delim1++;
}
}
for(i=0; i<delim1; i++)
{
strlcat(dest, "../", size);
}
for(i=0; i<len2; i++)
{
if((src2[i] == '/') || (src2[i] == '\\'))
{
delim2++;
if(delim2 == delim_shared)
{
i++;
break;
}
}
}
strlcat(dest, src2 + i, size);
}
/* removes double dot entries */
void sanitize_path(char *path)
{
int i, j, len, cut=0, delim_pos1=-1, delim_pos2=-1, delim_pos3=-1, dots=0, letter=0, dir=0;
if(path == NULL) return;
len = strlen(path);
if(len < 2) return;
for(i=0; i<len; i++)
{
if(path[i] == '.')
{
dots++;
}
else if((path[i] == '/') || (path[i] == '\\'))
{
if(letter)
{
letter = 0;
dir = 1;
}
delim_pos1 = delim_pos2;
delim_pos2 = delim_pos3;
delim_pos3 = i;
if((dots == 2) && (delim_pos1 >= 0) && dir)
{
cut = delim_pos3 - delim_pos1;
for(j=delim_pos1; j<(len-cut+1); j++)
{
path[j] = path[j+cut];
}
len = strlen(path);
i = 0;
dots = 0;
dir = 0;
continue;
}
dots = 0;
}
else
{
dots = 3;
letter++;
}
}
}
/* removes extension including the dot */
void remove_extension_from_filename(char *str)
{
int i, len;
@ -64,7 +190,7 @@ void remove_extension_from_filename(char *str)
}
/* sz is size of destination, returns length of filename */
/* sz is size of destination, returns length of filename */
int get_filename_from_path(char *dest, const char *src, int sz)
{
int i, len;
@ -115,8 +241,8 @@ int get_filename_from_path(char *dest, const char *src, int sz)
}
/* sz is size of destination, returns length of directory */
/* last character of destination is not a slash! */
/* sz is size of destination, returns length of directory */
/* last character of destination is not a slash! */
int get_directory_from_path(char *dest, const char *src, int sz)
{
int i, len;
@ -200,6 +326,8 @@ void remove_trailing_spaces(char *str)
len = strlen(str);
if(!len) return;
for(i=(len-1); i>=0; i--)
{
if(str[i]!=' ') break;
@ -265,6 +393,8 @@ void trim_spaces(char *str)
len = strlen(str);
if(!len) return;
for(i=(len-1); i>=0; i--)
{
if(str[i]!=' ') break;
@ -274,7 +404,7 @@ void trim_spaces(char *str)
}
/* removes trailing zero's from one or more occurrences of a decimal fraction in a string */
void remove_trailing_zeros(char *str)
{
int i, j,
@ -448,13 +578,14 @@ void utf8_to_latin1(char *utf8_str)
}
/* max string length: 4096 characters! */
void latin1_to_utf8(char *latin1_str, int len)
{
int i, j;
unsigned char *str, tmp_str[1024];
unsigned char *str, tmp_str[4096];
if(len > 4096) len = 4096;
str = (unsigned char *)latin1_str;
@ -498,11 +629,26 @@ void latin1_to_utf8(char *latin1_str, int len)
}
void sanitize_ascii(char *s)
{
for( ; *s; s++)
{
if((*s < 32) || (*s > 126))
{
*s = '.';
}
}
}
void latin1_to_ascii(char *str, int len)
{
/* ISO 8859-1 except for characters 0x80 to 0x9f which are taken from the extension CP-1252 */
int i, value;
const char conv_table[]=".E.,F\".++^.S<E.Z..`\'\"\".--~.s>e.zY.i....|....<...-....\'u.....>...?AAAAAAECEEEEIIIIDNOOOOOxOUUUUYtsaaaaaaeceeeeiiiidnooooo:0uuuuyty";
for(i=0; i<len; i++)
{
value = *((unsigned char *)(str + i));
@ -512,200 +658,14 @@ void latin1_to_ascii(char *str, int len)
continue;
}
switch(value)
if(value < 32)
{
case 128 : str[i] = 'E'; break;
str[i] = '.';
case 130 : str[i] = ','; break;
case 131 : str[i] = 'F'; break;
case 132 : str[i] = '\"'; break;
case 133 : str[i] = '.'; break;
case 134 : str[i] = '+'; break;
case 135 : str[i] = '+'; break;
case 136 : str[i] = '^'; break;
case 137 : str[i] = 'm'; break;
case 138 : str[i] = 'S'; break;
case 139 : str[i] = '<'; break;
case 140 : str[i] = 'E'; break;
case 142 : str[i] = 'Z'; break;
case 145 : str[i] = '`'; break;
case 146 : str[i] = '\''; break;
case 147 : str[i] = '\"'; break;
case 148 : str[i] = '\"'; break;
case 149 : str[i] = '.'; break;
case 150 : str[i] = '-'; break;
case 151 : str[i] = '-'; break;
case 152 : str[i] = '~'; break;
case 154 : str[i] = 's'; break;
case 155 : str[i] = '>'; break;
case 156 : str[i] = 'e'; break;
case 158 : str[i] = 'z'; break;
case 159 : str[i] = 'Y'; break;
case 171 : str[i] = '<'; break;
case 180 : str[i] = '\''; break;
case 181 : str[i] = 'u'; break;
case 187 : str[i] = '>'; break;
case 191 : str[i] = '\?'; break;
case 192 : str[i] = 'A'; break;
case 193 : str[i] = 'A'; break;
case 194 : str[i] = 'A'; break;
case 195 : str[i] = 'A'; break;
case 196 : str[i] = 'A'; break;
case 197 : str[i] = 'A'; break;
case 198 : str[i] = 'E'; break;
case 199 : str[i] = 'C'; break;
case 200 : str[i] = 'E'; break;
case 201 : str[i] = 'E'; break;
case 202 : str[i] = 'E'; break;
case 203 : str[i] = 'E'; break;
case 204 : str[i] = 'I'; break;
case 205 : str[i] = 'I'; break;
case 206 : str[i] = 'I'; break;
case 207 : str[i] = 'I'; break;
case 208 : str[i] = 'D'; break;
case 209 : str[i] = 'N'; break;
case 210 : str[i] = 'O'; break;
case 211 : str[i] = 'O'; break;
case 212 : str[i] = 'O'; break;
case 213 : str[i] = 'O'; break;
case 214 : str[i] = 'O'; break;
case 215 : str[i] = 'x'; break;
case 216 : str[i] = 'O'; break;
case 217 : str[i] = 'U'; break;
case 218 : str[i] = 'U'; break;
case 219 : str[i] = 'U'; break;
case 220 : str[i] = 'U'; break;
case 221 : str[i] = 'Y'; break;
case 222 : str[i] = 'I'; break;
case 223 : str[i] = 's'; break;
case 224 : str[i] = 'a'; break;
case 225 : str[i] = 'a'; break;
case 226 : str[i] = 'a'; break;
case 227 : str[i] = 'a'; break;
case 228 : str[i] = 'a'; break;
case 229 : str[i] = 'a'; break;
case 230 : str[i] = 'e'; break;
case 231 : str[i] = 'c'; break;
case 232 : str[i] = 'e'; break;
case 233 : str[i] = 'e'; break;
case 234 : str[i] = 'e'; break;
case 235 : str[i] = 'e'; break;
case 236 : str[i] = 'i'; break;
case 237 : str[i] = 'i'; break;
case 238 : str[i] = 'i'; break;
case 239 : str[i] = 'i'; break;
case 240 : str[i] = 'd'; break;
case 241 : str[i] = 'n'; break;
case 242 : str[i] = 'o'; break;
case 243 : str[i] = 'o'; break;
case 244 : str[i] = 'o'; break;
case 245 : str[i] = 'o'; break;
case 246 : str[i] = 'o'; break;
case 247 : str[i] = '-'; break;
case 248 : str[i] = '0'; break;
case 249 : str[i] = 'u'; break;
case 250 : str[i] = 'u'; break;
case 251 : str[i] = 'u'; break;
case 252 : str[i] = 'u'; break;
case 253 : str[i] = 'y'; break;
case 254 : str[i] = 't'; break;
case 255 : str[i] = 'y'; break;
default : str[i] = ' '; break;
continue;
}
str[i] = conv_table[value - 127];
}
}
@ -809,6 +769,24 @@ int utf8_idx(const char *str, int idx)
}
void str_replace_ctrl_chars(char *str, char c)
{
int i;
if(str == NULL) return;
for(i=0; ; i++)
{
if(str[i] == 0) return;
if((((unsigned char *)str)[i] < 32) || (((unsigned char *)str)[i] == 127))
{
str[i] = c;
}
}
}
int antoi(const char *input_str, int len)
{
char str[4096];
@ -1384,7 +1362,7 @@ long long atoll_x(const char *str, int dimension)
int is_integer_number(char *str)
int is_integer_number(const char *str)
{
int i=0, l, hasspace = 0, hassign=0, digit=0;
@ -1430,10 +1408,7 @@ int is_integer_number(char *str)
}
int is_number(char *str)
int is_number(const char *str)
{
int i=0, len, hasspace=0, hassign=0, digit=0, hasdot=0, hasexp=0;
@ -1935,7 +1910,7 @@ double round_down_step125(double val, double *ratio)
int convert_to_metric_suffix(char *dest, double value, int decimals, int sz)
{
double ltmp;
double ftmp;
char suffix=' ';
@ -1943,103 +1918,67 @@ int convert_to_metric_suffix(char *dest, double value, int decimals, int sz)
if(value < 0)
{
ltmp = value * -1;
ftmp = value * -1;
}
else
{
ltmp = value;
ftmp = value;
}
if(ltmp > 0.999999e12 && ltmp < 0.999999e15)
if(ftmp > 0.999999e12 && ftmp < 0.999999e15)
{
ltmp = ltmp / 1e12;
ftmp = ftmp / 1e12;
suffix = 'T';
}
else if(ltmp > 0.999999e9)
else if(ftmp > 0.999999e9)
{
ltmp = ltmp / 1e9;
ftmp = ftmp / 1e9;
suffix = 'G';
}
else if(ltmp > 0.999999e6)
else if(ftmp > 0.999999e6)
{
ltmp = ltmp / 1e6;
ftmp = ftmp / 1e6;
suffix = 'M';
}
else if(ltmp > 0.999999e3)
else if(ftmp > 0.999999e3)
{
ltmp /= 1e3;
ftmp /= 1e3;
suffix = 'K';
}
else if(ltmp > 0.999999e-3 && ltmp < 0.999999)
else if(ftmp > 0.999999e-3 && ftmp < 0.999999)
{
ltmp *= 1e3;
ftmp *= 1e3;
suffix = 'm';
}
else if( ltmp > 0.999999e-6 && ltmp < 0.999999e-3)
else if( ftmp > 0.999999e-6 && ftmp < 0.999999e-3)
{
ltmp *= 1e6;
ftmp *= 1e6;
suffix = 'u';
}
else if(ltmp > 0.999999e-9 && ltmp < 0.999999e-6)
else if(ftmp > 0.999999e-9 && ftmp < 0.999999e-6)
{
ltmp *= 1e9;
ftmp *= 1e9;
suffix = 'n';
}
else if(ltmp > 0.999999e-12 && ltmp < 0.999999e-9)
else if(ftmp > 0.999999e-12 && ftmp < 0.999999e-9)
{
ltmp *= 1e12;
ftmp *= 1e12;
suffix = 'p';
}
if(value >= 0)
{
switch(decimals)
{
case 0: return snprintf(dest, sz, "%.0f%c", ltmp, suffix);
break;
case 1: return snprintf(dest, sz, "%.1f%c", ltmp, suffix);
break;
case 2: return snprintf(dest, sz, "%.2f%c", ltmp, suffix);
break;
case 3: return snprintf(dest, sz, "%.3f%c", ltmp, suffix);
break;
case 4: return snprintf(dest, sz, "%.4f%c", ltmp, suffix);
break;
case 5: return snprintf(dest, sz, "%.5f%c", ltmp, suffix);
break;
case 6: return snprintf(dest, sz, "%.6f%c", ltmp, suffix);
break;
default: return snprintf(dest, sz, "%.3f%c", ltmp, suffix);
break;
}
}
if((decimals < 0) || (decimals > 6)) decimals = 3;
if(value < 0)
{
switch(decimals)
{
case 0: return snprintf(dest, sz, "%.0f%c", ltmp * -1, suffix);
break;
case 1: return snprintf(dest, sz, "%.1f%c", ltmp * -1, suffix);
break;
case 2: return snprintf(dest, sz, "%.2f%c", ltmp * -1, suffix);
break;
default: return snprintf(dest, sz, "%.3f%c", ltmp * -1, suffix);
break;
}
}
if(value < 0) ftmp *=-1;
strlcpy(dest, "0", sz);
return 1;
return snprintf(dest, sz, "%.*f%c", decimals, ftmp, suffix);
}
@ -2097,11 +2036,11 @@ int dblcmp(double val1, double val2)
{
long double diff = (long double)val1 - (long double)val2;
if(diff > 1e-13)
if(diff > 1e-13l)
{
return 1;
}
else if(-diff > 1e-13)
else if(-diff > 1e-13l)
{
return -1;
}
@ -2317,6 +2256,53 @@ int strlcat(char *dst, const char *src, int sz)
#endif
void remove_leading_chars(char *str, int n)
{
int i, len;
if(str == NULL) return;
if(n < 1) return;
len = strlen(str);
if(n >= len)
{
str[0] = 0;
return;
}
for(i=0; i<(len-n); i++)
{
str[i] = str[i + n];
}
str[i] = 0;
}
void remove_trailing_chars(char *str, int n)
{
int len;
if(str == NULL) return;
if(n < 1) return;
len = strlen(str);
if(n >= len)
{
str[0] = 0;
return;
}
str[len - n] = 0;
}
void str_insert_substr(char *str, int pos, int len, const char *substr, int subpos, int sublen)
{
int i, slen;
@ -2456,10 +2442,47 @@ int convert_non_ascii_to_hex(char *dest, const char *src, int destlen)
}
/* returns greatest common divisor */
int t_gcd(int a, int b)
{
if(!a)
{
return b;
}
while(b)
{
if(a > b)
{
a = a - b;
}
else
{
b = b - a;
}
}
return a;
}
/* returns least common multiple */
int t_lcm(int a, int b)
{
return ((a * b) / t_gcd(a, b));
}
void ascii_toupper(char *p)
{
for(; *p; p++)
{
if((*p >= 'a') && (*p <= 'z'))
{
*p -= 32;
}
}
}

31
utils.h
Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2009 - 2021 Teunis van Beelen
* Copyright (C) 2009 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -45,8 +45,11 @@ extern "C" {
void remove_trailing_spaces(char *);
void remove_leading_spaces(char *);
void trim_spaces(char *);
/* removes trailing zero's from one or more occurrences of a decimal fraction in a string */
void remove_trailing_zeros(char *);
void convert_trailing_zeros_to_spaces(char *);
void remove_leading_chars(char *, int);
void remove_trailing_chars(char *, int);
/* Inserts a copy of substr into str. The substring is the portion of substr that begins at */
/* the character position subpos and spans sublen characters (or until the end of substr */
@ -59,12 +62,31 @@ void str_insert_substr(char *str, int pos, int len, const char *substr, int subp
/* Returns the number of substrings replaced. */
int str_replace_substr(char *str, int len, int n, const char *dest_substr, const char *src_substr);
/* converts non-readable non-ascii characters in "<0xhh>" */
/* arguments: destination string, source string, maximum destination length including the terminating null byte */
int convert_non_ascii_to_hex(char *, const char *, int);
void remove_extension_from_filename(char *); /* removes extension including the dot */
int get_filename_from_path(char *dest, const char *src, int size); /* size is size of destination, returns length of filename */
int get_directory_from_path(char *dest, const char *src, int size); /* size is size of destination, returns length of directory */
void get_relative_path_from_absolut_paths(char *dest, const char *src1, const char *src2, int size); /* size is size of destination, dest points to src2 relative to src1 */
void sanitize_path(char *path); /* removes double dot entries */
void sanitize_ascii(char *); /* replaces all non-ascii characters with a dot */
/* replaces all control chars (decimal values < 32 and decimal value == 127 (DEL)) */
/* works also with UTF-8 and Latin-1 */
void str_replace_ctrl_chars(char *, char);
void ascii_toupper(char *);
void latin1_to_ascii(char *, int);
void latin1_to_utf8(char *, int);
void utf8_to_latin1(char *);
int utf8_strlen(const char *); /* returns the number of utf8 characters in the string */
int utf8_idx(const char *, int); /* returns the byte offset of the nth utf8 character */
/* limits the length in bytes of the string while avoiding creating an illegal utf8 character at the end of the string */
/* returns the new byte length */
int utf8_set_byte_len(char *, int);
/* limits the length in utf8 chars of the string */
/* returns the new utf8 char length */
int utf8_set_char_len(char *, int);
int antoi(const char *, int);
int atoi_nonlocalized(const char *);
double atof_nonlocalized(const char *);
@ -85,8 +107,8 @@ int fprint_int_number_nonlocalized(FILE *, int, int, int);
int fprint_ll_number_nonlocalized(FILE *, long long, int, int);
/* returns 1 in case the string is not a number */
int is_integer_number(char *);
int is_number(char *);
int is_integer_number(const char *);
int is_number(const char *);
int round_125_cat(double); /* returns 10, 20 or 50, depending on the value */
@ -111,6 +133,9 @@ int dblcmp(double, double); /* returns 0 when equal */
int base64_dec(const void *, void *, int);
int t_gcd(int, int); /* returns greatest common divisor */
int t_lcm(int, int); /* returns least common multiple */
/* sz is size of destination, returns length of string in dest.
* This is different than the official BSD implementation!
* From the BSD man-page:

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -33,13 +33,7 @@
#include <QApplication>
#include <QObject>
#include <QDialog>
#include <QGridLayout>
#include <QSlider>
#include <QMenuBar>
#include <QMenu>
#include "qt_headers.h"
#include "mainwindow.h"
#include "global.h"

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -91,7 +91,7 @@ void WaveCurve::paintEvent(QPaintEvent *)
}
QPainter paint(this);
#if QT_VERSION >= 0x050000
#if (QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000)
paint.setRenderHint(QPainter::Qt4CompatiblePainting, true);
#endif
@ -882,10 +882,13 @@ void WaveCurve::mouseReleaseEvent(QMouseEvent *release_event)
{
w = width() - (2 * bordersize);
h = height() - (2 * bordersize);
#if QT_VERSION < 0x060000
mouse_x = release_event->x() - bordersize;
mouse_y = release_event->y() - bordersize;
#else
mouse_x = release_event->position().x() - bordersize;
mouse_y = release_event->position().y() - bordersize;
#endif
if(devparms == NULL)
{
return;
@ -904,10 +907,13 @@ void WaveCurve::mouseMoveEvent(QMouseEvent *move_event)
{
return;
}
#if QT_VERSION < 0x060000
mouse_x = move_event->x() - bordersize;
mouse_y = move_event->y() - bordersize;
#else
mouse_x = move_event->position().x() - bordersize;
mouse_y = move_event->position().y() - bordersize;
#endif
if(devparms == NULL)
{
return;

Wyświetl plik

@ -3,7 +3,7 @@
*
* Author: Teunis van Beelen
*
* Copyright (C) 2016 - 2021 Teunis van Beelen
* Copyright (C) 2016 - 2023 Teunis van Beelen
*
* Email: teuniz@protonmail.com
*
@ -31,16 +31,7 @@
#define WAVECURVE_H
#include <QtGlobal>
#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPushButton>
#include <QPen>
#include <QString>
#include <QStringList>
#include <QFont>
#include "qt_headers.h"
#include <stdio.h>
#include <stdlib.h>