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

Fix building with Qt4 #113

Merged
merged 3 commits into from
Aug 16, 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
5 changes: 3 additions & 2 deletions plugins/terminal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ set (terminal_UI preferences.ui)
if (USE_QT5)
find_package ( QTermWidget5 REQUIRED )
qt5_wrap_ui(terminal_UI_SRC ${terminal_UI})
set(qtermwidget_lib "qtermwidget5")
else (USE_QT5)
find_package ( QTermWidget4 REQUIRED )
qt4_wrap_ui(terminal_UI_SRC ${terminal_UI})
set(qtermwidget_lib "qtermwidget4")
endif (USE_QT5)

add_library(terminal SHARED ${terminal_SRC} ${terminal_MOC} ${terminal_UI_SRC})
target_link_libraries(terminal ${JUFFED_LIBRARY} qtermwidget5)
target_link_libraries(terminal ${JUFFED_LIBRARY} ${qtermwidget_lib})
install(TARGETS terminal DESTINATION ${JUFFED_PLUGINS_DIR})

7 changes: 5 additions & 2 deletions plugins/terminal/TerminalPlugin.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#include "TerminalPlugin.h"

#include <QtGlobal>
#include <QtCore>
#include <QAction>
#include <QWidget>

#include <Log.h>
#include <PluginSettings.h>

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qtermwidget5/qtermwidget.h>

#else
#include <qtermwidget4/qtermwidget.h>
#endif

Preferences::Preferences(const QObject *parent,
const QString &color,
Expand Down Expand Up @@ -39,7 +43,6 @@ Preferences::Preferences(const QObject *parent,
parent, SLOT(fontSizeChanged(int)));
}


TerminalPlugin::TerminalPlugin() : QObject(), JuffPlugin() {
w_ = new QTermWidget();
w_->setScrollBarPosition(QTermWidget::ScrollBarRight);
Expand Down
13 changes: 9 additions & 4 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "MainSettings.h"
#include "Settings.h"

#include <QtGlobal>
#include <QDir>
#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -134,25 +135,27 @@ bool hasValidDoubleDashParam( const QCoreApplication& app ) {
return true;
}
}

return false;
}

int runSingle(int argc, char* argv[]) {
QtSingleApplication app(argc, argv);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
initApp(app);

if ( hasValidDoubleDashParam( app ) ) {
return 0;
}

// check if instance already exists
QStringList fileList;
foreach (QString param, app.arguments()) {
fileList << QFileInfo(param).absoluteFilePath();
}

if ( app.sendMessage(fileList.join("\n")) )
return 0;

Expand All @@ -169,13 +172,15 @@ int runSingle(int argc, char* argv[]) {

int runNotSingle(int argc, char* argv[]) {
QApplication app(argc, argv);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
initApp(app);

if ( hasValidDoubleDashParam( app ) ) {
return 0;
}

JuffEd juffed;

juffed.mainWindow()->show();
Expand Down
Loading