Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Qt Gui/Widgets dependency from qdlt library. #447

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion qdlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ target_include_directories(qdlt PUBLIC
target_link_libraries(qdlt PUBLIC
${QT_PREFIX}::Core
${QT_PREFIX}::Network
${QT_PREFIX}::Widgets
${QT_PREFIX}::SerialPort)

if(WIN32)
Expand Down
2 changes: 0 additions & 2 deletions qdlt/export_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# endif
#endif

#define USECOLOR yes // use QColor class in qdlt, without the automarking of messages does not work

#define QT_5_SUPPORTED_VERSION (QT_VERSION_MAJOR == 5 && QT_VERSION_MINOR >= 14) || (QT_VERSION_MAJOR >= 6)

#endif // EXPORT_RULES_H
3 changes: 2 additions & 1 deletion qdlt/plugininterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
#include "qdltmsg.h"

#include <QString>
#include <QTableView>

#define PLUGIN_INTERFACE_VERSION "1.0.1"

class QTableView;

//! Standard DLT Viewer Plugin Interface.
/*!
This is the standard DLT Viewer Plugin Interface.
Expand Down
15 changes: 0 additions & 15 deletions qdlt/qdlt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,15 @@ DEFINES += QDLT_LIBRARY
QMAKE_CFLAGS += -std=gnu99
QMAKE_CFLAGS += -Wall
QMAKE_CFLAGS += -Wextra
#QMAKE_CFLAGS += -pedantic
}

*-g++* {
QMAKE_CXXFLAGS += -std=gnu++0x
QMAKE_CXXFLAGS += -Wall
QMAKE_CXXFLAGS += -Wextra
QMAKE_CXXFLAGS += -DPLUGIN_INSTALLATION_PATH=\\\"$$PREFIX/usr/share/dlt-viewer/plugins\\\"
#QMAKE_CXXFLAGS += -pedantic
}

# Uncomment to add debug symbols to Release build
#QMAKE_CXXFLAGS_RELEASE += -g
#QMAKE_CFLAGS_RELEASE += -g
#QMAKE_LFLAGS_RELEASE =

unix:DEFINES += BYTE_ORDER=LITTLE_ENDIAN _TTY_POSIX_ QT_VIEWER
win32:DEFINES += BYTE_ORDER=LITTLE_ENDIAN QT_VIEWER

Expand All @@ -37,16 +30,8 @@ INSTALLS += target

CONFIG += warn_on qt
QT += network
QT += gui
QT += serialport

# Detect QT5 and comply to new Widgets hierarchy
greaterThan(QT_VERSION, 4.8.4) {
QT += widgets
INCLUDEPATH += QtWidgets
win32:DEFINES += QT5_QT6_COMPAT
}

# Put intermediate files in the build directory
MOC_DIR = build/moc
OBJECTS_DIR = build/obj
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltargument.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <QVariant>
#include <time.h>
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltdefaultfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>
#include <QXmlStreamReader>
Expand Down
3 changes: 0 additions & 3 deletions qdlt/qdltfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
#ifdef USECOLOR
#include <QColor>
#endif
#include <QMutex>
#include <time.h>
#include <QCache>
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>
#include <QXmlStreamReader>
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltfilterindex.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
3 changes: 0 additions & 3 deletions qdlt/qdltfilterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
#ifdef USECOLOR
#include <QColor>
#endif
#include <QMutex>
#include <time.h>
#include <QXmlStreamReader>
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltipconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
2 changes: 1 addition & 1 deletion qdlt/qdltplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <QDir>
#include <QCoreApplication>
#include <QTableView>
//#include <QTableView>

#include <QPluginLoader>

Expand Down
31 changes: 23 additions & 8 deletions qdlt/qdltsettingsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
* @licence end@
*/

#include <QApplication>
//#include <QApplication>
#include <QDir>
#include <QMessageBox>
//#include <QMessageBox>
#include <QDateTime>
#include <QStandardPaths>

Expand Down Expand Up @@ -67,10 +67,11 @@ QDltSettingsManager::QDltSettingsManager()
if(!dir.mkpath(dir.absolutePath()))
{
/* creation of directory fails */
QMessageBox::critical(0, QString("DLT Viewer"),
/* QMessageBox::critical(0, QString("DLT Viewer"),
QString("Cannot create directory to store configuration!\n\n")+dir.absolutePath(),
QMessageBox::Ok,
QMessageBox::Ok);
*/
}
}

Expand Down Expand Up @@ -130,7 +131,9 @@ void QDltSettingsManager::writeSettingsLocal(QXmlStreamWriter &xml)
xml.writeTextElement("showPayload",QString("%1").arg(showPayload));
xml.writeTextElement("showArguments",QString("%1").arg(showArguments));
xml.writeTextElement("showMsgId",QString("%1").arg(showMsgId));
xml.writeTextElement("markercolor",QString("%1").arg(markercolor.name()));
xml.writeTextElement("markercolorRed",QString("%1").arg(markercolorRed));
xml.writeTextElement("markercolorGreen",QString("%1").arg(markercolorGreen));
xml.writeTextElement("markercolorBlue",QString("%1").arg(markercolorBlue));
xml.writeEndElement(); // table

xml.writeStartElement("other");
Expand Down Expand Up @@ -192,7 +195,9 @@ void QDltSettingsManager::writeSettings()
settings->setValue("startup/splitfileyesno",splitlogfile);
settings->setValue("startup/maxFileSizeMB",fmaxFileSizeMB);
settings->setValue("startup/appendDateTime",appendDateTime);
settings->setValue("startup/markercolor",markercolor.name());
settings->setValue("startup/markercolorRed",markercolorRed);
settings->setValue("startup/markercolorGreen",markercolorGreen);
settings->setValue("startup/markercolorBlue",markercolorBlue);

/* table */
settings->setValue("startup/fontSize",fontSize);
Expand Down Expand Up @@ -365,9 +370,17 @@ void QDltSettingsManager::readSettingsLocal(QXmlStreamReader &xml)
{
loggingOnlyFilteredMessages = xml.readElementText().toInt();
}
if(xml.name() == QString("markercolor"))
if(xml.name() == QString("markercolorRed"))
{
markercolor.setNamedColor(xml.readElementText());
markercolorRed = xml.readElementText().toInt();
}
if(xml.name() == QString("markercolorGreen"))
{
markercolorGreen = xml.readElementText().toInt();
}
if(xml.name() == QString("markercolorBlue"))
{
markercolorBlue = xml.readElementText().toInt();
}
if(xml.name() == QString("updateContextLoadingFile"))
{
Expand Down Expand Up @@ -442,7 +455,9 @@ void QDltSettingsManager::readSettings()
splitlogfile = settings->value("startup/splitfileyesno",0).toInt();
fmaxFileSizeMB = settings->value("startup/maxFileSizeMB",100).toFloat();
appendDateTime = settings->value("startup/appendDateTime",0).toInt();
markercolor.setNamedColor(settings->value("startup/markercolor","#aaaaaa").toString() );
markercolorRed = settings->value("startup/markercolorRed",128).toInt();
markercolorGreen = settings->value("startup/markercolorGreen",128).toInt();
markercolorBlue = settings->value("startup/markercolorBlue",128).toInt();

/* project table */
fontSize = settings->value("startup/fontSize",8).toInt();
Expand Down
3 changes: 1 addition & 2 deletions qdlt/qdltsettingsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#ifndef QDLTSETTINGSMANAGER_H
#define QDLTSETTINGSMANAGER_H

#include <QColor>
#include <qsettings.h>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
Expand Down Expand Up @@ -89,7 +88,7 @@ class QDLT_EXPORT QDltSettingsManager
UI_Colour uiColour; // local settings
quint64 msgCacheSize; // local settings

QColor markercolor; // local and project setting
int markercolorRed,markercolorGreen,markercolorBlue; // local and project setting
int autoConnect; // project and local setting
int autoScroll; // project and local setting
int autoMarkFatalError; // local and local setting
Expand Down
1 change: 0 additions & 1 deletion qdlt/qdlttcpconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
1 change: 0 additions & 1 deletion qdlt/qdltudpconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <QString>
#include <QFile>
#include <QDateTime>
//#include <QColor>
#include <QMutex>
#include <time.h>

Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,14 +1458,14 @@ void MainWindow::mark_unmark_lines()
}
}
//qDebug() << selectedMarkerRows;
model->setManualMarker(selectedMarkerRows, settings->markercolor); //used in mainwindow
model->setManualMarker(selectedMarkerRows, QColor(settings->markercolorRed,settings->markercolorGreen,settings->markercolorBlue)); //used in mainwindow
}

