mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 20:45:47 +00:00
Remove Qt < 5.2 conditionals and special code
We require Qt 5.2 at least for LyX 2.4
This commit is contained in:
parent
008e1cc963
commit
5c8e3a5f0d
@ -15,10 +15,6 @@
|
|||||||
|
|
||||||
#include "FancyLineEdit.h"
|
#include "FancyLineEdit.h"
|
||||||
|
|
||||||
#if QT_VERSION < 0x050200
|
|
||||||
#include "GuiApplication.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -1028,10 +1028,7 @@ public:
|
|||||||
struct GuiApplication::Private
|
struct GuiApplication::Private
|
||||||
{
|
{
|
||||||
Private(): language_model_(nullptr), meta_fake_bit(NoModifier),
|
Private(): language_model_(nullptr), meta_fake_bit(NoModifier),
|
||||||
global_menubar_(nullptr)
|
global_menubar_(nullptr), last_state_(Qt::ApplicationInactive)
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
|
|
||||||
, last_state_(Qt::ApplicationInactive)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= 0x050400)
|
#if (QT_VERSION >= 0x050400)
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
@ -1112,10 +1109,8 @@ struct GuiApplication::Private
|
|||||||
|
|
||||||
/// Only used on mac.
|
/// Only used on mac.
|
||||||
QMenuBar * global_menubar_;
|
QMenuBar * global_menubar_;
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
|
|
||||||
/// Holds previous application state on Mac
|
/// Holds previous application state on Mac
|
||||||
Qt::ApplicationState last_state_;
|
Qt::ApplicationState last_state_;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
|
||||||
/// Linkback mime handler for MacOSX.
|
/// Linkback mime handler for MacOSX.
|
||||||
@ -1156,7 +1151,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
QCoreApplication::setOrganizationName(app_name);
|
QCoreApplication::setOrganizationName(app_name);
|
||||||
QCoreApplication::setOrganizationDomain("lyx.org");
|
QCoreApplication::setOrganizationDomain("lyx.org");
|
||||||
QCoreApplication::setApplicationName(lyx_package);
|
QCoreApplication::setApplicationName(lyx_package);
|
||||||
#if QT_VERSION >= 0x050100 && QT_VERSION < 0x060000
|
#if QT_VERSION < 0x060000
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1195,11 +1190,9 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
setupApplescript();
|
setupApplescript();
|
||||||
appleCleanupEditMenu();
|
appleCleanupEditMenu();
|
||||||
appleCleanupViewMenu();
|
appleCleanupViewMenu();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
|
|
||||||
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
|
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
|
||||||
this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(QPA_XCB)
|
#if defined(QPA_XCB)
|
||||||
// doubleClickInterval() is 400 ms on X11 which is just too long.
|
// doubleClickInterval() is 400 ms on X11 which is just too long.
|
||||||
@ -2954,11 +2947,7 @@ namespace {
|
|||||||
|
|
||||||
QFont const GuiApplication::typewriterSystemFont()
|
QFont const GuiApplication::typewriterSystemFont()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050200
|
|
||||||
QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
#else
|
|
||||||
QFont font("monospace");
|
|
||||||
#endif
|
|
||||||
if (!isFixedPitch(font)) {
|
if (!isFixedPitch(font)) {
|
||||||
// try to enforce a real monospaced font
|
// try to enforce a real monospaced font
|
||||||
font.setStyleHint(QFont::Monospace);
|
font.setStyleHint(QFont::Monospace);
|
||||||
@ -3452,7 +3441,6 @@ void GuiApplication::onLastWindowClosed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
|
|
||||||
void GuiApplication::onApplicationStateChanged(Qt::ApplicationState state)
|
void GuiApplication::onApplicationStateChanged(Qt::ApplicationState state)
|
||||||
{
|
{
|
||||||
std::string name = "unknown";
|
std::string name = "unknown";
|
||||||
@ -3479,7 +3467,6 @@ void GuiApplication::onApplicationStateChanged(Qt::ApplicationState state)
|
|||||||
LYXERR(Debug::GUI, "onApplicationStateChanged..." << name);
|
LYXERR(Debug::GUI, "onApplicationStateChanged..." << name);
|
||||||
d->last_state_ = state;
|
d->last_state_ = state;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void GuiApplication::startLongOperation() {
|
void GuiApplication::startLongOperation() {
|
||||||
|
@ -226,9 +226,7 @@ private Q_SLOTS:
|
|||||||
///
|
///
|
||||||
void slotProcessFuncRequestQueue() { processFuncRequestQueue(); }
|
void slotProcessFuncRequestQueue() { processFuncRequestQueue(); }
|
||||||
///
|
///
|
||||||
#if (QT_VERSION >= 0x050100)
|
|
||||||
void onApplicationStateChanged(Qt::ApplicationState state);
|
void onApplicationStateChanged(Qt::ApplicationState state);
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -30,11 +30,7 @@
|
|||||||
#include <QRawFont>
|
#include <QRawFont>
|
||||||
#include <QtEndian>
|
#include <QtEndian>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050100
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#else
|
|
||||||
#define qDegreesToRadians(degree) (degree) * (M_PI / 180)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
|
@ -32,22 +32,6 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
// This dialog is only a fallback for Qt < 5.2, which does not feature
|
|
||||||
// QMessageBox::setCheckBox() yet. Note that it has issues with line
|
|
||||||
// breaking and size, in particular with html.
|
|
||||||
#if QT_VERSION < 0x050200
|
|
||||||
class GuiToggleWarningDialog : public QDialog, public Ui::ToggleWarningUi
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GuiToggleWarningDialog(QWidget * parent) : QDialog(parent)
|
|
||||||
{
|
|
||||||
Ui::ToggleWarningUi::setupUi(this);
|
|
||||||
QDialog::setModal(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
GuiProgress::GuiProgress()
|
GuiProgress::GuiProgress()
|
||||||
{
|
{
|
||||||
connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &)));
|
connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &)));
|
||||||
@ -174,21 +158,6 @@ void GuiProgress::doToggleWarning(QString const & title, QString const & msg, QS
|
|||||||
if (settings.value("hidden_warnings/" + msg, false).toBool())
|
if (settings.value("hidden_warnings/" + msg, false).toBool())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Qt < 5.2 does not feature QMessageBox::setCheckBox() yet,
|
|
||||||
// so we roll our own dialog.
|
|
||||||
#if QT_VERSION < 0x050200
|
|
||||||
GuiToggleWarningDialog * dlg =
|
|
||||||
new GuiToggleWarningDialog(qApp->focusWidget());
|
|
||||||
|
|
||||||
dlg->setWindowTitle(title);
|
|
||||||
dlg->messageLA->setText(formatted);
|
|
||||||
dlg->dontShowAgainCB->setChecked(false);
|
|
||||||
|
|
||||||
if (dlg->exec() == QDialog::Accepted)
|
|
||||||
if (dlg->dontShowAgainCB->isChecked())
|
|
||||||
settings.setValue("hidden_warnings/"
|
|
||||||
+ msg, true);
|
|
||||||
#else
|
|
||||||
QCheckBox * dontShowAgainCB = new QCheckBox();
|
QCheckBox * dontShowAgainCB = new QCheckBox();
|
||||||
dontShowAgainCB->setText(qt_("&Do not show this warning again!"));
|
dontShowAgainCB->setText(qt_("&Do not show this warning again!"));
|
||||||
dontShowAgainCB->setToolTip(qt_("If you check this, LyX will not warn you again in the given case."));
|
dontShowAgainCB->setToolTip(qt_("If you check this, LyX will not warn you again in the given case."));
|
||||||
@ -199,7 +168,6 @@ void GuiProgress::doToggleWarning(QString const & title, QString const & msg, QS
|
|||||||
if (dontShowAgainCB->isChecked())
|
if (dontShowAgainCB->isChecked())
|
||||||
settings.setValue("hidden_warnings/"
|
settings.setValue("hidden_warnings/"
|
||||||
+ msg, true);
|
+ msg, true);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1122,11 +1122,9 @@ void GuiView::updateLockToolbars()
|
|||||||
if (tb && tb->isMovable())
|
if (tb && tb->isMovable())
|
||||||
toolbarsMovable_ = true;
|
toolbarsMovable_ = true;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= 0x050200
|
|
||||||
// set unified mac toolbars only when not movable as recommended:
|
// set unified mac toolbars only when not movable as recommended:
|
||||||
// https://doc.qt.io/qt-5/qmainwindow.html#unifiedTitleAndToolBarOnMac-prop
|
// https://doc.qt.io/qt-5/qmainwindow.html#unifiedTitleAndToolBarOnMac-prop
|
||||||
setUnifiedTitleAndToolBarOnMac(!toolbarsMovable_);
|
setUnifiedTitleAndToolBarOnMac(!toolbarsMovable_);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1503,11 +1503,9 @@ TabWorkArea::TabWorkArea(QWidget * parent)
|
|||||||
|
|
||||||
QObject::connect(this, SIGNAL(currentChanged(int)),
|
QObject::connect(this, SIGNAL(currentChanged(int)),
|
||||||
this, SLOT(on_currentTabChanged(int)));
|
this, SLOT(on_currentTabChanged(int)));
|
||||||
#if QT_VERSION >= 0x050200
|
|
||||||
// Fix for #11835
|
// Fix for #11835
|
||||||
QObject::connect(this, SIGNAL(tabBarClicked(int)),
|
QObject::connect(this, SIGNAL(tabBarClicked(int)),
|
||||||
this, SLOT(on_currentTabChanged(int)));
|
this, SLOT(on_currentTabChanged(int)));
|
||||||
#endif
|
|
||||||
|
|
||||||
closeBufferButton = new QToolButton(this);
|
closeBufferButton = new QToolButton(this);
|
||||||
closeBufferButton->setPalette(pal);
|
closeBufferButton->setPalette(pal);
|
||||||
|
@ -351,7 +351,6 @@ UIFILES = \
|
|||||||
TextLayoutUi.ui \
|
TextLayoutUi.ui \
|
||||||
ThesaurusUi.ui \
|
ThesaurusUi.ui \
|
||||||
TocUi.ui \
|
TocUi.ui \
|
||||||
ToggleWarningUi.ui \
|
|
||||||
ViewSourceUi.ui \
|
ViewSourceUi.ui \
|
||||||
VSpaceUi.ui \
|
VSpaceUi.ui \
|
||||||
WorkAreaUi.ui \
|
WorkAreaUi.ui \
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ToggleWarningUi</class>
|
|
||||||
<widget class="QDialog" name="ToggleWarningUi">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>269</width>
|
|
||||||
<height>140</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Enter text</string>
|
|
||||||
</property>
|
|
||||||
<property name="sizeGripEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>247</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="messageLA">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>247</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="dontShowAgainCB">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>If you check this, LyX will not warn you again in the given case.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Do not show this warning again!</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<includes>
|
|
||||||
<include location="local">qt_i18n.h</include>
|
|
||||||
</includes>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>ToggleWarningUi</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>98</x>
|
|
||||||
<y>114</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>80</x>
|
|
||||||
<y>805</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
Loading…
Reference in New Issue
Block a user