The branch, master, has been updated. - Log -----------------------------------------------------------------
commit 141fbb6f8c8518843ae69a48c1e33f5406951e87 Author: Stephan Witt <[email protected]> Date: Sun Feb 3 12:23:31 2013 +0100 Prepare LyX code to compile and link with Qt5: * some functionality is in new modules now new header locations and library names: QtConcurrent and QtWidgets * method setResizeMode is renamed to setSectionResizeMode * deprecated QAbstractItemModel::reset() is dropped now * platform specific code like QApplication::syncX() is not common anymore * QString::fromAscii() is dropped now * some QDesktopServices methods has been moved to QStandardPaths diff --git a/config/qt4.m4 b/config/qt4.m4 index 5cbf7f7..3114341 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -39,6 +39,7 @@ AC_DEFUN([QT4_CHECK_COMPILE], qt4_cv_libname= for libname in '-lQtCore -lQtGui' \ '-lQtCore4 -lQtGui4' \ + '-framework QtCore -framework QtConcurrent -framework QtWidgets -framework QtGui'\ '-framework QtCore -framework QtGui' do QT4_TRY_LINK($libname) @@ -197,7 +198,7 @@ AC_DEFUN([QT4_DO_MANUAL_CONFIG], QT4_CORE_LDFLAGS= if test -n "$qt4_cv_includes"; then QT4_INCLUDES="-I$qt4_cv_includes" - for i in Qt QtCore QtGui; do + for i in Qt QtCore QtGui QtWidgets QtConcurrent; do QT4_INCLUDES="$QT4_INCLUDES -I$qt4_cv_includes/$i" done QT4_CORE_INCLUDES="-I$qt4_cv_includes -I$qt4_cv_includes/QtCore" diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh index 8b66c7c..32e4b7c 100644 --- a/development/LyX-Mac-binary-release.sh +++ b/development/LyX-Mac-binary-release.sh @@ -44,7 +44,7 @@ LyXConfigureOptions="--enable-warnings --enable-optimization=-Os --with-x=no" LyXConfigureOptions="${LyXConfigureOptions} --disable-stdlib-debug" AspellConfigureOptions="--enable-warnings --enable-optimization=-O0 --enable-debug --disable-nls --enable-compile-in-filters --disable-pspell-compatibility" HunspellConfigureOptions="--with-warnings --disable-nls --disable-static" -Qt4ConfigureOptions="${Qt4ConfigureOptions} -opensource -silent -shared -fast -no-exceptions" +Qt4ConfigureOptions="${QtConfigureOptions} -opensource -silent -shared -fast -no-exceptions" Qt4ConfigureOptions="${Qt4ConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus" Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools" @@ -52,6 +52,11 @@ Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -noma case "${Qt4Version}:${Qt4API}" in 4.6*:-carbon) ;; +5.0*) + Qt4ConfigureOptions="${QtConfigureOptions} -opensource -silent -shared -fast -no-strip" + Qt4ConfigureOptions="${Qt4ConfigureOptions} -no-javascript-jit -no-pkg-config" + Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools" + ;; *) Qt4ConfigureOptions="${Qt4ConfigureOptions} ${Qt4API}" ;; @@ -125,6 +130,12 @@ usage() { exit 0 } +NCPU=$(sysctl -n hw.ncpu) +NCPU=$((NCPU / 2)) +if [ $NCPU -gt 1 ]; then + MAKEJOBS=-j${NCPU} +fi + while [ $# -gt 0 ]; do case "${1}" in --with-qt4-frameworks=*) @@ -226,7 +237,6 @@ done if [ "${configure_qt4_frameworks}" != "yes" ]; then QtInstallDir=${QTDIR:-"/opt/qt4"} fi -QtFrameworkVersion="4" ARCH_LIST=${ARCH_LIST:-"ppc i386"} @@ -277,7 +287,16 @@ LyxAppPrefix="${LyxAppDir}.app" # --------------------------------- # don't change order here... -QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore" +case "${Qt4Version}" in +5*) + QtLibraries="QtSvg QtXml QtPrintSupport QtWidgets QtGui QtNetwork QtConcurrent QtCore" + QtFrameworkVersion="5" + ;; +*) + QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore" + QtFrameworkVersion="4" + ;; +esac DMGNAME="${LyxBase}" DMGSIZE="550m" @@ -332,7 +351,7 @@ if [ "${configure_qt4_frameworks}" != "yes" -a -d "${Qt4SourceDir}" -a ! \( -d " echo configure options: echo ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}" echo yes | "${Qt4SourceDir}"/configure ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}" - make && make install + make ${MAKEJOBS} && make install ) cd "${QtInstallDir}" && ( mkdir -p include @@ -603,12 +622,7 @@ build_lyx() { ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \ ${LyXConfigureOptions}\ --enable-build-type=rel && \ - NCPU=$(sysctl -n hw.ncpu) - NCPU=$((NCPU / 2)) - if [ $NCPU -gt 1 ]; then - NUMJOBS=-j${NCPU} - fi - make ${NUMJOBS} && make install${strip} + make ${MAKEJOBS} && make install${strip} for file in ${LYX_FILE_LIST} ; do if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then mv "${LYX_BUNDLE_PATH}/${file}"\ diff --git a/src/frontends/qt4/FancyLineEdit.cpp b/src/frontends/qt4/FancyLineEdit.cpp index 48bcf34..e0057da 100644 --- a/src/frontends/qt4/FancyLineEdit.cpp +++ b/src/frontends/qt4/FancyLineEdit.cpp @@ -17,18 +17,18 @@ #if QT_VERSION >= 0x040600 -#include <QtCore/QEvent> -#include <QtCore/QDebug> -#include <QtCore/QString> -#include <QtCore/QPropertyAnimation> -#include <QtGui/QApplication> -#include <QtGui/QMenu> -#include <QtGui/QMouseEvent> -#include <QtGui/QLabel> -#include <QtGui/QAbstractButton> -#include <QtGui/QPainter> -#include <QtGui/QStyle> -#include <QtGui/QPaintEvent> +#include <QEvent> +#include <QDebug> +#include <QString> +#include <QPropertyAnimation> +#include <QApplication> +#include <QMenu> +#include <QMouseEvent> +#include <QLabel> +#include <QAbstractButton> +#include <QPainter> +#include <QStyle> +#include <QPaintEvent> enum { margin = 6 }; diff --git a/src/frontends/qt4/FancyLineEdit.h b/src/frontends/qt4/FancyLineEdit.h index 89ef45b..ae62c85 100644 --- a/src/frontends/qt4/FancyLineEdit.h +++ b/src/frontends/qt4/FancyLineEdit.h @@ -14,8 +14,8 @@ #ifndef FANCYLINEEDIT_H #define FANCYLINEEDIT_H -#include <QtGui/QLineEdit> -#include <QtGui/QAbstractButton> +#include <QLineEdit> +#include <QAbstractButton> namespace lyx { namespace frontend { diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index f463ec1..83f1dc1 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -93,7 +93,6 @@ #include <QLocale> #include <QLibraryInfo> #include <QList> -#include <QMacPasteboardMime> #include <QMenuBar> #include <QMimeData> #include <QObject> @@ -127,6 +126,10 @@ #include <objidl.h> #endif // Q_WS_WIN +#ifdef Q_WS_MACX +#include <QMacPasteboardMime> +#endif // Q_WS_MACX + #include "support/bind.h" #include <boost/crc.hpp> diff --git a/src/frontends/qt4/GuiCompleter.cpp b/src/frontends/qt4/GuiCompleter.cpp index 7ef1a1a..0f9686a 100644 --- a/src/frontends/qt4/GuiCompleter.cpp +++ b/src/frontends/qt4/GuiCompleter.cpp @@ -90,9 +90,10 @@ public: ~GuiCompletionModel() { delete list_; } /// void setList(CompletionList const * l) { + beginResetModel(); delete list_; list_ = l; - reset(); + endResetModel(); } /// bool sorted() const @@ -444,8 +445,8 @@ void GuiCompleter::asyncUpdatePopup() // has a bad memory about it and we have to tell him again and again. QTreeView * listView = static_cast<QTreeView *>(popup()); listView->header()->setStretchLastSection(false); - listView->header()->setResizeMode(0, QHeaderView::Stretch); - listView->header()->setResizeMode(1, QHeaderView::Fixed); + setSectionResizeMode(listView->header(), 0, QHeaderView::Stretch); + setSectionResizeMode(listView->header(), 1, QHeaderView::Fixed); listView->header()->resizeSection(1, 22); // show/update popup diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 481bc09..16242c0 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1132,8 +1132,7 @@ GuiDocument::GuiDocument(GuiView & lv) numberingModule->tocTW->headerItem()->setText(0, qt_("Example")); numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered")); numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC")); - numberingModule->tocTW->header()->setResizeMode(QHeaderView::ResizeToContents); - + setSectionResizeMode(numberingModule->tocTW->header(), QHeaderView::ResizeToContents); // biblio biblioModule = new UiWidget<Ui::BiblioUi>; @@ -1327,7 +1326,7 @@ GuiDocument::GuiDocument(GuiView & lv) // Modules modulesModule = new UiWidget<Ui::ModulesUi>; modulesModule->availableLV->header()->setVisible(false); - modulesModule->availableLV->header()->setResizeMode(QHeaderView::ResizeToContents); + setSectionResizeMode(modulesModule->availableLV->header(), QHeaderView::ResizeToContents); modulesModule->availableLV->header()->setStretchLastSection(false); selectionManager = new ModuleSelectionManager(modulesModule->availableLV, diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp index 2fb1b3f..874f275 100644 --- a/src/frontends/qt4/GuiSymbols.cpp +++ b/src/frontends/qt4/GuiSymbols.cpp @@ -248,8 +248,9 @@ public: void setSymbols(QList<char_type> const & symbols) { + QAbstractItemModel::beginResetModel(); symbols_ = symbols; - QAbstractItemModel::reset(); + QAbstractItemModel::endResetModel(); } private: diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 147d842..ba99255 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -55,7 +55,9 @@ #include "frontends/WorkAreaManager.h" #include <QContextMenuEvent> +#if (QT_VERSION < 0x050000) #include <QInputContext> +#endif #include <QDrag> #include <QHelpEvent> #ifdef Q_WS_MACX @@ -674,7 +676,9 @@ void GuiWorkArea::scrollTo(int value) } // Show the cursor immediately after any operation. startBlinkingCursor(); +#ifdef Q_WS_X11 QApplication::syncX(); +#endif } @@ -794,7 +798,9 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e) return; } +#if (QT_VERSION < 0x050000) inputContext()->reset(); +#endif FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button())); diff --git a/src/frontends/qt4/LyXFileDialog.cpp b/src/frontends/qt4/LyXFileDialog.cpp index c098161..2bc7ba1 100644 --- a/src/frontends/qt4/LyXFileDialog.cpp +++ b/src/frontends/qt4/LyXFileDialog.cpp @@ -49,7 +49,7 @@ LyXFileDialog::LyXFileDialog(QString const & title, // FIXME replace that with guiApp->currentView() : QFileDialog(qApp->focusWidget(), title, path) { - setFilters(filters); + setNameFilters(filters); setWindowTitle(title); QList<QHBoxLayout *> layout = findChildren<QHBoxLayout *>(); diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 1c641a0..cd7518b 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1875,7 +1875,7 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb) QAction::MenuRole role; }; - MacMenuEntry entries[] = { + static MacMenuEntry entries[] = { {LFUN_DIALOG_SHOW, "aboutlyx", "About LyX", QAction::AboutRole}, {LFUN_DIALOG_SHOW, "prefs", "Preferences", diff --git a/src/frontends/qt4/PanelStack.cpp b/src/frontends/qt4/PanelStack.cpp index 47662a6..d006f45 100644 --- a/src/frontends/qt4/PanelStack.cpp +++ b/src/frontends/qt4/PanelStack.cpp @@ -60,7 +60,7 @@ PanelStack::PanelStack(QWidget * parent) list_->setRootIsDecorated(false); list_->setColumnCount(1); list_->header()->hide(); - list_->header()->setResizeMode(QHeaderView::ResizeToContents); + setSectionResizeMode(list_->header(), QHeaderView::ResizeToContents); list_->header()->setStretchLastSection(false); list_->setMinimumSize(list_->viewport()->size()); diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index 755d260..6320536 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -44,7 +44,11 @@ public: /// void reset() { +#if (QT_VERSION < 0x050000) QStandardItemModel::reset(); +#else + QStandardItemModel::endResetModel(); +#endif } /// void beginResetModel() diff --git a/src/frontends/qt4/qt_helpers.cpp b/src/frontends/qt4/qt_helpers.cpp index dcbd2e9..35bac8b 100644 --- a/src/frontends/qt4/qt_helpers.cpp +++ b/src/frontends/qt4/qt_helpers.cpp @@ -196,6 +196,23 @@ void setValid(QWidget * widget, bool valid) } } +/// wrapper to hide the change of method name to setSectionResizeMode +void setSectionResizeMode(QHeaderView * view, + int logicalIndex, QHeaderView::ResizeMode mode) { +#if (QT_VERSION >= 0x050000) + view->setSectionResizeMode(logicalIndex, mode); +#else + view->setResizeMode(logicalIndex, mode); +#endif +} + +void setSectionResizeMode(QHeaderView * view, QHeaderView::ResizeMode mode) { +#if (QT_VERSION >= 0x050000) + view->setSectionResizeMode(mode); +#else + view->setResizeMode(mode); +#endif +} } // namespace frontend QString const qt_(char const * str, const char *) diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h index 44e6b0e..753fdbf 100644 --- a/src/frontends/qt4/qt_helpers.h +++ b/src/frontends/qt4/qt_helpers.h @@ -18,6 +18,7 @@ #include "qt_i18n.h" #include <QString> +#include <QHeaderView> class QComboBox; class QLineEdit; @@ -66,6 +67,13 @@ void doubleToWidget(QLineEdit * input, std::string const & value, /// colors a widget red if invalid void setValid(QWidget * widget, bool valid); +/// Qt5 changed setSectionMode to setSectionResizeMode +/// These wrappers work for Qt4 and Qt5 +void setSectionResizeMode(QHeaderView * view, + int logicalIndex, QHeaderView::ResizeMode mode); +void setSectionResizeMode(QHeaderView * view, + QHeaderView::ResizeMode mode); + } // namespace frontend diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index fe081ab..96317be 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -746,7 +746,11 @@ docstring FileName::fileContents(string const & encoding) const if (encoding.empty() || encoding == "UTF-8") s = QString::fromUtf8(contents.data()); else if (encoding == "ascii") +#if (QT_VERSION < 0x050000) s = QString::fromAscii(contents.data()); +#else + s = QString::fromLatin1(contents.data()); +#endif else if (encoding == "local8bit") s = QString::fromLocal8Bit(contents.data()); else if (encoding == "latin1") diff --git a/src/support/Package.cpp b/src/support/Package.cpp index 6ea458e..dab008e 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -381,6 +381,9 @@ FileName const get_document_dir(FileName const & home_dir) (void)home_dir; // Silence warning about unused variable. os::GetFolderPath win32_folder_path; 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) (void)home_dir; // Silence warning about unused variable. return FileName(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))); @@ -647,6 +650,10 @@ FileName const get_default_user_support_dir(FileName const & home_dir) os::GetFolderPath win32_folder_path; 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::DataLocation)), PACKAGE)); + #elif defined (USE_MACOSX_PACKAGING) (void)home_dir; // Silence warning about unused variable. return FileName(addPath(fromqstr(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), PACKAGE)); commit e4d6730fca6bf3c54ae2eebe6081461119ad412d Author: Stephan Witt <[email protected]> Date: Tue Jan 22 16:13:57 2013 +0100 dynamic cpu count detection and parallel make configuration diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh index 0468dbe..8b66c7c 100644 --- a/development/LyX-Mac-binary-release.sh +++ b/development/LyX-Mac-binary-release.sh @@ -603,7 +603,12 @@ build_lyx() { ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \ ${LyXConfigureOptions}\ --enable-build-type=rel && \ - make -j2 && make install${strip} + NCPU=$(sysctl -n hw.ncpu) + NCPU=$((NCPU / 2)) + if [ $NCPU -gt 1 ]; then + NUMJOBS=-j${NCPU} + fi + make ${NUMJOBS} && make install${strip} for file in ${LYX_FILE_LIST} ; do if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then mv "${LYX_BUNDLE_PATH}/${file}"\ commit 8eea20ba4ba68f43086689bd00e4a4dbe8cc1dda Author: Stephan Witt <[email protected]> Date: Tue Jan 22 15:39:43 2013 +0100 use MKDIR_P macro diff --git a/development/MacOSX/Makefile.am b/development/MacOSX/Makefile.am index 89b1a71..ad67e8d 100644 --- a/development/MacOSX/Makefile.am +++ b/development/MacOSX/Makefile.am @@ -17,5 +17,5 @@ nodist_pkgdata_DATA = lyxrc.dist install-data-hook: LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" $(LINGUAS)`; \ for f in en $$LINGUAS_ ; do \ - mkdir -p $(pkgdatadir)/$$f.lproj ; \ + $(MKDIR_P) $(pkgdatadir)/$$f.lproj ; \ done ----------------------------------------------------------------------- Summary of changes: config/qt4.m4 | 3 ++- development/LyX-Mac-binary-release.sh | 29 ++++++++++++++++++++++++----- development/MacOSX/Makefile.am | 2 +- src/frontends/qt4/FancyLineEdit.cpp | 24 ++++++++++++------------ src/frontends/qt4/FancyLineEdit.h | 4 ++-- src/frontends/qt4/GuiApplication.cpp | 5 ++++- src/frontends/qt4/GuiCompleter.cpp | 7 ++++--- src/frontends/qt4/GuiDocument.cpp | 5 ++--- src/frontends/qt4/GuiSymbols.cpp | 3 ++- src/frontends/qt4/GuiWorkArea.cpp | 6 ++++++ src/frontends/qt4/LyXFileDialog.cpp | 2 +- src/frontends/qt4/Menus.cpp | 2 +- src/frontends/qt4/PanelStack.cpp | 2 +- src/frontends/qt4/TocModel.cpp | 4 ++++ src/frontends/qt4/qt_helpers.cpp | 17 +++++++++++++++++ src/frontends/qt4/qt_helpers.h | 8 ++++++++ src/support/FileName.cpp | 4 ++++ src/support/Package.cpp | 7 +++++++ 18 files changed, 102 insertions(+), 32 deletions(-) hooks/post-receive -- The LyX Source Repository
