From 48130c24c2e83f277617c482d4a31bf29ab260b8 Mon Sep 17 00:00:00 2001 From: Quentin Bramas Date: Fri, 25 Sep 2015 10:06:35 +0200 Subject: [PATCH] remove qt5 dependencies --- .travis.yml | 8 +++----- source/texiteasy.pro | 2 +- source/widgetstatusbar.cpp | 26 ++++++++++++++++++++------ source/widgetstatusbar.h | 27 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84c7b03..7f2f8de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,9 @@ compiler: - clang before_install: - - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa - - sudo apt-get update -qq - - sudo apt-get install -qq qtbase5-dev qt5-qmake qtbase5-dev-tools libpoppler-qt5-dev zlib1g-dev libqt5xml5 libqt5network5 libqt5sql5 libqt5script5 -script: + - sudo apt-get update + - sudo apt-get install libqt4-dev qt4-qmake libpoppler-qt4-dev zlib1g-dev script: - cd source - - qmake -qt=qt5 texiteasy.pro + - qmake texiteasy.pro - make -j 4 diff --git a/source/texiteasy.pro b/source/texiteasy.pro index 1ae4dcb..305fe85 100644 --- a/source/texiteasy.pro +++ b/source/texiteasy.pro @@ -17,7 +17,7 @@ VERSION = \\\"'0.21.3'\\\" VERSION_HEX = 0x002103 CONFIG += c++11 -#QMAKE_CXXFLAGS += -std=c++0x +QMAKE_CXXFLAGS += -std=c++0x #DEFINES += PORTABLE_EXECUTABLE diff --git a/source/widgetstatusbar.cpp b/source/widgetstatusbar.cpp index 903fc56..22432b4 100644 --- a/source/widgetstatusbar.cpp +++ b/source/widgetstatusbar.cpp @@ -214,6 +214,11 @@ void WidgetStatusBar::checkStructAction() } } + + + + + void WidgetStatusBar::updateButtons() { if(!FileManager::Instance.currentWidgetFile()) @@ -238,24 +243,33 @@ void WidgetStatusBar::updateButtons() OutputPaneToggleButton *button = new OutputPaneToggleButton(index, pane->statusbarText(), pane->action()); - /*QPushButton * button = new QPushButton(//QString("
"+ - pane->statusbarText()//+"
" - ); - */ + if(widget->isPaneOpen(pane)) { button->setChecked(true); } + pane->action()->disconnect(); this->insertPermanentWidget(index, button, 0); _paneLabels << button; + +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + Qt4PaneCallback * c = new Qt4PaneCallback(); + c->pane = pane; + c->widget = widget; + c->button = button; + + connect(button, SIGNAL(clicked(bool)), c, SLOT(onButtonClicked(bool))); + connect(pane->action(), SIGNAL(toggled(bool)), c, SLOT(onPaneactionToggled(bool))); + connect(pane->action(), SIGNAL(triggered(bool)), c, SLOT(onPaneactionToggled(bool))); + +#else connect(button, &OutputPaneToggleButton::clicked, [=](){ widget->togglePane(pane); }); connect(pane->action(), &QAction::toggled, [=](){ button->setChecked(pane->action()->isChecked()); }); connect(pane->action(), &QAction::triggered, [=](bool checked){ button->setChecked(checked); }); +#endif ++index; } diff --git a/source/widgetstatusbar.h b/source/widgetstatusbar.h index 46efeee..256fdae 100644 --- a/source/widgetstatusbar.h +++ b/source/widgetstatusbar.h @@ -7,6 +7,8 @@ #include #include +#include "widgetfile.h" + namespace Ui { class WidgetStatusBar; } @@ -14,6 +16,11 @@ class QToolButton; class QSplitter; class QPixmap; class QAction; +class IPane; + + + + class WidgetStatusBarButton : public QWidget { @@ -169,4 +176,24 @@ private slots: bool _errorTableOpen, _consoleOpen; }; + + + +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + +class Qt4PaneCallback : public QObject +{ + Q_OBJECT + +public: + OutputPaneToggleButton *button; + IPane * pane; + WidgetFile * widget; + +public slots: + void onButtonClicked(bool) { widget->togglePane(pane); } + void onPaneactionToggled(bool checked) { button->setChecked(checked); } +}; +#endif + #endif // WIDGETSTATUSBAR_H