void MainWindow::unmark_all_lines()
{
TableModel *model = qobject_cast<TableModel *>(ui->tableView->model());
selectedMarkerRows.clear();
model->setManualMarker(selectedMarkerRows, settings->markercolor); //used in mainwindow
model->setManualMarker(selectedMarkerRows, QColor(settings->markercolorRed,settings->markercolorGreen,settings->markercolorBlue)); //used in mainwindow
}


Expand Down
6 changes: 4 additions & 2 deletions src/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ void SettingsDialog::readSettings()
settings->readSettings();

QPalette palette = ui->labelSelectedMarkerColor->palette();
palette.setColor(QPalette::Active,this->backgroundRole(),settings->markercolor);
palette.setColor(QPalette::Active,this->backgroundRole(),QColor(settings->markercolorRed,settings->markercolorGreen,settings->markercolorBlue));
ui->labelSelectedMarkerColor->setPalette(palette);

auto uiColour = settings->themeSelectionSettings;
Expand Down Expand Up @@ -706,7 +706,9 @@ void SettingsDialog::on_pushButtonMarkerColor_clicked()
if(selectedcolor.isValid())
{
QDltSettingsManager *settings = QDltSettingsManager::getInstance();
settings->markercolor = selectedcolor;
settings->markercolorRed = selectedcolor.red();
settings->markercolorGreen = selectedcolor.green();
settings->markercolorBlue = selectedcolor.blue();
}
}

Expand Down
Loading