mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Get rid of Qt4 code in src/
Qt4 code has been identidifed by git grep -l 'QT_VERSION.*\(0x050000\|0x04\)' src Uses of QT_VERSION_CHECK have been checked too. been used to remember what places need further work. Then remaining Qt4 references have been searched using git grep -i qt4 git grep -i 'qt 4' and relevant issues have been either fixed or noted in the new TODO.killqt4 file.
This commit is contained in:
parent
d984730235
commit
ac248e392d
16
TODO.killqt4
Normal file
16
TODO.killqt4
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Things left to do after killing Qt4 (obtained by grepping for Qt4 and 'Qt 4'):
|
||||||
|
* look at the FIXME KILLQT4 comments in src/ and resolve them
|
||||||
|
* update README
|
||||||
|
* update INSTALL
|
||||||
|
* update INSTALL.cmake
|
||||||
|
* update INSTALL.MacOSX
|
||||||
|
* update autoconf
|
||||||
|
see also lib/RELEASE-NOTES
|
||||||
|
* update cmake
|
||||||
|
* check whether development/autotests/keytest.py really needs QT4
|
||||||
|
investigate references to Qt4 in keytest
|
||||||
|
* update or remove development/lyx.rpm.README
|
||||||
|
* update or remove development/lyxserver/server_monitor.cpp
|
||||||
|
* update or remove development/tools/count_total_lines_of_compiled_code.sh
|
||||||
|
* check references to qt4 in lib/symbols
|
||||||
|
|
@ -19,8 +19,6 @@
|
|||||||
#include "GuiApplication.h"
|
#include "GuiApplication.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040600
|
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -33,9 +31,7 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#endif
|
|
||||||
|
|
||||||
enum { margin = 6 };
|
enum { margin = 6 };
|
||||||
|
|
||||||
@ -198,10 +194,8 @@ void FancyLineEdit::updateMargins()
|
|||||||
Side realRight = (leftToRight ? Right : Left);
|
Side realRight = (leftToRight ? Right : Left);
|
||||||
|
|
||||||
qreal dpr = 1.0;
|
qreal dpr = 1.0;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Consider device/pixel ratio (HiDPI)
|
// Consider device/pixel ratio (HiDPI)
|
||||||
dpr = devicePixelRatio();
|
dpr = devicePixelRatio();
|
||||||
#endif
|
|
||||||
int leftMargin = (m_d->m_iconbutton[realLeft]->pixmap().width() / dpr ) + 8;
|
int leftMargin = (m_d->m_iconbutton[realLeft]->pixmap().width() / dpr ) + 8;
|
||||||
int rightMargin = (m_d->m_iconbutton[realRight]->pixmap().width() / dpr) + 8;
|
int rightMargin = (m_d->m_iconbutton[realRight]->pixmap().width() / dpr) + 8;
|
||||||
// Note KDE does not reserve space for the highlight color
|
// Note KDE does not reserve space for the highlight color
|
||||||
@ -342,12 +336,9 @@ IconButton::IconButton(QWidget *parent)
|
|||||||
|
|
||||||
void IconButton::paintEvent(QPaintEvent *)
|
void IconButton::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
qreal dpr = 1.0;
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Consider device/pixel ratio (HiDPI)
|
// Consider device/pixel ratio (HiDPI)
|
||||||
QWindow * window = this->window()->windowHandle();
|
QWindow * window = this->window()->windowHandle();
|
||||||
dpr = window->devicePixelRatio();
|
qreal const dpr = window->devicePixelRatio();
|
||||||
#endif
|
|
||||||
QRect pixmapRect(QPoint(), m_pixmap.size() / dpr);
|
QRect pixmapRect(QPoint(), m_pixmap.size() / dpr);
|
||||||
pixmapRect.moveCenter(rect().center());
|
pixmapRect.moveCenter(rect().center());
|
||||||
QPixmap pm = m_pixmap;
|
QPixmap pm = m_pixmap;
|
||||||
@ -381,6 +372,4 @@ void IconButton::animateShow(bool visible)
|
|||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // QT_VERSION >= 0x040600
|
|
||||||
|
|
||||||
#include "moc_FancyLineEdit.cpp"
|
#include "moc_FancyLineEdit.cpp"
|
||||||
|
@ -135,13 +135,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000) || (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)
|
||||||
#if (QT_VERSION < 0x050000)
|
#if (QT_VERSION >= 0x060000)
|
||||||
#include <QWindowsMime>
|
|
||||||
#define QWINDOWSMIME QWindowsMime
|
|
||||||
#define QVARIANTTYPE QVariant::Type
|
|
||||||
#elif (QT_VERSION >= 0x060000)
|
|
||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include <QtGui/private/qwindowsmime_p.h>
|
#include <QtGui/private/qwindowsmime_p.h>
|
||||||
#include <QtGui/qpa/qplatformintegration.h>
|
#include <QtGui/qpa/qplatformintegration.h>
|
||||||
@ -719,7 +715,6 @@ QPixmap getPixmap(QString const & path, QString const & name, QString const & ex
|
|||||||
|
|
||||||
QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
|
QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= 0x040600)
|
|
||||||
if (lyxrc.use_system_theme_icons) {
|
if (lyxrc.use_system_theme_icons) {
|
||||||
// use the icons from system theme that are available
|
// use the icons from system theme that are available
|
||||||
QString action = toqstr(lyxaction.getActionName(f.action()));
|
QString action = toqstr(lyxaction.getActionName(f.action()));
|
||||||
@ -732,7 +727,6 @@ QIcon getIcon(FuncRequest const & f, bool unknown, bool rtl)
|
|||||||
return thmicn;
|
return thmicn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
IconInfo icondata = iconInfo(f, unknown, rtl);
|
IconInfo icondata = iconInfo(f, unknown, rtl);
|
||||||
if (icondata.filepath.isEmpty())
|
if (icondata.filepath.isEmpty())
|
||||||
@ -784,11 +778,7 @@ public:
|
|||||||
|
|
||||||
QString translate(const char * /* context */,
|
QString translate(const char * /* context */,
|
||||||
const char *sourceText,
|
const char *sourceText,
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
const char * /* disambiguation */ = nullptr, int /* n */ = -1) const override
|
const char * /* disambiguation */ = nullptr, int /* n */ = -1) const override
|
||||||
#else
|
|
||||||
const char * /*comment*/ = 0) const override
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Here we declare the strings that need to be translated from Qt own GUI
|
// Here we declare the strings that need to be translated from Qt own GUI
|
||||||
// This is needed to include these strings to po files
|
// This is needed to include these strings to po files
|
||||||
@ -879,7 +869,7 @@ public:
|
|||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Windows specific stuff goes here...
|
// Windows specific stuff goes here...
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000) || (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)
|
||||||
// QWindowsMimeMetafile can only be compiled on Windows.
|
// QWindowsMimeMetafile can only be compiled on Windows.
|
||||||
|
|
||||||
@ -1045,7 +1035,7 @@ struct GuiApplication::Private
|
|||||||
, last_state_(Qt::ApplicationInactive)
|
, last_state_(Qt::ApplicationInactive)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if (QT_VERSION < 0x050000) || (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)
|
||||||
/// WMF Mime handler for Windows clipboard.
|
/// WMF Mime handler for Windows clipboard.
|
||||||
wmf_mime_ = new QWindowsMimeMetafile;
|
wmf_mime_ = new QWindowsMimeMetafile;
|
||||||
@ -1134,7 +1124,7 @@ struct GuiApplication::Private
|
|||||||
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
|
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000) || (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)
|
||||||
/// WMF Mime handler for Windows clipboard.
|
/// WMF Mime handler for Windows clipboard.
|
||||||
QWindowsMimeMetafile * wmf_mime_;
|
QWindowsMimeMetafile * wmf_mime_;
|
||||||
@ -1239,11 +1229,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
if (lyxrc.typewriter_font_name.empty())
|
if (lyxrc.typewriter_font_name.empty())
|
||||||
lyxrc.typewriter_font_name = fromqstr(typewriterFontName());
|
lyxrc.typewriter_font_name = fromqstr(typewriterFontName());
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x050000)
|
|
||||||
// Qt4 does this in event(), see below.
|
|
||||||
// Track change of keyboard
|
// Track change of keyboard
|
||||||
connect(inputMethod(), SIGNAL(localeChanged()), this, SLOT(onLocaleChanged()));
|
connect(inputMethod(), SIGNAL(localeChanged()), this, SLOT(onLocaleChanged()));
|
||||||
#endif
|
|
||||||
|
|
||||||
d->general_timer_.setInterval(500);
|
d->general_timer_.setInterval(500);
|
||||||
connect(&d->general_timer_, SIGNAL(timeout()),
|
connect(&d->general_timer_, SIGNAL(timeout()),
|
||||||
@ -1266,36 +1253,9 @@ GuiApplication * theGuiApp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
// Emulate platformName() for Qt4
|
|
||||||
|
|
||||||
// FIXME: when ditching this method, remove all tests
|
|
||||||
// platformName() == "qt4x11"
|
|
||||||
// in the code
|
|
||||||
QString GuiApplication::platformName() const
|
|
||||||
{
|
|
||||||
# if defined(Q_WS_X11)
|
|
||||||
// Note that this one does not really exist
|
|
||||||
return "qt4x11";
|
|
||||||
# elif defined(Q_OS_MAC)
|
|
||||||
return "cocoa";
|
|
||||||
# elif defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
|
||||||
return "windows";
|
|
||||||
# else
|
|
||||||
LYXERR0("Unknown platform!");
|
|
||||||
return "unknown";
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
double GuiApplication::pixelRatio() const
|
double GuiApplication::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return qt_scale_factor * devicePixelRatio();
|
return qt_scale_factor * devicePixelRatio();
|
||||||
#else
|
|
||||||
return 1.0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2363,11 +2323,7 @@ docstring GuiApplication::viewStatusMessage()
|
|||||||
|
|
||||||
string GuiApplication::inputLanguageCode() const
|
string GuiApplication::inputLanguageCode() const
|
||||||
{
|
{
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
QLocale loc = keyboardInputLocale();
|
|
||||||
#else
|
|
||||||
QLocale loc = inputMethod()->locale();
|
QLocale loc = inputMethod()->locale();
|
||||||
#endif
|
|
||||||
//LYXERR0("input lang = " << fromqstr(loc.name()));
|
//LYXERR0("input lang = " << fromqstr(loc.name()));
|
||||||
return loc.name() == "C" ? "en_US" : fromqstr(loc.name());
|
return loc.name() == "C" ? "en_US" : fromqstr(loc.name());
|
||||||
}
|
}
|
||||||
@ -2862,12 +2818,10 @@ void GuiApplication::execBatchCommands()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#if QT_VERSION > 0x040600
|
|
||||||
setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
|
setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
|
||||||
#endif
|
# if QT_VERSION < 0x060000
|
||||||
#if QT_VERSION >= 0x050000 && QT_VERSION < 0x060000
|
|
||||||
setAttribute(Qt::AA_UseHighDpiPixmaps,true);
|
setAttribute(Qt::AA_UseHighDpiPixmaps,true);
|
||||||
#endif
|
# endif
|
||||||
// Create the global default menubar which is shown for the dialogs
|
// Create the global default menubar which is shown for the dialogs
|
||||||
// and if no GuiView is visible.
|
// and if no GuiView is visible.
|
||||||
// This must be done after the session was recovered to know the "last files".
|
// This must be done after the session was recovered to know the "last files".
|
||||||
@ -3033,15 +2987,6 @@ bool GuiApplication::event(QEvent * e)
|
|||||||
e->accept();
|
e->accept();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
// Qt5 uses a signal for that, see above.
|
|
||||||
case QEvent::KeyboardLayoutChange:
|
|
||||||
//LYXERR0("keyboard change");
|
|
||||||
if (currentView() && currentView()->currentBufferView())
|
|
||||||
currentView()->currentBufferView()->cursor().setLanguageFromInput();
|
|
||||||
e->accept();
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
case QEvent::ApplicationPaletteChange: {
|
case QEvent::ApplicationPaletteChange: {
|
||||||
// runtime switch from/to dark mode
|
// runtime switch from/to dark mode
|
||||||
onPaletteChanged();
|
onPaletteChanged();
|
||||||
|
@ -164,21 +164,12 @@ public:
|
|||||||
///
|
///
|
||||||
GuiView & view(int id) const;
|
GuiView & view(int id) const;
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
/// Emulate platformName() for Qt4
|
|
||||||
QString platformName() const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Current ratio between physical pixels and device-independent pixels
|
/// Current ratio between physical pixels and device-independent pixels
|
||||||
double pixelRatio() const;
|
double pixelRatio() const;
|
||||||
|
|
||||||
/// How to load image files
|
/// How to load image files
|
||||||
support::search_mode imageSearchMode() const {
|
support::search_mode imageSearchMode() const {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return pixelRatio() > 1 ? support::check_hidpi : support::must_exist;
|
return pixelRatio() > 1 ? support::check_hidpi : support::must_exist;
|
||||||
#else
|
|
||||||
return support::must_exist;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return true if the key is part of a shortcut
|
/// return true if the key is part of a shortcut
|
||||||
|
@ -108,13 +108,8 @@ GuiBibtex::GuiBibtex(GuiView & lv)
|
|||||||
this, SLOT(filterChanged(QString)));
|
this, SLOT(filterChanged(QString)));
|
||||||
connect(filter_, SIGNAL(returnPressed()),
|
connect(filter_, SIGNAL(returnPressed()),
|
||||||
this, SLOT(filterPressed()));
|
this, SLOT(filterPressed()));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
availableLV, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
availableLV, [this](){ focusAndHighlight(availableLV); });
|
availableLV, [this](){ focusAndHighlight(availableLV); });
|
||||||
#endif
|
|
||||||
|
|
||||||
availableLV->setToolTip(formatToolTip(qt_("This list consists of all databases that are indexed by LaTeX and thus are found without a file path. "
|
availableLV->setToolTip(formatToolTip(qt_("This list consists of all databases that are indexed by LaTeX and thus are found without a file path. "
|
||||||
"This is usually everything in the bib/ subdirectory of LaTeX's texmf tree. "
|
"This is usually everything in the bib/ subdirectory of LaTeX's texmf tree. "
|
||||||
@ -129,11 +124,7 @@ GuiBibtex::GuiBibtex(GuiView & lv)
|
|||||||
bc().addReadOnly(bibtocCB);
|
bc().addReadOnly(bibtocCB);
|
||||||
bc().addReadOnly(bibEncodingCO);
|
bc().addReadOnly(bibEncodingCO);
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
selectedLV->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
|
||||||
#else
|
|
||||||
selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Always put the default encoding in the first position.
|
// Always put the default encoding in the first position.
|
||||||
bibEncodingCO->addItem(qt_("Document Encoding"), "default");
|
bibEncodingCO->addItem(qt_("Document Encoding"), "default");
|
||||||
|
@ -153,13 +153,8 @@ GuiCitation::GuiCitation(GuiView & lv)
|
|||||||
this, SLOT(filterChanged(QString)));
|
this, SLOT(filterChanged(QString)));
|
||||||
connect(filter_, SIGNAL(returnPressed()),
|
connect(filter_, SIGNAL(returnPressed()),
|
||||||
this, SLOT(filterPressed()));
|
this, SLOT(filterPressed()));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
availableLV, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
availableLV, [this](){ focusAndHighlight(availableLV); });
|
availableLV, [this](){ focusAndHighlight(availableLV); });
|
||||||
#endif
|
|
||||||
connect(regexp_, SIGNAL(triggered()),
|
connect(regexp_, SIGNAL(triggered()),
|
||||||
this, SLOT(regexChanged()));
|
this, SLOT(regexChanged()));
|
||||||
connect(casesense_, SIGNAL(triggered()),
|
connect(casesense_, SIGNAL(triggered()),
|
||||||
@ -167,11 +162,7 @@ GuiCitation::GuiCitation(GuiView & lv)
|
|||||||
connect(instant_, SIGNAL(triggered(bool)),
|
connect(instant_, SIGNAL(triggered(bool)),
|
||||||
this, SLOT(instantChanged(bool)));
|
this, SLOT(instantChanged(bool)));
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
selectedLV->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
|
||||||
#else
|
|
||||||
selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
#endif
|
|
||||||
|
|
||||||
selectedLV->setToolTip(qt_("Ordered list of all cited references.\n"
|
selectedLV->setToolTip(qt_("Ordered list of all cited references.\n"
|
||||||
"You can reorder, add and remove references with the buttons on the left."));
|
"You can reorder, add and remove references with the buttons on the left."));
|
||||||
|
@ -909,13 +909,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
masterChildModule->childrenTW->setColumnCount(2);
|
masterChildModule->childrenTW->setColumnCount(2);
|
||||||
masterChildModule->childrenTW->headerItem()->setText(0, qt_("Child Document"));
|
masterChildModule->childrenTW->headerItem()->setText(0, qt_("Child Document"));
|
||||||
masterChildModule->childrenTW->headerItem()->setText(1, qt_("Include to Output"));
|
masterChildModule->childrenTW->headerItem()->setText(1, qt_("Include to Output"));
|
||||||
#if (QT_VERSION > 0x050000)
|
|
||||||
masterChildModule->childrenTW->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
masterChildModule->childrenTW->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
masterChildModule->childrenTW->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
masterChildModule->childrenTW->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
masterChildModule->childrenTW->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
|
||||||
masterChildModule->childrenTW->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Formats
|
// Formats
|
||||||
outputModule = new UiWidget<Ui::OutputUi>(this);
|
outputModule = new UiWidget<Ui::OutputUi>(this);
|
||||||
@ -1679,13 +1674,8 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
this, SLOT(moduleFilterChanged(QString)));
|
this, SLOT(moduleFilterChanged(QString)));
|
||||||
connect(filter_, SIGNAL(returnPressed()),
|
connect(filter_, SIGNAL(returnPressed()),
|
||||||
this, SLOT(moduleFilterPressed()));
|
this, SLOT(moduleFilterPressed()));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
modulesModule->availableLV, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
modulesModule->availableLV, [this](){ focusAndHighlight(modulesModule->availableLV); });
|
modulesModule->availableLV, [this](){ focusAndHighlight(modulesModule->availableLV); });
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// PDF support
|
// PDF support
|
||||||
@ -1793,11 +1783,10 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
docPS->addPanel(outputModule, N_("Formats[[output]]"));
|
docPS->addPanel(outputModule, N_("Formats[[output]]"));
|
||||||
docPS->addPanel(preambleModule, N_("LaTeX Preamble"));
|
docPS->addPanel(preambleModule, N_("LaTeX Preamble"));
|
||||||
docPS->setCurrentPanel("Document Class");
|
docPS->setCurrentPanel("Document Class");
|
||||||
|
// FIXME KILLQT4: check that this is still needed (is this workaround still needed?)
|
||||||
// FIXME: hack to work around resizing bug in Qt >= 4.2
|
// FIXME: hack to work around resizing bug in Qt >= 4.2
|
||||||
// bug verified with Qt 4.2.{0-3} (JSpitzm)
|
// bug verified with Qt 4.2.{0-3} (JSpitzm)
|
||||||
#if QT_VERSION >= 0x040200
|
|
||||||
docPS->updateGeometry();
|
docPS->updateGeometry();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,27 +66,9 @@ namespace {
|
|||||||
struct SymbolFont {
|
struct SymbolFont {
|
||||||
FontFamily lyx_family;
|
FontFamily lyx_family;
|
||||||
QString family;
|
QString family;
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QString xlfd;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SymbolFont symbol_fonts[] = {
|
SymbolFont symbol_fonts[] = {
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
{ SYMBOL_FAMILY,"symbol", "-*-symbol-*-*-*-*-*-*-*-*-*-*-adobe-fontspecific"},
|
|
||||||
{ CMR_FAMILY, "cmr10", "-*-cmr10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ CMSY_FAMILY, "cmsy10", "-*-cmsy10-*-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ CMM_FAMILY, "cmmi10", "-*-cmmi10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ CMEX_FAMILY, "cmex10", "-*-cmex10-*-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ MSA_FAMILY, "msam10", "-*-msam10-*-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ MSB_FAMILY, "msbm10", "-*-msbm10-*-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ DS_FAMILY, "dsrom10", "-*-dsrom10-*-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ EUFRAK_FAMILY,"eufm10", "-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ RSFS_FAMILY, "rsfs10", "-*-rsfs10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ STMARY_FAMILY,"stmary10","-*-stmary10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ WASY_FAMILY, "wasy10", "-*-wasy10-medium-*-*-*-*-*-*-*-*-*-*-*" },
|
|
||||||
{ ESINT_FAMILY, "esint10","-*-esint10-medium-*-*-*-*-*-*-*-*-*-*-*" }
|
|
||||||
#else
|
|
||||||
{ SYMBOL_FAMILY,"symbol"},
|
{ SYMBOL_FAMILY,"symbol"},
|
||||||
{ CMR_FAMILY, "cmr10"},
|
{ CMR_FAMILY, "cmr10"},
|
||||||
{ CMSY_FAMILY, "cmsy10"},
|
{ CMSY_FAMILY, "cmsy10"},
|
||||||
@ -100,7 +82,6 @@ SymbolFont symbol_fonts[] = {
|
|||||||
{ STMARY_FAMILY,"stmary10"},
|
{ STMARY_FAMILY,"stmary10"},
|
||||||
{ WASY_FAMILY, "wasy10"},
|
{ WASY_FAMILY, "wasy10"},
|
||||||
{ ESINT_FAMILY, "esint10"}
|
{ ESINT_FAMILY, "esint10"}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t const nr_symbol_fonts = sizeof(symbol_fonts) / sizeof(symbol_fonts[0]);
|
size_t const nr_symbol_fonts = sizeof(symbol_fonts) / sizeof(symbol_fonts[0]);
|
||||||
@ -147,19 +128,6 @@ GuiFontInfo & fontinfo(FontInfo const & f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
QString rawName(QString const & family)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < nr_symbol_fonts; ++i)
|
|
||||||
if (family == symbol_fonts[i].family)
|
|
||||||
return symbol_fonts[i].xlfd;
|
|
||||||
|
|
||||||
LYXERR(Debug::FONT, "BUG: family not found !");
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
QString symbolFamily(FontFamily family)
|
QString symbolFamily(FontFamily family)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < nr_symbol_fonts; ++i) {
|
for (size_t i = 0; i < nr_symbol_fonts; ++i) {
|
||||||
@ -190,10 +158,7 @@ static bool isChosenFont(QFont & font, QString const & family,
|
|||||||
LYXERR_NOPOS(Debug::FONT, "got: " << fi.family());
|
LYXERR_NOPOS(Debug::FONT, "got: " << fi.family());
|
||||||
|
|
||||||
if (fi.family().contains(family)
|
if (fi.family().contains(family)
|
||||||
#if QT_VERSION >= 0x040800
|
&& (style.isEmpty() || fi.styleName().contains(style))) {
|
||||||
&& (style.isEmpty() || fi.styleName().contains(style))
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
LYXERR_NOENDL(Debug::FONT, " got it ");
|
LYXERR_NOENDL(Debug::FONT, " got it ");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -209,8 +174,7 @@ QFont symbolFont(QString const & family, bool * ok)
|
|||||||
upper[0] = family[0].toUpper();
|
upper[0] = family[0].toUpper();
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
if (guiApp->platformName() == "qt4x11"
|
if (guiApp->platformName() == "xcb"
|
||||||
|| guiApp->platformName() == "xcb"
|
|
||||||
|| guiApp->platformName().contains("wayland")) {
|
|| guiApp->platformName().contains("wayland")) {
|
||||||
// On *nix we have to also specify the foundry to be able to
|
// On *nix we have to also specify the foundry to be able to
|
||||||
// discriminate our fonts when the texlive fonts are managed by
|
// discriminate our fonts when the texlive fonts are managed by
|
||||||
@ -220,7 +184,6 @@ QFont symbolFont(QString const & family, bool * ok)
|
|||||||
font.setFamily(family);
|
font.setFamily(family);
|
||||||
}
|
}
|
||||||
font.setStyleStrategy(QFont::NoFontMerging);
|
font.setStyleStrategy(QFont::NoFontMerging);
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
font.setStyleName("LyX");
|
font.setStyleName("LyX");
|
||||||
|
|
||||||
if (isChosenFont(font, family, "LyX")) {
|
if (isChosenFont(font, family, "LyX")) {
|
||||||
@ -231,7 +194,6 @@ QFont symbolFont(QString const & family, bool * ok)
|
|||||||
|
|
||||||
LYXERR_NOENDL(Debug::FONT, "Trying normal " << family << " ... ");
|
LYXERR_NOENDL(Debug::FONT, "Trying normal " << family << " ... ");
|
||||||
font.setStyleName(QString());
|
font.setStyleName(QString());
|
||||||
#endif
|
|
||||||
|
|
||||||
if (isChosenFont(font, family, QString())) {
|
if (isChosenFont(font, family, QString())) {
|
||||||
LYXERR_NOPOS(Debug::FONT, "normal!");
|
LYXERR_NOPOS(Debug::FONT, "normal!");
|
||||||
@ -248,20 +210,6 @@ QFont symbolFont(QString const & family, bool * ok)
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
// A simple setFamily() fails on Qt 2
|
|
||||||
|
|
||||||
QString const raw = rawName(family);
|
|
||||||
LYXERR_NOENDL(Debug::FONT, "Trying " << raw << " ... ");
|
|
||||||
font.setRawName(raw);
|
|
||||||
|
|
||||||
if (isChosenFont(font, family, QString())) {
|
|
||||||
LYXERR_NOPOS(Debug::FONT, "raw version!");
|
|
||||||
*ok = true;
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LYXERR_NOPOS(Debug::FONT, " FAILED :-(");
|
LYXERR_NOPOS(Debug::FONT, " FAILED :-(");
|
||||||
*ok = false;
|
*ok = false;
|
||||||
return font;
|
return font;
|
||||||
@ -337,13 +285,12 @@ QFont makeQFont(FontInfo const & f)
|
|||||||
toqstr(lyxrc.roman_font_foundry));
|
toqstr(lyxrc.roman_font_foundry));
|
||||||
font.setFamily(family);
|
font.setFamily(family);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#if QT_VERSION >= 0x040300 //&& QT_VERSION < 0x040800
|
// FIXME KILLQT4: Double-check that this is fixed in Qt5
|
||||||
// Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684
|
// Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684
|
||||||
// and http://bugreports.qt.nokia.com/browse/QTBUG-11145.
|
// and http://bugreports.qt.nokia.com/browse/QTBUG-11145.
|
||||||
// FIXME: Check whether this is really fixed in Qt 4.8
|
// FIXME: Check whether this is really fixed in Qt 4.8
|
||||||
if (family == "Times" && !font.exactMatch())
|
if (family == "Times" && !font.exactMatch())
|
||||||
font.setFamily("Times New Roman");
|
font.setFamily("Times New Roman");
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -394,10 +341,6 @@ QFont makeQFont(FontInfo const & f)
|
|||||||
else
|
else
|
||||||
LYXERR(Debug::FONT, "This font is NOT an exact match");
|
LYXERR(Debug::FONT, "This font is NOT an exact match");
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
LYXERR(Debug::FONT, "XFLD: " << font.rawName());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
font.setPointSizeF(f.realSize() * lyxrc.currentZoom / 100.0);
|
font.setPointSizeF(f.realSize() * lyxrc.currentZoom / 100.0);
|
||||||
|
|
||||||
LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());
|
LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());
|
||||||
@ -453,13 +396,9 @@ bool FontLoader::canBeDisplayed(char_type c)
|
|||||||
{
|
{
|
||||||
// bug 8493
|
// bug 8493
|
||||||
if (c == 0x0009)
|
if (c == 0x0009)
|
||||||
|
// FIXME KILLQT4: get rid of this function if not needed anymore
|
||||||
// FIXME check whether this is still needed for Qt5
|
// FIXME check whether this is still needed for Qt5
|
||||||
return false;
|
return false;
|
||||||
#if QT_VERSION < 0x050000 && defined(QT_MAC_USE_COCOA) && (QT_MAC_USE_COCOA > 0)
|
|
||||||
// bug 7954, see also comment in GuiPainter::text()
|
|
||||||
if (c == 0x00ad)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,6 @@ using namespace lyx::support;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
inline uint qHash(double key)
|
|
||||||
{
|
|
||||||
return qHash(QByteArray(reinterpret_cast<char const *>(&key), sizeof(key)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -91,7 +83,8 @@ int const strwidth_cache_max_cost = 1024 * 1024;
|
|||||||
int const breakstr_cache_max_cost = 10 * 1024 * 1024;
|
int const breakstr_cache_max_cost = 10 * 1024 * 1024;
|
||||||
// Qt 5.x already has its own caching of QTextLayout objects
|
// Qt 5.x already has its own caching of QTextLayout objects
|
||||||
// but it does not seem to work well on MacOS X.
|
// but it does not seem to work well on MacOS X.
|
||||||
#if (QT_VERSION < 0x050000) || defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
//FIXME KILLQT4: check wether setting the cache to 0 hurts on macOS
|
||||||
// Limit qtextlayout_cache_ size to 500 elements (we do not know the
|
// Limit qtextlayout_cache_ size to 500 elements (we do not know the
|
||||||
// size of the QTextLayout objects anyway).
|
// size of the QTextLayout objects anyway).
|
||||||
int const qtextlayout_cache_max_size = 500;
|
int const qtextlayout_cache_max_size = 500;
|
||||||
@ -291,11 +284,7 @@ int GuiFontMetrics::width(docstring const & s) const
|
|||||||
*/
|
*/
|
||||||
int w = 0;
|
int w = 0;
|
||||||
// is the string a single character from a math font ?
|
// is the string a single character from a math font ?
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
bool const math_char = s.length() == 1 && font_.styleName() == "LyX";
|
bool const math_char = s.length() == 1 && font_.styleName() == "LyX";
|
||||||
#else
|
|
||||||
bool const math_char = s.length() == 1;
|
|
||||||
#endif
|
|
||||||
if (math_char) {
|
if (math_char) {
|
||||||
QString const qs = toqstr(s);
|
QString const qs = toqstr(s);
|
||||||
int br_width = metrics_.boundingRect(qs).width();
|
int br_width = metrics_.boundingRect(qs).width();
|
||||||
@ -354,7 +343,7 @@ struct TextLayoutHelper
|
|||||||
/// \c s is the original string
|
/// \c s is the original string
|
||||||
/// \c isrtl is true if the string is right-to-left
|
/// \c isrtl is true if the string is right-to-left
|
||||||
/// \c naked is true to disable the insertion of zero width annotations
|
/// \c naked is true to disable the insertion of zero width annotations
|
||||||
/// FIXME: remove \c naked argument when Qt4 support goes away.
|
/// FIXME KILLQT4: remove \c naked argument when Qt4 support goes away.
|
||||||
TextLayoutHelper(docstring const & s, bool isrtl, bool naked = false);
|
TextLayoutHelper(docstring const & s, bool isrtl, bool naked = false);
|
||||||
|
|
||||||
/// translate QString index to docstring index
|
/// translate QString index to docstring index
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
double slope_;
|
double slope_;
|
||||||
|
|
||||||
/// If true, avoid extra annotation in string for QTextLayout
|
/// If true, avoid extra annotation in string for QTextLayout
|
||||||
// FIXME: remove wen Qt4 suport goes away
|
// FIXME KILLQT4: remove when Qt4 suport goes away
|
||||||
bool needs_naked_ = false;
|
bool needs_naked_ = false;
|
||||||
|
|
||||||
/// Cache of char widths
|
/// Cache of char widths
|
||||||
|
@ -64,25 +64,17 @@ QImage const & GuiImage::image() const
|
|||||||
|
|
||||||
unsigned int GuiImage::width() const
|
unsigned int GuiImage::width() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return static_cast<unsigned int>(ceil(is_transformed_ ?
|
return static_cast<unsigned int>(ceil(is_transformed_ ?
|
||||||
(transformed_.width() / transformed_.devicePixelRatio()) :
|
(transformed_.width() / transformed_.devicePixelRatio()) :
|
||||||
(original_.width() / original_.devicePixelRatio())));
|
(original_.width() / original_.devicePixelRatio())));
|
||||||
#else
|
|
||||||
return is_transformed_ ? transformed_.width() : original_.width();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int GuiImage::height() const
|
unsigned int GuiImage::height() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return static_cast<unsigned int>(ceil(is_transformed_ ?
|
return static_cast<unsigned int>(ceil(is_transformed_ ?
|
||||||
(transformed_.height() / transformed_.devicePixelRatio()) :
|
(transformed_.height() / transformed_.devicePixelRatio()) :
|
||||||
(original_.height() / original_.devicePixelRatio())));
|
(original_.height() / original_.devicePixelRatio())));
|
||||||
#else
|
|
||||||
return is_transformed_ ? transformed_.height() : original_.height();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,9 +109,7 @@ bool GuiImage::setPixmap(Params const & params)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
original_.setDevicePixelRatio(params.pixel_ratio);
|
original_.setDevicePixelRatio(params.pixel_ratio);
|
||||||
#endif
|
|
||||||
|
|
||||||
is_transformed_ = clip(params);
|
is_transformed_ = clip(params);
|
||||||
is_transformed_ |= rotate(params);
|
is_transformed_ |= rotate(params);
|
||||||
@ -141,14 +131,9 @@ bool GuiImage::clip(Params const & params)
|
|||||||
// No clipping is necessary.
|
// No clipping is necessary.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio();
|
double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio();
|
||||||
int const new_width = static_cast<int>((params.bb.xr.inBP() - params.bb.xl.inBP()) * pixelRatio);
|
int const new_width = static_cast<int>((params.bb.xr.inBP() - params.bb.xl.inBP()) * pixelRatio);
|
||||||
int const new_height = static_cast<int>((params.bb.yt.inBP() - params.bb.yb.inBP()) * pixelRatio);
|
int const new_height = static_cast<int>((params.bb.yt.inBP() - params.bb.yb.inBP()) * pixelRatio);
|
||||||
#else
|
|
||||||
int const new_width = static_cast<int>((params.bb.xr.inBP() - params.bb.xl.inBP()));
|
|
||||||
int const new_height = static_cast<int>((params.bb.yt.inBP() - params.bb.yb.inBP()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QImage const & image = is_transformed_ ? transformed_ : original_;
|
QImage const & image = is_transformed_ ? transformed_ : original_;
|
||||||
|
|
||||||
@ -191,19 +176,8 @@ bool GuiImage::scale(Params const & params)
|
|||||||
if (params.scale == 100)
|
if (params.scale == 100)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio();
|
double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio();
|
||||||
qreal scale = qreal(params.scale) / 100.0 * pixelRatio;
|
qreal const scale = qreal(params.scale) / 100.0 * pixelRatio;
|
||||||
#else
|
|
||||||
qreal scale = qreal(params.scale) / 100.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x040500) && (QT_VERSION <= 0x040502)
|
|
||||||
// Due to a bug in Qt, LyX will crash for certain
|
|
||||||
// scaling factors and sizes of the image.
|
|
||||||
// see bug #5957: http://www.lyx.org/trac/ticket/5957
|
|
||||||
scale += 0.0001;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QTransform m;
|
QTransform m;
|
||||||
m.scale(scale, scale);
|
m.scale(scale, scale);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "GuiKeySymbol.h"
|
#include "GuiKeySymbol.h"
|
||||||
#if defined(Q_OS_MAC) && QT_VERSION > 0x050000
|
#if defined(Q_OS_MAC)
|
||||||
#include "GuiApplication.h"
|
#include "GuiApplication.h"
|
||||||
#endif
|
#endif
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
@ -867,7 +867,7 @@ bool KeySymbol::operator==(KeySymbol const & ks) const
|
|||||||
KeyModifier q_key_state(Qt::KeyboardModifiers state)
|
KeyModifier q_key_state(Qt::KeyboardModifiers state)
|
||||||
{
|
{
|
||||||
KeyModifier k = NoModifier;
|
KeyModifier k = NoModifier;
|
||||||
#if defined(Q_OS_MAC) && (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
|
#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
|
||||||
/// Additional check for Control and Meta modifier swap state.
|
/// Additional check for Control and Meta modifier swap state.
|
||||||
/// Starting with Qt 5 the modifiers aren't reported correctly.
|
/// Starting with Qt 5 the modifiers aren't reported correctly.
|
||||||
/// Until this is fixed a correction is required.
|
/// Until this is fixed a correction is required.
|
||||||
|
@ -189,13 +189,8 @@ GuiLyXFiles::GuiLyXFiles(GuiView & lv)
|
|||||||
filter_->setClearButton(true);
|
filter_->setClearButton(true);
|
||||||
filter_->setPlaceholderText(qt_("All available files"));
|
filter_->setPlaceholderText(qt_("All available files"));
|
||||||
filter_->setToolTip(qt_("Enter string to filter the list of available files"));
|
filter_->setToolTip(qt_("Enter string to filter the list of available files"));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
filesLW, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
filesLW, [this](){ focusAndHighlight(filesLW); });
|
filesLW, [this](){ focusAndHighlight(filesLW); });
|
||||||
#endif
|
|
||||||
|
|
||||||
filterBarL->addWidget(filter_, 0);
|
filterBarL->addWidget(filter_, 0);
|
||||||
findKeysLA->setBuddy(filter_);
|
findKeysLA->setBuddy(filter_);
|
||||||
|
@ -315,13 +315,6 @@ void GuiPainter::text(int x, int y, docstring const & s,
|
|||||||
*/
|
*/
|
||||||
QString str = toqstr(s);
|
QString str = toqstr(s);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// HACK: QT3 refuses to show single compose characters
|
|
||||||
// Still needed with Qt4?
|
|
||||||
if (ls == 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
|
|
||||||
str = ' ' + str;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QFont ff = getFont(f);
|
QFont ff = getFont(f);
|
||||||
ff.setWordSpacing(wordspacing);
|
ff.setWordSpacing(wordspacing);
|
||||||
GuiFontMetrics const & fm = getFontMetrics(f);
|
GuiFontMetrics const & fm = getFontMetrics(f);
|
||||||
|
@ -438,13 +438,11 @@ PrefInput::PrefInput(GuiPreferences * form)
|
|||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
|
|
||||||
// reveal checkbox for switching Ctrl and Meta on Mac:
|
// reveal checkbox for switching Ctrl and Meta on Mac:
|
||||||
bool swapcb = false;
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#if QT_VERSION > 0x040600
|
dontswapCB->setVisible(true);
|
||||||
swapcb = true;
|
#else
|
||||||
|
dontswapCB->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
dontswapCB->setVisible(swapcb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2635,11 +2633,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form)
|
|||||||
iconSetCO->addItem(qt_("Classic"), "classic");
|
iconSetCO->addItem(qt_("Classic"), "classic");
|
||||||
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040600
|
if (guiApp->platformName() != "xcb"
|
||||||
if (guiApp->platformName() != "qt4x11"
|
|
||||||
&& guiApp->platformName() != "xcb"
|
|
||||||
&& !guiApp->platformName().contains("wayland"))
|
&& !guiApp->platformName().contains("wayland"))
|
||||||
#endif
|
|
||||||
useSystemThemeIconsCB->hide();
|
useSystemThemeIconsCB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3573,11 +3568,10 @@ GuiPreferences::GuiPreferences(GuiView & lv)
|
|||||||
addModule(formats);
|
addModule(formats);
|
||||||
|
|
||||||
prefsPS->setCurrentPanel("User Interface");
|
prefsPS->setCurrentPanel("User Interface");
|
||||||
|
// FIXME KILLQT4: check that this is still needed (what bug is it?)
|
||||||
// FIXME: hack to work around resizing bug in Qt >= 4.2
|
// FIXME: hack to work around resizing bug in Qt >= 4.2
|
||||||
// bug verified with Qt 4.2.{0-3} (JSpitzm)
|
// bug verified with Qt 4.2.{0-3} (JSpitzm)
|
||||||
#if QT_VERSION >= 0x040200
|
|
||||||
prefsPS->updateGeometry();
|
prefsPS->updateGeometry();
|
||||||
#endif
|
|
||||||
|
|
||||||
bc().setPolicy(ButtonPolicy::PreferencesPolicy);
|
bc().setPolicy(ButtonPolicy::PreferencesPolicy);
|
||||||
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
|
||||||
|
@ -59,13 +59,8 @@ GuiRef::GuiRef(GuiView & lv)
|
|||||||
filter_->setClearButton(true);
|
filter_->setClearButton(true);
|
||||||
filter_->setPlaceholderText(qt_("All available labels"));
|
filter_->setPlaceholderText(qt_("All available labels"));
|
||||||
filter_->setToolTip(qt_("Enter string to filter the list of available labels"));
|
filter_->setToolTip(qt_("Enter string to filter the list of available labels"));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
refsTW, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
refsTW, [this](){ focusAndHighlight(refsTW); });
|
refsTW, [this](){ focusAndHighlight(refsTW); });
|
||||||
#endif
|
|
||||||
|
|
||||||
filterBarL->addWidget(filter_, 0);
|
filterBarL->addWidget(filter_, 0);
|
||||||
findKeysLA->setBuddy(filter_);
|
findKeysLA->setBuddy(filter_);
|
||||||
|
@ -42,9 +42,7 @@
|
|||||||
#include <QHideEvent>
|
#include <QHideEvent>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
#include "QSizePolicy"
|
#include "QSizePolicy"
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
@ -233,11 +231,9 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
|
|
||||||
bool const dark_mode = guiApp && guiApp->isInDarkMode();
|
bool const dark_mode = guiApp && guiApp->isInDarkMode();
|
||||||
qreal dpr = 1.0;
|
qreal dpr = 1.0;
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
// Consider device/pixel ratio (HiDPI)
|
// Consider device/pixel ratio (HiDPI)
|
||||||
if (guiApp && guiApp->currentView())
|
if (guiApp && guiApp->currentView())
|
||||||
dpr = guiApp->currentView()->devicePixelRatio();
|
dpr = guiApp->currentView()->devicePixelRatio();
|
||||||
#endif
|
|
||||||
QString imagedir = "images/";
|
QString imagedir = "images/";
|
||||||
QPixmap bpixmap = getPixmap("images/", "search-options", "svgz,png");
|
QPixmap bpixmap = getPixmap("images/", "search-options", "svgz,png");
|
||||||
QPixmap pm = bpixmap;
|
QPixmap pm = bpixmap;
|
||||||
@ -256,10 +252,7 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
if (caseCB->isChecked()) {
|
if (caseCB->isChecked()) {
|
||||||
tip += "<li>" + qt_("Case sensitive search");
|
tip += "<li>" + qt_("Case sensitive search");
|
||||||
QPixmap spixmap = getPixmap("images/", "search-case-sensitive", "svgz,png");
|
QPixmap spixmap = getPixmap("images/", "search-case-sensitive", "svgz,png");
|
||||||
#if QT_VERSION < 0x050000
|
// We render SVG directly for HiDPI scalability
|
||||||
painter.drawPixmap(x, 0, spixmap);
|
|
||||||
#else
|
|
||||||
// With Qt5, we render SVG directly for HiDPI scalability
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-case-sensitive", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-case-sensitive", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -268,15 +261,11 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
svgRenderer.render(&painter, QRectF(0, 0, spixmap.width() * dpr,
|
svgRenderer.render(&painter, QRectF(0, 0, spixmap.width() * dpr,
|
||||||
spixmap.height() * dpr));
|
spixmap.height() * dpr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
x += (spixmap.width() * dpr) + gap;
|
x += (spixmap.width() * dpr) + gap;
|
||||||
}
|
}
|
||||||
if (wordsCB->isChecked()) {
|
if (wordsCB->isChecked()) {
|
||||||
tip += "<li>" + qt_("Whole words only");
|
tip += "<li>" + qt_("Whole words only");
|
||||||
QPixmap spixmap = getPixmap("images/", "search-whole-words", "svgz,png");
|
QPixmap spixmap = getPixmap("images/", "search-whole-words", "svgz,png");
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
painter.drawPixmap(x, 0, spixmap);
|
|
||||||
#else
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-whole-words", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-whole-words", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -285,15 +274,11 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
||||||
spixmap.height() * dpr));
|
spixmap.height() * dpr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
x += (spixmap.width() * dpr) + gap;
|
x += (spixmap.width() * dpr) + gap;
|
||||||
}
|
}
|
||||||
if (selectionCB->isChecked()) {
|
if (selectionCB->isChecked()) {
|
||||||
tip += "<li>" + qt_("Search only in selection");
|
tip += "<li>" + qt_("Search only in selection");
|
||||||
QPixmap spixmap = getPixmap("images/", "search-selection", "svgz,png");
|
QPixmap spixmap = getPixmap("images/", "search-selection", "svgz,png");
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
painter.drawPixmap(x, 0, spixmap);
|
|
||||||
#else
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-selection", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-selection", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -302,15 +287,11 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
||||||
spixmap.height() * dpr));
|
spixmap.height() * dpr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
x += (spixmap.width() * dpr) + gap;
|
x += (spixmap.width() * dpr) + gap;
|
||||||
}
|
}
|
||||||
if (instantSearchCB->isChecked()) {
|
if (instantSearchCB->isChecked()) {
|
||||||
tip += "<li>" + qt_("Search as you type");
|
tip += "<li>" + qt_("Search as you type");
|
||||||
QPixmap spixmap = getPixmap("images/", "search-instant", "svgz,png");
|
QPixmap spixmap = getPixmap("images/", "search-instant", "svgz,png");
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
painter.drawPixmap(x, 0, spixmap);
|
|
||||||
#else
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-instant", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-instant", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -319,15 +300,11 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
||||||
spixmap.height() * dpr));
|
spixmap.height() * dpr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
x += (spixmap.width() * dpr) + gap;
|
x += (spixmap.width() * dpr) + gap;
|
||||||
}
|
}
|
||||||
if (wrapCB->isChecked()) {
|
if (wrapCB->isChecked()) {
|
||||||
tip += "<li>" + qt_("Wrap search");
|
tip += "<li>" + qt_("Wrap search");
|
||||||
QPixmap spixmap = getPixmap("images/", "search-wrap", "svgz,png");
|
QPixmap spixmap = getPixmap("images/", "search-wrap", "svgz,png");
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
painter.drawPixmap(x, 0, spixmap);
|
|
||||||
#else
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-wrap", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-wrap", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -336,18 +313,14 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
svgRenderer.render(&painter, QRectF(x, 0, spixmap.width() * dpr,
|
||||||
spixmap.height() * dpr));
|
spixmap.height() * dpr));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
x += (spixmap.width() * dpr) + gap;
|
x += (spixmap.width() * dpr) + gap;
|
||||||
}
|
}
|
||||||
tip += "</ul>";
|
tip += "</ul>";
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
pm.setDevicePixelRatio(dpr);
|
pm.setDevicePixelRatio(dpr);
|
||||||
#endif
|
|
||||||
painter.end();
|
painter.end();
|
||||||
} else {
|
} else {
|
||||||
tip = qt_("Click here to change search options");
|
tip = qt_("Click here to change search options");
|
||||||
#if QT_VERSION >= 0x050000
|
// We render SVG directly for HiDPI scalability
|
||||||
// With Qt5, we render SVG directly for HiDPI scalability
|
|
||||||
FileName fname = imageLibFileSearch(imagedir, "search-options", "svgz,png");
|
FileName fname = imageLibFileSearch(imagedir, "search-options", "svgz,png");
|
||||||
QString fpath = toqstr(fname.absFileName());
|
QString fpath = toqstr(fname.absFileName());
|
||||||
if (!fpath.isEmpty()) {
|
if (!fpath.isEmpty()) {
|
||||||
@ -360,7 +333,6 @@ void GuiSearchWidget::handleIndicators()
|
|||||||
pm.setDevicePixelRatio(dpr);
|
pm.setDevicePixelRatio(dpr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (dark_mode) {
|
if (dark_mode) {
|
||||||
QImage img = pm.toImage();
|
QImage img = pm.toImage();
|
||||||
|
@ -521,7 +521,7 @@ void GuiToolbar::add(ToolbarItem const & item)
|
|||||||
case ToolbarItem::MINIBUFFER:
|
case ToolbarItem::MINIBUFFER:
|
||||||
command_buffer_ = new GuiCommandBuffer(&owner_);
|
command_buffer_ = new GuiCommandBuffer(&owner_);
|
||||||
addWidget(command_buffer_);
|
addWidget(command_buffer_);
|
||||||
/// \todo find a Qt4 equivalent to setHorizontalStretchable(true);
|
/// \todo find a Qt5 equivalent to setHorizontalStretchable(true);
|
||||||
//setHorizontalStretchable(true);
|
//setHorizontalStretchable(true);
|
||||||
break;
|
break;
|
||||||
case ToolbarItem::TABLEINSERT: {
|
case ToolbarItem::TABLEINSERT: {
|
||||||
|
@ -159,7 +159,6 @@ public:
|
|||||||
/// The text to be written on top of the pixmap
|
/// The text to be written on top of the pixmap
|
||||||
QString const text = lyx_version ?
|
QString const text = lyx_version ?
|
||||||
qt_("version ") + lyx_version : qt_("unknown version");
|
qt_("version ") + lyx_version : qt_("unknown version");
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QString imagedir = "images/";
|
QString imagedir = "images/";
|
||||||
FileName fname = imageLibFileSearch(imagedir, "banner", "svgz");
|
FileName fname = imageLibFileSearch(imagedir, "banner", "svgz");
|
||||||
QSvgRenderer svgRenderer(toqstr(fname.absFileName()));
|
QSvgRenderer svgRenderer(toqstr(fname.absFileName()));
|
||||||
@ -171,9 +170,6 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
splash_ = getPixmap("images/", "banner", "png");
|
splash_ = getPixmap("images/", "banner", "png");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
splash_ = getPixmap("images/", "banner", "svgz,png");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QPainter pain(&splash_);
|
QPainter pain(&splash_);
|
||||||
pain.setPen(QColor(0, 0, 0));
|
pain.setPen(QColor(0, 0, 0));
|
||||||
@ -262,11 +258,7 @@ private:
|
|||||||
|
|
||||||
/// Current ratio between physical pixels and device-independent pixels
|
/// Current ratio between physical pixels and device-independent pixels
|
||||||
double pixelRatio() const {
|
double pixelRatio() const {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return qt_scale_factor * devicePixelRatio();
|
return qt_scale_factor * devicePixelRatio();
|
||||||
#else
|
|
||||||
return 1.0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal fontSize() const {
|
qreal fontSize() const {
|
||||||
@ -286,11 +278,7 @@ private:
|
|||||||
|
|
||||||
/// Ratio between physical pixels and device-independent pixels of splash image
|
/// Ratio between physical pixels and device-independent pixels of splash image
|
||||||
double splashPixelRatio() const {
|
double splashPixelRatio() const {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return splash_.devicePixelRatio();
|
return splash_.devicePixelRatio();
|
||||||
#else
|
|
||||||
return 1.0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -606,15 +594,10 @@ GuiView::GuiView(int id)
|
|||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
#if !(defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && !defined(Q_OS_MAC)
|
#if !(defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && !defined(Q_OS_MAC)
|
||||||
// QIcon::fromTheme was introduced in Qt 4.6
|
|
||||||
#if (QT_VERSION >= 0x040600)
|
|
||||||
// assign an icon to main form. We do not do it under Qt/Win or Qt/Mac,
|
// assign an icon to main form. We do not do it under Qt/Win or Qt/Mac,
|
||||||
// since the icon is provided in the application bundle. We use a themed
|
// since the icon is provided in the application bundle. We use a themed
|
||||||
// version when available and use the bundled one as fallback.
|
// version when available and use the bundled one as fallback.
|
||||||
setWindowIcon(QIcon::fromTheme("lyx", getPixmap("images/", "lyx", "svg,png")));
|
setWindowIcon(QIcon::fromTheme("lyx", getPixmap("images/", "lyx", "svg,png")));
|
||||||
#else
|
|
||||||
setWindowIcon(getPixmap("images/", "lyx", "svg,png"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
resetWindowTitle();
|
resetWindowTitle();
|
||||||
@ -986,7 +969,7 @@ void GuiView::saveLayout() const
|
|||||||
settings.setValue("devel_mode", devel_mode_);
|
settings.setValue("devel_mode", devel_mode_);
|
||||||
settings.beginGroup("views");
|
settings.beginGroup("views");
|
||||||
settings.beginGroup(QString::number(id_));
|
settings.beginGroup(QString::number(id_));
|
||||||
if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
|
if (guiApp->platformName() == "xcb") {
|
||||||
settings.setValue("pos", pos());
|
settings.setValue("pos", pos());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
} else
|
} else
|
||||||
@ -1052,7 +1035,7 @@ bool GuiView::restoreLayout()
|
|||||||
char_nb_count_enabled_ = settings.value("char_nb_count_enabled", true).toBool();
|
char_nb_count_enabled_ = settings.value("char_nb_count_enabled", true).toBool();
|
||||||
stat_counts_->setVisible(word_count_enabled_ || char_count_enabled_ || char_nb_count_enabled_);
|
stat_counts_->setVisible(word_count_enabled_ || char_count_enabled_ || char_nb_count_enabled_);
|
||||||
|
|
||||||
if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
|
if (guiApp->platformName() == "xcb") {
|
||||||
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
||||||
QSize size = settings.value("size", QSize(690, 510)).toSize();
|
QSize size = settings.value("size", QSize(690, 510)).toSize();
|
||||||
resize(size);
|
resize(size);
|
||||||
@ -1820,11 +1803,7 @@ void GuiView::resetCommandExecute()
|
|||||||
|
|
||||||
double GuiView::pixelRatio() const
|
double GuiView::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return qt_scale_factor * devicePixelRatio();
|
return qt_scale_factor * devicePixelRatio();
|
||||||
#else
|
|
||||||
return 1.0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5217,11 +5196,9 @@ Dialog * GuiView::findOrBuild(string const & name, bool hide_it)
|
|||||||
|
|
||||||
dialog = build(name);
|
dialog = build(name);
|
||||||
d.dialogs_[name].reset(dialog);
|
d.dialogs_[name].reset(dialog);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
// Force a uniform style for group boxes
|
// Force a uniform style for group boxes
|
||||||
// On Mac non-flat works better, on Linux flat is standard
|
// On Mac non-flat works better, on Linux flat is standard
|
||||||
flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa");
|
flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa");
|
||||||
#endif
|
|
||||||
if (lyxrc.allow_geometry_session)
|
if (lyxrc.allow_geometry_session)
|
||||||
dialog->restoreSession();
|
dialog->restoreSession();
|
||||||
if (hide_it)
|
if (hide_it)
|
||||||
|
@ -53,9 +53,6 @@
|
|||||||
#include "frontends/WorkAreaManager.h"
|
#include "frontends/WorkAreaManager.h"
|
||||||
|
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
#include <QInputContext>
|
|
||||||
#endif
|
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QHelpEvent>
|
#include <QHelpEvent>
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
@ -182,11 +179,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & gv)
|
|||||||
|
|
||||||
double GuiWorkArea::pixelRatio() const
|
double GuiWorkArea::pixelRatio() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
return qt_scale_factor * devicePixelRatio();
|
return qt_scale_factor * devicePixelRatio();
|
||||||
#else
|
|
||||||
return 1.0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -202,7 +195,7 @@ void GuiWorkArea::init()
|
|||||||
});
|
});
|
||||||
|
|
||||||
d->resetScreen();
|
d->resetScreen();
|
||||||
// With Qt4.5 a mouse event will happen before the first paint event
|
// A mouse event will happen before the first paint event,
|
||||||
// so make sure that the buffer view has an up to date metrics.
|
// so make sure that the buffer view has an up to date metrics.
|
||||||
d->buffer_view_->resize(viewport()->width(), viewport()->height());
|
d->buffer_view_->resize(viewport()->width(), viewport()->height());
|
||||||
|
|
||||||
@ -724,10 +717,6 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < 0x050000) && !defined(__HAIKU__)
|
|
||||||
inputContext()->reset();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->position().x(), e->position().y(),
|
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->position().x(), e->position().y(),
|
||||||
#else
|
#else
|
||||||
@ -860,13 +849,6 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
|
|||||||
// Wheel rotation by one notch results in a delta() of 120 (see
|
// Wheel rotation by one notch results in a delta() of 120 (see
|
||||||
// documentation of QWheelEvent)
|
// documentation of QWheelEvent)
|
||||||
// But first we have to ignore horizontal scroll events.
|
// But first we have to ignore horizontal scroll events.
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
if (ev->orientation() == Qt::Horizontal) {
|
|
||||||
ev->accept();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double const delta = ev->delta() / 120.0;
|
|
||||||
#else
|
|
||||||
QPoint const aDelta = ev->angleDelta();
|
QPoint const aDelta = ev->angleDelta();
|
||||||
// skip horizontal wheel event
|
// skip horizontal wheel event
|
||||||
if (abs(aDelta.x()) > abs(aDelta.y())) {
|
if (abs(aDelta.x()) > abs(aDelta.y())) {
|
||||||
@ -874,7 +856,6 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double const delta = aDelta.y() / 120.0;
|
double const delta = aDelta.y() / 120.0;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool zoom = false;
|
bool zoom = false;
|
||||||
switch (lyxrc.scroll_wheel_zoom) {
|
switch (lyxrc.scroll_wheel_zoom) {
|
||||||
@ -1232,9 +1213,7 @@ void GuiWorkArea::Private::resetScreen()
|
|||||||
screen_ = QImage(pr * p->viewport()->width(),
|
screen_ = QImage(pr * p->viewport()->width(),
|
||||||
pr * p->viewport()->height(),
|
pr * p->viewport()->height(),
|
||||||
QImage::Format_ARGB32_Premultiplied);
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
# if QT_VERSION >= 0x050000
|
|
||||||
screen_.setDevicePixelRatio(pr);
|
screen_.setDevicePixelRatio(pr);
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1378,11 +1357,7 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
|
|||||||
switch (query) {
|
switch (query) {
|
||||||
// this is the CJK-specific composition window position and
|
// this is the CJK-specific composition window position and
|
||||||
// the context menu position when the menu key is pressed.
|
// the context menu position when the menu key is pressed.
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
case Qt::ImMicroFocus: {
|
|
||||||
#else
|
|
||||||
case Qt::ImCursorRectangle: {
|
case Qt::ImCursorRectangle: {
|
||||||
#endif
|
|
||||||
CaretGeometry const & cg = bufferView().caretGeometry();
|
CaretGeometry const & cg = bufferView().caretGeometry();
|
||||||
return QRect(cg.left - 10 * (d->preedit_lines_ != 1),
|
return QRect(cg.left - 10 * (d->preedit_lines_ != 1),
|
||||||
cg.top + cg.height() * d->preedit_lines_,
|
cg.top + cg.height() * d->preedit_lines_,
|
||||||
@ -1595,11 +1570,7 @@ void TabWorkArea::paintEvent(QPaintEvent * event)
|
|||||||
// painting of the frame of the tab widget.
|
// painting of the frame of the tab widget.
|
||||||
// This is needed for gtk style in Qt.
|
// This is needed for gtk style in Qt.
|
||||||
QStylePainter p(this);
|
QStylePainter p(this);
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
QStyleOptionTabWidgetFrameV2 opt;
|
|
||||||
#else
|
|
||||||
QStyleOptionTabWidgetFrame opt;
|
QStyleOptionTabWidgetFrame opt;
|
||||||
#endif
|
|
||||||
initStyleOption(&opt);
|
initStyleOption(&opt);
|
||||||
opt.rect = style()->subElementRect(QStyle::SE_TabWidgetTabPane,
|
opt.rect = style()->subElementRect(QStyle::SE_TabWidgetTabPane,
|
||||||
&opt, this);
|
&opt, this);
|
||||||
|
@ -76,10 +76,8 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QString>
|
|
||||||
#if QT_VERSION >= 0x040600
|
|
||||||
#include <QProxyStyle>
|
#include <QProxyStyle>
|
||||||
#endif
|
#include <QString>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -2146,7 +2144,7 @@ void Menu::Impl::populate(QMenu * qMenu, MenuDefinition const & menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && (QT_VERSION >= 0x040600)
|
#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN))
|
||||||
class AlwaysMnemonicStyle : public QProxyStyle {
|
class AlwaysMnemonicStyle : public QProxyStyle {
|
||||||
public:
|
public:
|
||||||
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
|
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
|
||||||
@ -2166,7 +2164,7 @@ public:
|
|||||||
Menu::Menu(GuiView * gv, QString const & name, bool top_level, bool keyboard)
|
Menu::Menu(GuiView * gv, QString const & name, bool top_level, bool keyboard)
|
||||||
: QMenu(gv), d(new Menu::Impl)
|
: QMenu(gv), d(new Menu::Impl)
|
||||||
{
|
{
|
||||||
#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && (QT_VERSION >= 0x040600)
|
#if (defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN))
|
||||||
if (keyboard)
|
if (keyboard)
|
||||||
setStyle(new AlwaysMnemonicStyle);
|
setStyle(new AlwaysMnemonicStyle);
|
||||||
#else
|
#else
|
||||||
@ -2280,11 +2278,10 @@ MenuDefinition Menus::Impl::mac_special_menu_;
|
|||||||
*/
|
*/
|
||||||
void Menus::Impl::macxMenuBarInit(QMenuBar * qmb)
|
void Menus::Impl::macxMenuBarInit(QMenuBar * qmb)
|
||||||
{
|
{
|
||||||
/* Since Qt 4.2, the qt/mac menu code has special code for
|
/* The qt/mac menu code has special code for specifying the role
|
||||||
specifying the role of a menu entry. However, it does not
|
of a menu entry. However, it does not work very well with our
|
||||||
work very well with our scheme of creating menus on demand,
|
scheme of creating menus on demand, and therefore we need to
|
||||||
and therefore we need to put these entries in a special
|
put these entries in a special invisible menu. (JMarc)
|
||||||
invisible menu. (JMarc)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The entries of our special mac menu. If we add support for
|
/* The entries of our special mac menu. If we add support for
|
||||||
@ -2306,11 +2303,6 @@ void Menus::Impl::macxMenuBarInit(QMenuBar * qmb)
|
|||||||
QAction::AboutRole},
|
QAction::AboutRole},
|
||||||
{LFUN_DIALOG_SHOW, "prefs", "Preferences",
|
{LFUN_DIALOG_SHOW, "prefs", "Preferences",
|
||||||
QAction::PreferencesRole},
|
QAction::PreferencesRole},
|
||||||
#if !(defined(QT_MAC_USE_COCOA) || (QT_VERSION >= 0x050000))
|
|
||||||
/* This doesn't work with Cocoa. */
|
|
||||||
{LFUN_RECONFIGURE, "", "Reconfigure",
|
|
||||||
QAction::ApplicationSpecificRole},
|
|
||||||
#endif
|
|
||||||
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
|
{LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole}
|
||||||
};
|
};
|
||||||
const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
|
const size_t num_entries = sizeof(entries) / sizeof(entries[0]);
|
||||||
@ -2641,7 +2633,7 @@ void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
|
|||||||
} else {
|
} else {
|
||||||
// Clear all menubar contents before filling it.
|
// Clear all menubar contents before filling it.
|
||||||
qmb->clear();
|
qmb->clear();
|
||||||
#if (QT_VERSION >= 0x050000 && defined(Q_OS_MAC))
|
#if (defined(Q_OS_MAC))
|
||||||
d->macxMenuBarInit(qmb);
|
d->macxMenuBarInit(qmb);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2684,8 +2676,8 @@ void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
|
|||||||
Menu * menuptr = new Menu(view, m->submenuname(), true);
|
Menu * menuptr = new Menu(view, m->submenuname(), true);
|
||||||
menuptr->setTitle(label(*m));
|
menuptr->setTitle(label(*m));
|
||||||
|
|
||||||
#if defined(Q_OS_MAC) && (defined(QT_MAC_USE_COCOA) || (QT_VERSION >= 0x050000))
|
#if defined(Q_OS_MAC)
|
||||||
// On Mac OS with QT/cocoa, the menu is not displayed if there is no action
|
// On Mac OS with Qt/Cocoa, the menu is not displayed if there is no action
|
||||||
// so we create a temporary one here
|
// so we create a temporary one here
|
||||||
QAction * action = new QAction(menuptr);
|
QAction * action = new QAction(menuptr);
|
||||||
menuptr->addAction(action);
|
menuptr->addAction(action);
|
||||||
|
@ -102,13 +102,8 @@ TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
|
|||||||
this, SLOT(showContextMenu(const QPoint &)));
|
this, SLOT(showContextMenu(const QPoint &)));
|
||||||
connect(filter_, SIGNAL(textEdited(QString)),
|
connect(filter_, SIGNAL(textEdited(QString)),
|
||||||
this, SLOT(filterContents()));
|
this, SLOT(filterContents()));
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
connect(filter_, SIGNAL(downPressed()),
|
|
||||||
tocTV, SLOT(setFocus()));
|
|
||||||
#else
|
|
||||||
connect(filter_, &FancyLineEdit::downPressed,
|
connect(filter_, &FancyLineEdit::downPressed,
|
||||||
tocTV, [this](){ focusAndHighlight(tocTV); });
|
tocTV, [this](){ focusAndHighlight(tocTV); });
|
||||||
#endif
|
|
||||||
connect(activeFilterCO, SIGNAL(activated(int)),
|
connect(activeFilterCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(filterContents()));
|
this, SLOT(filterContents()));
|
||||||
|
|
||||||
|
@ -269,22 +269,16 @@ void setMessageColour(list<QWidget *> highlighted, list<QWidget *> plain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// FIXME KILLQT4: kill this function
|
||||||
/// wrapper to hide the change of method name to setSectionResizeMode
|
/// wrapper to hide the change of method name to setSectionResizeMode
|
||||||
void setSectionResizeMode(QHeaderView * view,
|
void setSectionResizeMode(QHeaderView * view,
|
||||||
int logicalIndex, QHeaderView::ResizeMode mode) {
|
int logicalIndex, QHeaderView::ResizeMode mode) {
|
||||||
#if (QT_VERSION >= 0x050000)
|
|
||||||
view->setSectionResizeMode(logicalIndex, mode);
|
view->setSectionResizeMode(logicalIndex, mode);
|
||||||
#else
|
|
||||||
view->setResizeMode(logicalIndex, mode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// FIXME KILLQT4: kill this function
|
||||||
void setSectionResizeMode(QHeaderView * view, QHeaderView::ResizeMode mode) {
|
void setSectionResizeMode(QHeaderView * view, QHeaderView::ResizeMode mode) {
|
||||||
#if (QT_VERSION >= 0x050000)
|
|
||||||
view->setSectionResizeMode(mode);
|
view->setSectionResizeMode(mode);
|
||||||
#else
|
|
||||||
view->setResizeMode(mode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDirectory(FileName const & directory)
|
void showDirectory(FileName const & directory)
|
||||||
|
@ -57,13 +57,8 @@
|
|||||||
//#define ResultsDebug
|
//#define ResultsDebug
|
||||||
#define USE_QT_FOR_SEARCH
|
#define USE_QT_FOR_SEARCH
|
||||||
#if defined(USE_QT_FOR_SEARCH)
|
#if defined(USE_QT_FOR_SEARCH)
|
||||||
#include <QtCore> // sets QT_VERSION
|
|
||||||
#if (QT_VERSION >= 0x050000)
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#define QTSEARCH 1
|
#define QTSEARCH 1
|
||||||
#else
|
|
||||||
#define QTSEARCH 0
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#define QTSEARCH 0
|
#define QTSEARCH 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -126,15 +126,7 @@ void FileMonitorGuard::refresh(bool const emit)
|
|||||||
if (!qwatcher_->files().contains(qfilename)) {
|
if (!qwatcher_->files().contains(qfilename)) {
|
||||||
bool const existed = exists_;
|
bool const existed = exists_;
|
||||||
exists_ = QFile(qfilename).exists();
|
exists_ = QFile(qfilename).exists();
|
||||||
#if (QT_VERSION >= 0x050000)
|
|
||||||
if (exists_ && !qwatcher_->addPath(qfilename))
|
if (exists_ && !qwatcher_->addPath(qfilename))
|
||||||
#else
|
|
||||||
auto add_path = [&]() {
|
|
||||||
qwatcher_->addPath(qfilename);
|
|
||||||
return qwatcher_->files().contains(qfilename);
|
|
||||||
};
|
|
||||||
if (exists_ && !add_path())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
LYXERR(Debug::FILES,
|
LYXERR(Debug::FILES,
|
||||||
"Could not add path to QFileSystemWatcher: " << filename_);
|
"Could not add path to QFileSystemWatcher: " << filename_);
|
||||||
|
@ -778,11 +778,7 @@ docstring FileName::fileContents(string const & encoding) const
|
|||||||
if (encoding.empty() || encoding == "UTF-8")
|
if (encoding.empty() || encoding == "UTF-8")
|
||||||
s = QString::fromUtf8(contents.data());
|
s = QString::fromUtf8(contents.data());
|
||||||
else if (encoding == "ascii")
|
else if (encoding == "ascii")
|
||||||
#if (QT_VERSION < 0x050000)
|
|
||||||
s = QString::fromAscii(contents.data());
|
|
||||||
#else
|
|
||||||
s = QString::fromLatin1(contents.data());
|
s = QString::fromLatin1(contents.data());
|
||||||
#endif
|
|
||||||
else if (encoding == "local8bit")
|
else if (encoding == "local8bit")
|
||||||
s = QString::fromLocal8Bit(contents.data());
|
s = QString::fromLocal8Bit(contents.data());
|
||||||
else if (encoding == "latin1")
|
else if (encoding == "latin1")
|
||||||
|
@ -420,12 +420,9 @@ FileName const get_document_dir(FileName const & home_dir)
|
|||||||
(void)home_dir; // Silence warning about unused variable.
|
(void)home_dir; // Silence warning about unused variable.
|
||||||
os::GetFolderPath win32_folder_path;
|
os::GetFolderPath win32_folder_path;
|
||||||
return FileName(win32_folder_path(os::GetFolderPath::PERSONAL));
|
return FileName(win32_folder_path(os::GetFolderPath::PERSONAL));
|
||||||
#elif defined (USE_MACOSX_PACKAGING) && (QT_VERSION >= 0x050000)
|
|
||||||
(void)home_dir; // Silence warning about unused variable.
|
|
||||||
return FileName(fromqstr(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
|
|
||||||
#elif defined (USE_MACOSX_PACKAGING)
|
#elif defined (USE_MACOSX_PACKAGING)
|
||||||
(void)home_dir; // Silence warning about unused variable.
|
(void)home_dir; // Silence warning about unused variable.
|
||||||
return FileName(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)));
|
return FileName(fromqstr(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)));
|
||||||
#else // Posix-like.
|
#else // Posix-like.
|
||||||
return home_dir;
|
return home_dir;
|
||||||
#endif
|
#endif
|
||||||
@ -686,13 +683,9 @@ FileName const get_default_user_support_dir(FileName const & home_dir)
|
|||||||
os::GetFolderPath win32_folder_path;
|
os::GetFolderPath win32_folder_path;
|
||||||
return FileName(addPath(win32_folder_path(os::GetFolderPath::APPDATA), PACKAGE));
|
return FileName(addPath(win32_folder_path(os::GetFolderPath::APPDATA), PACKAGE));
|
||||||
|
|
||||||
#elif defined (USE_MACOSX_PACKAGING) && (QT_VERSION >= 0x050000)
|
|
||||||
(void)home_dir; // Silence warning about unused variable.
|
|
||||||
return FileName(addPath(fromqstr(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)), PACKAGE));
|
|
||||||
|
|
||||||
#elif defined (USE_MACOSX_PACKAGING)
|
#elif defined (USE_MACOSX_PACKAGING)
|
||||||
(void)home_dir; // Silence warning about unused variable.
|
(void)home_dir; // Silence warning about unused variable.
|
||||||
return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE));
|
return FileName(addPath(fromqstr(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)), PACKAGE));
|
||||||
|
|
||||||
#elif defined (USE_HAIKU_PACKAGING)
|
#elif defined (USE_HAIKU_PACKAGING)
|
||||||
return FileName(addPath(home_dir.absFileName(), string("/config/settings/") + PACKAGE));
|
return FileName(addPath(home_dir.absFileName(), string("/config/settings/") + PACKAGE));
|
||||||
|
@ -1314,12 +1314,8 @@ void fileUnlock(int fd, const char * /* lock_file*/)
|
|||||||
|
|
||||||
std::string toHexHash(const std::string & str)
|
std::string toHexHash(const std::string & str)
|
||||||
{
|
{
|
||||||
// Use the best available hashing algorithm. Qt 5 proposes SHA-2, but Qt 4 is limited to SHA-1.
|
// Use the best available hashing algorithm.
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
auto hashAlgo = QCryptographicHash::Sha256;
|
auto hashAlgo = QCryptographicHash::Sha256;
|
||||||
#else
|
|
||||||
auto hashAlgo = QCryptographicHash::Sha1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QByteArray hash = QCryptographicHash::hash(toqstr(str).toLocal8Bit(), hashAlgo);
|
QByteArray hash = QCryptographicHash::hash(toqstr(str).toLocal8Bit(), hashAlgo);
|
||||||
return fromqstr(QString(hash.toHex()));
|
return fromqstr(QString(hash.toHex()));
|
||||||
|
Loading…
Reference in New Issue
Block a user