[texworks] 44/73: Imported Upstream version 0.5~svn1302
This is an automated email from the git hooks/post-receive script.
preining pushed a commit to branch master
in repository texworks.
commit 55fa8d511d9cd992158119f385670c51501ca17b
Author: Atsuhito Kohda <kohda@debian.org>
Date: Fri Aug 30 15:02:31 2013 +0900
Imported Upstream version 0.5~svn1302
---
CMake/Modules/FindPoppler.cmake | 34 +++++------
CMakeLists.txt | 56 +++++++++++++++---
TeXworks.pro | 10 ++--
getSvnRev.sh | 37 ++++++------
plugins-src/TWLuaPlugin/CMakeLists.txt | 16 ++++--
plugins-src/TWLuaPlugin/TWLuaPlugin.cpp | 4 ++
plugins-src/TWLuaPlugin/TWLuaPlugin.h | 5 +-
plugins-src/TWPythonPlugin/CMakeLists.txt | 16 ++++--
plugins-src/TWPythonPlugin/TWPythonPlugin.cpp | 4 ++
plugins-src/TWPythonPlugin/TWPythonPlugin.h | 3 +
res/resfiles/scripts/Hooks/logParser.js | 25 +++++++-
src/CMakeLists.txt | 69 ++++++++++++++++++++---
src/CompletingEdit.cpp | 2 +-
src/CompletingEdit.h | 2 +
src/FindDialog.cpp | 5 ++
src/PDFDocks.h | 4 ++
src/PDFDocument.cpp | 24 +++++++-
src/PDFDocument.h | 4 ++
src/PrefsDialog.cpp | 2 +-
src/SvnRev.h | 4 +-
src/TWApp.cpp | 8 ++-
src/TWApp.h | 2 -
src/TWScript.cpp | 30 ++++++++++
src/TWScriptable.cpp | 5 +-
src/TWSystemCmd.h | 14 ++++-
src/TWUtils.cpp | 2 +-
src/TeXDocks.cpp | 1 -
src/TeXDocument.cpp | 14 +++--
testcases/logParser/tests-texlive-ubuntu/16.test | 45 +++++++++++++++
testcases/logParser/tests-texlive-ubuntu/files.js | 4 +-
30 files changed, 357 insertions(+), 94 deletions(-)
diff --git a/CMake/Modules/FindPoppler.cmake b/CMake/Modules/FindPoppler.cmake
index b1fad20..ccd27de 100644
--- a/CMake/Modules/FindPoppler.cmake
+++ b/CMake/Modules/FindPoppler.cmake
@@ -25,7 +25,7 @@ if( NOT WIN32 )
find_package(PkgConfig)
pkg_check_modules(POPPLER_PKG QUIET poppler)
- pkg_check_modules(POPPLER_QT4_PKG QUIET poppler-qt4)
+ pkg_check_modules(POPPLER_QT_PKG QUIET poppler-qt${QT_VERSION_MAJOR})
endif( NOT WIN32 )
# Check for Poppler XPDF headers (optional)
@@ -40,15 +40,10 @@ FIND_PATH(POPPLER_XPDF_INCLUDE_DIR NAMES poppler-config.h
)
IF( NOT(POPPLER_XPDF_INCLUDE_DIR) )
-
MESSAGE( STATUS "Could not find poppler-config.h, disabling support for Xpdf headers." )
-
SET( POPPLER_HAS_XPDF false )
-
ELSE( NOT(POPPLER_XPDF_INCLUDE_DIR) )
-
SET( POPPLER_HAS_XPDF true )
-
ENDIF( NOT(POPPLER_XPDF_INCLUDE_DIR) )
# Find libpoppler, libpoppler-qt4 and associated header files (Required)
@@ -77,22 +72,21 @@ ELSE ()
ENDIF ()
-FIND_PATH(POPPLER_QT4_INCLUDE_DIR NAMES poppler-qt4.h poppler-link.h
+FIND_PATH(POPPLER_QT_INCLUDE_DIR NAMES poppler-qt${QT_VERSION_MAJOR}.h poppler-link.h
PATHS
/usr/local/include
/usr/include
HINTS
- ${POPPLER_QT4_PKG_INCLUDE_DIRS} # Generated by pkg-config
+ ${POPPLER_QT_PKG_INCLUDE_DIRS} # Generated by pkg-config
PATH_SUFFIXES
poppler
- qt4
- poppler/qt4
+ qt${QT_VERSION_MAJOR}
+ poppler/qt${QT_VERSION_MAJOR}
)
-IF ( NOT(POPPLER_QT4_INCLUDE_DIR) )
- MESSAGE(STATUS "Could not find Poppler-Qt4 headers." )
+IF ( NOT(POPPLER_QT_INCLUDE_DIR) )
+ MESSAGE(STATUS "Could not find Poppler-Qt${QT_VERSION_MAJOR} headers." )
ENDIF ()
-
-FIND_LIBRARY(POPPLER_QT4_LIBRARIES NAMES poppler-qt4 ${POPPLER_QT4_PKG_LIBRARIES}
+FIND_LIBRARY(POPPLER_QT_LIBRARIES NAMES poppler-qt${QT_VERSION_MAJOR} ${POPPLER_QT_PKG_LIBRARIES}
PATHS
/usr/local
/usr
@@ -102,17 +96,17 @@ FIND_LIBRARY(POPPLER_QT4_LIBRARIES NAMES poppler-qt4 ${POPPLER_QT4_PKG_LIBRARIES
lib64
lib
)
-MARK_AS_ADVANCED(POPPLER_QT4_LIBRARIES)
-IF ( NOT(POPPLER_QT4_LIBRARIES) )
- MESSAGE(STATUS "Could not find libpoppler-qt4." )
+MARK_AS_ADVANCED(POPPLER_QT_LIBRARIES)
+IF ( NOT(POPPLER_QT_LIBRARIES) )
+ MESSAGE(STATUS "Could not find libpoppler-qt${QT_VERSION_MAJOR}." )
ENDIF ()
-LIST(APPEND POPPLER_LIBRARIES ${POPPLER_QT4_LIBRARIES})
+LIST(INSERT POPPLER_LIBRARIES 0 ${POPPLER_QT_LIBRARIES})
include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Poppler DEFAULT_MSG POPPLER_LIBRARIES POPPLER_QT4_INCLUDE_DIR )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Poppler DEFAULT_MSG POPPLER_LIBRARIES POPPLER_QT_INCLUDE_DIR )
# show the POPPLER_(XPDF/QT4)_INCLUDE_DIR and POPPLER_LIBRARIES variables only in the advanced view
-MARK_AS_ADVANCED(POPPLER_XPDF_INCLUDE_DIR POPPLER_QT4_INCLUDE_DIR POPPLER_LIBRARIES)
+MARK_AS_ADVANCED(POPPLER_XPDF_INCLUDE_DIR POPPLER_QT_INCLUDE_DIR POPPLER_LIBRARIES)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f2a782..c3c0652 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,6 +93,17 @@ STRING(REGEX MATCH "([0-9]+)" TeXworks_SVN_REV ${TeXworks_SVN_REV})
SET(TW_BUILD_ID "personal" CACHE STRING "A distribution-specific identifier for TeXworks")
+# Build shared libs by default
+IF ( NOT DEFINED BUILD_SHARED_LIBS )
+ SET(BUILD_SHARED_LIBS ON)
+ENDIF ()
+OPTION(BUILD_SHARED_LIBS "Build shared libraries?" ${BUILD_SHARED_LIBS})
+MARK_AS_ADVANCED(BUILD_SHARED_LIBS)
+
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} CACHE PATH "Path to place libraries in")
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} CACHE PATH "Path to place programs in")
+MARK_AS_ADVANCED(CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+
# On UNIX, CMake installs to `/usr/local` by default. However, Mac users
# will probably find `/Applications` a more convenient default.
IF( APPLE AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local" )
@@ -106,7 +117,7 @@ ENDIF ()
# Options controlling the creation of scripting language plugins.
OPTION(WITH_LUA "Build TeXworks Lua plugin?" ON)
-OPTION(WITH_PYTHON "Build TeXworks Python plugin?" ON)
+OPTION(WITH_PYTHON "Build TeXworks Python plugin?" OFF)
# On OS X we default to linking against the Python libraries provided by Apple
# even if other Pythons are available. This helps when building
@@ -116,6 +127,23 @@ IF ( APPLE )
OPTION(USE_SYSTEM_PYTHON "Link against Python Framework distributed with OS X?" ON)
ENDIF ()
+IF (UNIX AND NOT APPLE)
+ SET(TeXworks_HELP_DIR share/doc/texworks-help CACHE PATH "Path where TeXworks looks for help files")
+ SET(TeXworks_DIC_DIR /usr/share/myspell/dicts CACHE PATH "Path where TeXworks looks for spellchecking dictionaries")
+ SET(TeXworks_DOCS_DIR share/doc/texworks CACHE PATH "Path in which documentation files are installed")
+ SET(TeXworks_ICON_DIR share/pixmaps CACHE PATH "Path in which icons are installed")
+ SET(TeXworks_MAN_DIR share/man/man1 CACHE PATH "Path in which manpages are installed")
+ SET(TeXworks_DESKTOP_DIR share/applications CACHE PATH "Path in which .desktop files are installed")
+ MARK_AS_ADVANCED(TeXworks_HELP_DIR)
+ MARK_AS_ADVANCED(TeXworks_DIC_DIR)
+ MARK_AS_ADVANCED(TeXworks_DOCS_DIR)
+ MARK_AS_ADVANCED(TeXworks_ICON_DIR)
+ MARK_AS_ADVANCED(TeXworks_MAN_DIR)
+ MARK_AS_ADVANCED(TeXworks_DESKTOP_DIR)
+ IF (EXISTS ${TeXworks_SOURCE_DIR}/manual/)
+ INSTALL(DIRECTORY ${TeXworks_SOURCE_DIR}/manual/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${TeXworks_HELP_DIR}/ OPTIONAL)
+ ENDIF()
+ENDIF()
# Dependency Configuration
# ========================
@@ -131,7 +159,6 @@ SET (QT_COMPONENTS
QtUiTools
QtScript
QtScriptTools
- QtXML
)
IF ( UNIX AND NOT APPLE )
@@ -159,7 +186,7 @@ ENDIF ()
SET(TeXworks_INCLUDE_DIRS
${QT_INCLUDE_DIR}
${HUNSPELL_INCLUDE_DIR}
- ${POPPLER_QT4_INCLUDE_DIR}
+ ${POPPLER_QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
IF ( POPPLER_NEEDS_FONTCONFIG )
@@ -199,6 +226,15 @@ IF ( WITH_PYTHON )
ENDIF ()
ENDIF()
+IF ( LUA51_FOUND AND WITH_LUA AND NOT ${BUILD_SHARED_LIBS})
+ ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_LUA_SCRIPTING_PLUGIN)
+ENDIF ()
+
+IF ( PYTHONLIBS_FOUND AND WITH_PYTHON AND NOT ${BUILD_SHARED_LIBS})
+ ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_PYTHON_SCRIPTING_PLUGIN)
+ENDIF ()
+
+
# Update Header Templates
# -----------------------
@@ -227,10 +263,6 @@ ADD_SUBDIRECTORY(src)
# Build Plugins
# -------------
-# Set the plugin installation path. This is a good default for UNIX-like
-# systems, but is not appropriate for Windows.
-SET(TeXworks_PLUGIN_DIR lib)
-
# On OS X, the plugins should live inside the application bundle.
IF ( APPLE )
SET(TeXworks_PLUGIN_DIR ${PROJECT_NAME}.app/Contents/PlugIns)
@@ -239,15 +271,20 @@ IF ( APPLE )
# freak out about this.
SET(CMAKE_MODULE_LINKER_FLAGS
"${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS} -undefined dynamic_lookup")
+ELSE ()
+ # Set the plugin installation path. This is a good default for UNIX-like
+ # systems, but is not appropriate for Windows.
+ SET(TeXworks_PLUGIN_DIR lib/texworks CACHE PATH "Path where TeXworks looks for plugins")
+ MARK_AS_ADVANCED(TeXworks_PLUGIN_DIR)
ENDIF ()
# Build scripting language plugins if the required libraries are available.
-IF ( LUA51_FOUND )
+IF ( LUA51_FOUND AND WITH_LUA )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWLuaPlugin)
ENDIF ()
-IF ( PYTHONLIBS_FOUND )
+IF ( PYTHONLIBS_FOUND AND WITH_PYTHON )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWPythonPlugin)
ENDIF ()
@@ -346,6 +383,7 @@ MESSAGE("TeXworks has been configured:\n")
CONFIG_INFO("Version" ${TeXworks_VERSION})
CONFIG_INFO("SVN Revision" ${TeXworks_SVN_REV})
CONFIG_INFO("Build ID" ${TW_BUILD_ID})
+CONFIG_INFO("Qt version" ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
CONFIG_INFO("Compiler optimization" ${CMAKE_BUILD_TYPE})
MESSAGE("")
diff --git a/TeXworks.pro b/TeXworks.pro
index 47d74f2..43cdffc 100644
--- a/TeXworks.pro
+++ b/TeXworks.pro
@@ -68,7 +68,7 @@ unix:!macx {
isEmpty(TW_BUILD_ID):TW_BUILD_ID = personal
QMAKE_CXXFLAGS += -DTW_BUILD_ID=$$TW_BUILD_ID
-QT += xml script scripttools
+QT += script scripttools
CONFIG += rtti uitools
unix {
@@ -146,13 +146,13 @@ win32 { # paths here are specific to my setup
RC_FILE = res/TeXworks.rc
# for the Windows build, we use static plugins:
- QMAKE_CXXFLAGS += -DSTATIC_SCRIPTING_PLUGINS
-
+ QMAKE_CXXFLAGS += -DSTATIC_LUA_SCRIPTING_PLUGIN
LIBS += -Lplugins-src/TWLuaPlugin/release -lTWLuaPlugin
LIBS += -llua
- LIBS += -Lplugins-src/TWPythonPlugin/release -lTWPythonPlugin
- LIBS += -Lc:/Python26/libs -lpython26
+# QMAKE_CXXFLAGS += -DSTATIC_PYTHON_SCRIPTING_PLUGIN
+# LIBS += -Lplugins-src/TWPythonPlugin/release -lTWPythonPlugin
+# LIBS += -Lc:/Python26/libs -lpython26
}
diff --git a/getSvnRev.sh b/getSvnRev.sh
index fe0ad24..6a234c4 100755
--- a/getSvnRev.sh
+++ b/getSvnRev.sh
@@ -7,30 +7,31 @@ svn update
# get the current revision number
REV=`LANG=C svn info | fgrep Revision: | cut -d ' ' -f 2`
-
-if [ `svn status | grep -c "^[^?]"` == 0 ]; then
- # make a new SvnRev.h file
- echo "#define SVN_REVISION $REV" > src/SvnRev.h.new
- echo "#define SVN_REVISION_STR \"$REV\"" >> src/SvnRev.h.new
- # and check if it matches the existing one
- diff src/SvnRev.h.new src/SvnRev.h > /dev/null
- if [ $? == 0 ]; then
- rm src/SvnRev.h.new
- echo "revision is current"
- fi
-else
+MODIFIED=0
+if [ `svn status | grep -c "^[^?]"` -ne 0 ]; then
# if we have local modifications, we'll bump the revision number
REV=$((1+REV))
- echo "#define SVN_REVISION $REV" > src/SvnRev.h.new
- echo "#define SVN_REVISION_STR \"$REV\"" >> src/SvnRev.h.new
+ MODIFIED=1
fi
-# is there a new revision file?
-if [ -e src/SvnRev.h.new ]; then
+# make a new SvnRev.h file
+echo "#define SVN_REVISION $REV" > src/SvnRev.h.new
+echo "#define SVN_REVISION_STR \"$REV\"" >> src/SvnRev.h.new
+# and check if it matches the existing one
+diff src/SvnRev.h.new src/SvnRev.h > /dev/null
+if [ $? == 0 ]; then
+ rm src/SvnRev.h.new
+else
mv src/SvnRev.h.new src/SvnRev.h
VER=`fgrep TEXWORKS_VERSION src/TWVersion.h | cut -d '"' -f 2`
sed -e "s/@VER@/$VER/;s/@REV@/$REV/;" <TeXworks.plist.in >TeXworks.plist
cp TeXworks.plist Info.plist
- echo "revision updated"
- svn status # show status, as a reminder to commit the change(s)
+ echo "updating files...done"
fi
+
+if [ $MODIFIED -eq 1 ]; then
+ echo "There are local modifications"
+else
+ echo "revision is current"
+fi
+
diff --git a/plugins-src/TWLuaPlugin/CMakeLists.txt b/plugins-src/TWLuaPlugin/CMakeLists.txt
index bca79b7..038c82e 100644
--- a/plugins-src/TWLuaPlugin/CMakeLists.txt
+++ b/plugins-src/TWLuaPlugin/CMakeLists.txt
@@ -13,15 +13,21 @@ LINK_DIRECTORIES(${QT_LIBRARY_DIR})
# already been mocced during the build of the main program seems redundant, but
# I'm not wise enough in the ways of Qt and CMake to figure out a good
# alternative._
-QT4_WRAP_CPP(LUA_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWLuaPlugin.h)
+IF (${QT_VERSION_MAJOR} EQUAL 5)
+ QT5_WRAP_CPP(LUA_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWLuaPlugin.h)
+ELSE()
+ QT4_WRAP_CPP(LUA_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWLuaPlugin.h)
+ENDIF()
-ADD_LIBRARY(TWLuaPlugin MODULE
+ADD_LIBRARY(TWLuaPlugin
TWLuaPlugin.cpp
${TeXworks_SCRIPT_API}
${LUA_PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES(TWLuaPlugin ${QT_LIBRARIES} ${LUA_LIBRARIES})
-INSTALL(TARGETS TWLuaPlugin
- LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
-)
+IF (${BUILD_SHARED_LIBS})
+ INSTALL(TARGETS TWLuaPlugin
+ LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
+ )
+ENDIF()
diff --git a/plugins-src/TWLuaPlugin/TWLuaPlugin.cpp b/plugins-src/TWLuaPlugin/TWLuaPlugin.cpp
index e178e88..310e505 100644
--- a/plugins-src/TWLuaPlugin/TWLuaPlugin.cpp
+++ b/plugins-src/TWLuaPlugin/TWLuaPlugin.cpp
@@ -48,7 +48,9 @@ TWScript* TWLuaPlugin::newScript(const QString& fileName)
return new LuaScript(this, fileName);
}
+#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(TWLuaPlugin, TWLuaPlugin)
+#endif
bool LuaScript::execute(TWScriptAPI *tw) const
@@ -189,8 +191,10 @@ int LuaScript::pushVariant(lua_State * L, const QVariant & v, const bool throwEr
return 1;
case QMetaType::QObjectStar:
return LuaScript::pushQObject(L, v.value<QObject*>(), throwError);
+ #if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
return LuaScript::pushQObject(L, qobject_cast<QObject*>(v.value<QWidget*>()), throwError);
+ #endif
default:
// Don't throw errors if we are not in protected mode in lua, i.e.
// if the call to this function originated from C code, not in response
diff --git a/plugins-src/TWLuaPlugin/TWLuaPlugin.h b/plugins-src/TWLuaPlugin/TWLuaPlugin.h
index 0b88f51..b025a28 100644
--- a/plugins-src/TWLuaPlugin/TWLuaPlugin.h
+++ b/plugins-src/TWLuaPlugin/TWLuaPlugin.h
@@ -35,7 +35,10 @@ class TWLuaPlugin : public QObject, public TWScriptLanguageInterface
{
Q_OBJECT
Q_INTERFACES(TWScriptLanguageInterface)
-
+#if QT_VERSION >= 0x050000
+ Q_PLUGIN_METADATA(IID "org.tug.texworks.ScriptPlugins.LuaPlugin")
+#endif
+
public:
/** \brief Constructor
*
diff --git a/plugins-src/TWPythonPlugin/CMakeLists.txt b/plugins-src/TWPythonPlugin/CMakeLists.txt
index 2b9c075..6f23983 100644
--- a/plugins-src/TWPythonPlugin/CMakeLists.txt
+++ b/plugins-src/TWPythonPlugin/CMakeLists.txt
@@ -13,15 +13,21 @@ LINK_DIRECTORIES(${QT_LIBRARY_DIR})
# already been mocced during the build of the main program seems redundant, but
# I'm not wise enough in the ways of Qt and CMake to figure out an
# alternative._
-QT4_WRAP_CPP(PYTHON_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWPythonPlugin.h)
+IF (${QT_VERSION_MAJOR} EQUAL 5)
+ QT5_WRAP_CPP(PYTHON_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWPythonPlugin.h)
+ELSE()
+ QT4_WRAP_CPP(PYTHON_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWPythonPlugin.h)
+ENDIF()
-ADD_LIBRARY(TWPythonPlugin MODULE
+ADD_LIBRARY(TWPythonPlugin
TWPythonPlugin.cpp
${TeXworks_SCRIPT_API}
${PYTHON_PLUGIN_MOC}
)
TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${PYTHON_LIBRARIES})
-INSTALL(TARGETS TWPythonPlugin
- LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
-)
+IF (${BUILD_SHARED_LIBS})
+ INSTALL(TARGETS TWPythonPlugin
+ LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
+ )
+ENDIF()
diff --git a/plugins-src/TWPythonPlugin/TWPythonPlugin.cpp b/plugins-src/TWPythonPlugin/TWPythonPlugin.cpp
index 8fc9c5c..befcd4e 100644
--- a/plugins-src/TWPythonPlugin/TWPythonPlugin.cpp
+++ b/plugins-src/TWPythonPlugin/TWPythonPlugin.cpp
@@ -100,7 +100,9 @@ TWScript* TWPythonPlugin::newScript(const QString& fileName)
return new PythonScript(this, fileName);
}
+#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(TWPythonPlugin, TWPythonPlugin)
+#endif
bool PythonScript::execute(TWScriptAPI *tw) const
@@ -446,8 +448,10 @@ PyObject * PythonScript::VariantToPython(const QVariant & v)
return pyDict;
case QMetaType::QObjectStar:
return PythonScript::QObjectToPython(v.value<QObject*>());
+#if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
return PythonScript::QObjectToPython(qobject_cast<QObject*>(v.value<QWidget*>()));
+#endif
default:
PyErr_Format(PyExc_TypeError, qPrintable(tr("the type %s is currently not supported")), v.typeName());
return NULL;
diff --git a/plugins-src/TWPythonPlugin/TWPythonPlugin.h b/plugins-src/TWPythonPlugin/TWPythonPlugin.h
index 7224ab3..ea97298 100644
--- a/plugins-src/TWPythonPlugin/TWPythonPlugin.h
+++ b/plugins-src/TWPythonPlugin/TWPythonPlugin.h
@@ -39,6 +39,9 @@ class TWPythonPlugin : public QObject, public TWScriptLanguageInterface
{
Q_OBJECT
Q_INTERFACES(TWScriptLanguageInterface)
+#if QT_VERSION >= 0x050000
+ Q_PLUGIN_METADATA(IID "org.tug.texworks.ScriptPlugins.PythonPlugin")
+#endif
public:
/** \brief Constructor
diff --git a/res/resfiles/scripts/Hooks/logParser.js b/res/resfiles/scripts/Hooks/logParser.js
index 5c8d02e..05096de 100644
--- a/res/resfiles/scripts/Hooks/logParser.js
+++ b/res/resfiles/scripts/Hooks/logParser.js
@@ -2,8 +2,8 @@
// Title: Errors, warnings, badboxes
// Description: Looks for errors, warnings or badboxes in the LaTeX terminal output
// Author: Jonathan Kew, Stefan Löffler, Antonio Macrì, Henrik Skov Midtiby
-// Version: 0.8.5
-// Date: 2012-10-20
+// Version: 0.8.6
+// Date: 2013-07-05
// Script-Type: hook
// Hook: AfterTypeset
@@ -151,6 +151,27 @@ function LogParser()
}
},
{
+ // This pattern recognizes tight/loose boxes in paragraphs with context given on one, two or more lines.
+ Regex: new RegExp("^((?:Tight|Loose) \\\\hbox\\s*\\([^)]+\\) in paragraph at lines (\\d+)--\\d+\n)((?:.{" + max_print_line + "}\n)*)(.*)"),
+ Callback: function(m, f) {
+ return new Result(Severity.BadBox, f, m[2], (m[1] + m[3].replace(/\n/g, '') + m[4]).trimRight());
+ }
+ },
+ {
+ // This pattern recognizes tight/loose boxes without context, but with line numbers
+ Regex: new RegExp("^(?:Tight|Loose) \\\\[hv]box\\s*\\([^)]+\\) (?:detected at line (\\d+)|in alignment at lines (\\d+)--\\d+)\n"),
+ Callback: function(m, f) {
+ return new Result(Severity.BadBox, f, m[1] || m[2], m[0].trimRight());
+ }
+ },
+ {
+ // This pattern recognizes tight/loose boxes without context and line numbers
+ Regex: new RegExp("^(?:Tight|Loose) \\\\[hv]box\\s*\\([^)]+\\) has occurred while \\\\output is active\\b"),
+ Callback: function(m, f) {
+ return new Result(Severity.BadBox, f, 0, m[0]);
+ }
+ },
+ {
// \show and \showthe
Regex: new RegExp("^>\\s(.+(?:\\.|=(?:\\\\long\\s)?macro:)\n(?:.*\n)*?l\\.(\\d+)\\s.*)\n"),
Callback: function(m, f) {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02dd088..698e2f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -64,6 +64,23 @@ INCLUDE_DIRECTORIES(${TeXworks_INCLUDE_DIRS})
LINK_DIRECTORIES(${TeXworks_LIB_DIRS})
ADD_DEFINITIONS(-DTW_BUILD_ID=${TW_BUILD_ID})
+IF (UNIX AND NOT APPLE)
+ IF (IS_ABSOLUTE ${TeXworks_HELP_DIR})
+ ADD_DEFINITIONS(-DTW_HELPPATH="${TeXworks_HELP_DIR}")
+ ELSE ()
+ ADD_DEFINITIONS(-DTW_HELPPATH="${CMAKE_INSTALL_PREFIX}/${TeXworks_HELP_DIR}")
+ ENDIF ()
+ IF (IS_ABSOLUTE ${TeXworks_PLUGIN_DIR})
+ ADD_DEFINITIONS(-DTW_PLUGINPATH="${TeXworks_PLUGIN_DIR}")
+ ELSE ()
+ ADD_DEFINITIONS(-DTW_PLUGINPATH="${CMAKE_INSTALL_PREFIX}/${TeXworks_PLUGIN_DIR}")
+ ENDIF ()
+ IF (IS_ABSOLUTE ${TeXworks_DIC_DIR})
+ ADD_DEFINITIONS(-DTW_DICPATH="${TeXworks_DIC_DIR}")
+ ELSE ()
+ ADD_DEFINITIONS(-DTW_DICPATH="${CMAKE_INSTALL_PREFIX}/${TeXworks_DIC_DIR}")
+ ENDIF ()
+ENDIF ()
# Poppler supports XPDF API calls?
IF (POPPLER_HAS_XPDF)
@@ -75,14 +92,25 @@ ENDIF ()
# Qt-Specific Source Code Processing
# ----------------------------------
-# Run moc on header files.
-QT4_WRAP_CPP(TEXWORKS_GEN_MOC ${TEXWORKS_MOC_HDRS})
-# Run uic on user interface files.
-QT4_WRAP_UI(TEXWORKS_GEN_UI ${TEXWORKS_UIS})
-# Run rcc on reasource files.
-QT4_ADD_RESOURCES(TEXWORKS_GEN_RCS ${TEXWORKS_RCS})
-# Prep language translations.
-QT4_ADD_TRANSLATION(TEXWORKS_GEN_TRANS ${TEXWORKS_TRANS})
+IF (${QT_VERSION_MAJOR} EQUAL 5)
+ # Run moc on header files.
+ QT5_WRAP_CPP(TEXWORKS_GEN_MOC ${TEXWORKS_MOC_HDRS})
+ # Run uic on user interface files.
+ QT5_WRAP_UI(TEXWORKS_GEN_UI ${TEXWORKS_UIS})
+ # Run rcc on reasource files.
+ QT5_ADD_RESOURCES(TEXWORKS_GEN_RCS ${TEXWORKS_RCS})
+ # Prep language translations.
+ QT5_ADD_TRANSLATION(TEXWORKS_GEN_TRANS ${TEXWORKS_TRANS})
+ELSE()
+ # Run moc on header files.
+ QT4_WRAP_CPP(TEXWORKS_GEN_MOC ${TEXWORKS_MOC_HDRS})
+ # Run uic on user interface files.
+ QT4_WRAP_UI(TEXWORKS_GEN_UI ${TEXWORKS_UIS})
+ # Run rcc on reasource files.
+ QT4_ADD_RESOURCES(TEXWORKS_GEN_RCS ${TEXWORKS_RCS})
+ # Prep language translations.
+ QT4_ADD_TRANSLATION(TEXWORKS_GEN_TRANS ${TEXWORKS_TRANS})
+ENDIF()
IF ( APPLE OR NOT UNIX )
SET(EXE_NAME TeXworks)
@@ -93,6 +121,15 @@ ENDIF ( APPLE OR NOT UNIX )
# Compilation
# -----------
+IF (NOT ${BUILD_SHARED_LIBS})
+ IF (WITH_LUA)
+ LIST(APPEND TeXworks_LIBS TWLuaPlugin)
+ ENDIF()
+ IF (WITH_PYTHON)
+ LIST(APPEND TeXworks_LIBS TWPythonPlugin)
+ ENDIF()
+ENDIF()
+
# Build the executible.
ADD_EXECUTABLE( ${EXE_NAME} ${GUI_TYPE}
${TEXWORKS_SRCS}
@@ -118,6 +155,9 @@ IF (APPLE)
)
ENDIF ()
+IF (${QT_VERSION_MAJOR} EQUAL 5 AND UNIX)
+ SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES COMPILE_FLAGS -fPIC)
+ENDIF ()
# Installation
# ------------
@@ -126,6 +166,17 @@ INSTALL( TARGETS ${EXE_NAME}
BUNDLE DESTINATION . COMPONENT
)
+IF ( UNIX AND NOT APPLE )
+ INSTALL(FILES ${TeXworks_SOURCE_DIR}/res/images/TeXworks.png DESTINATION ${CMAKE_INSTALL_PREFIX}/${TeXworks_ICON_DIR})
+ INSTALL(FILES
+ ${TeXworks_SOURCE_DIR}/COPYING
+ ${TeXworks_SOURCE_DIR}/README
+ ${TeXworks_SOURCE_DIR}/NEWS
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${TeXworks_DOCS_DIR})
+ INSTALL(FILES ${TeXworks_SOURCE_DIR}/man/texworks.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/${TeXworks_MAN_DIR})
+ INSTALL(FILES ${TeXworks_SOURCE_DIR}/texworks.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/${TeXworks_DESKTOP_DIR})
+ENDIF ( UNIX AND NOT APPLE )
+
# On OS X, ensure there is always a `qt.conf` file as all hell will break loose
# if one isn't there. This may need to be customized for use on non-Apple
# systems.
@@ -139,7 +190,7 @@ IF ( APPLE )
INSTALL( CODE
"
- FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DIR}/qt.conf\"
+ FILE(WRITE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${QTCONF_DIR}/qt.conf\"
\"${QTCONF_CONTENTS}\"
)
"
diff --git a/src/CompletingEdit.cpp b/src/CompletingEdit.cpp
index 5f59cb8..a5b1345 100644
--- a/src/CompletingEdit.cpp
+++ b/src/CompletingEdit.cpp
@@ -227,7 +227,7 @@ void CompletingEdit::mouseMoveEvent(QMouseEvent *e)
// need to make sure that the source text is removed
// (inserting the text in the target has already
// been completed at this point)
- bool insideWindow = (drag->target() && (this == drag->target() || this->isAncestorOf(drag->target())));
+ bool insideWindow = (drag->target() && (this == drag->target() || this->isAncestorOf(qobject_cast<QWidget*>(drag->target()))));
bool insideSelection = (insideWindow && droppedOffset >= sourceStart && droppedOffset <= sourceEnd);
if (insideSelection) {
// The text was dropped into the same window at
diff --git a/src/CompletingEdit.h b/src/CompletingEdit.h
index 94a7449..af56941 100644
--- a/src/CompletingEdit.h
+++ b/src/CompletingEdit.h
@@ -25,6 +25,8 @@
#include <QTextEdit>
#include <QHash>
#include <QTimer>
+#include <QDrag>
+#include <QMimeData>
#include <hunspell.h>
diff --git a/src/FindDialog.cpp b/src/FindDialog.cpp
index 3d5132c..18a6ad8 100644
--- a/src/FindDialog.cpp
+++ b/src/FindDialog.cpp
@@ -542,8 +542,13 @@ void SearchResults::presentResults(const QString& searchText,
}
resultsWindow->table->setHorizontalHeaderLabels(QStringList() << tr("File") << tr("Line") << tr("Start") << tr("End") << tr("Text"));
+ #if QT_VERSION >= 0x050000
+ resultsWindow->table->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch);
+ resultsWindow->table->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ #else
resultsWindow->table->horizontalHeader()->setResizeMode(4, QHeaderView::Stretch);
resultsWindow->table->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
+ #endif
resultsWindow->table->verticalHeader()->hide();
resultsWindow->table->setColumnHidden(2, true);
resultsWindow->table->setColumnHidden(3, true);
diff --git a/src/PDFDocks.h b/src/PDFDocks.h
index dc8dd6c..23af1b2 100644
--- a/src/PDFDocks.h
+++ b/src/PDFDocks.h
@@ -27,7 +27,11 @@
#include <QListWidget>
#include <QScrollArea>
+#if QT_VERSION < 0x050000
#include "poppler-qt4.h"
+#else
+#include "poppler-qt5.h"
+#endif
class PDFDocument;
class QListWidget;
diff --git a/src/PDFDocument.cpp b/src/PDFDocument.cpp
index 3b52048..7e4ab61 100644
--- a/src/PDFDocument.cpp
+++ b/src/PDFDocument.cpp
@@ -231,6 +231,12 @@ void PDFWidget::setDocument(Poppler::Document *doc)
void PDFWidget::windowResized()
{
+ // the fitting functions below may trigger resize events (e.g., if scroll
+ // bars are shown/hidden as a result of resizing the page image). To avoid
+ // infinite loops of resize events, disconnect the event here and reconnect
+ // it in the end.
+ disconnect(parent()->parent(), SIGNAL(resized()), this, SLOT(windowResized()));
+
switch (scaleOption) {
case kFixedMag:
break;
@@ -241,7 +247,10 @@ void PDFWidget::windowResized()
fitWindow(true);
break;
}
+ // Ensure all resizing is finished before reconnecting the resize event.
update();
+ QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
+ connect(parent()->parent(), SIGNAL(resized()), this, SLOT(windowResized()));
}
void PDFWidget::paintEvent(QPaintEvent *event)
@@ -482,7 +491,7 @@ void PDFWidget::doLink(const Poppler::Link *link)
{
const Poppler::LinkBrowse *browse = dynamic_cast<const Poppler::LinkBrowse*>(link);
Q_ASSERT(browse != NULL);
- QUrl url = QUrl::fromEncoded(browse->url().toAscii());
+ QUrl url = QUrl::fromEncoded(browse->url().toLatin1());
if (url.scheme() == "file") {
PDFDocument *doc = qobject_cast<PDFDocument*>(window());
if (doc) {
@@ -925,9 +934,15 @@ void PDFWidget::doPageDialog()
return;
bool ok;
setCursor(Qt::ArrowCursor);
+ #if QT_VERSION >= 0x050000
+ int pageNo = QInputDialog::getInt(this, tr("Go to Page"),
+ tr("Page number:"), pageIndex + 1,
+ 1, document->numPages(), 1, &ok);
+ #else
int pageNo = QInputDialog::getInteger(this, tr("Go to Page"),
tr("Page number:"), pageIndex + 1,
1, document->numPages(), 1, &ok);
+ #endif
if (ok)
goToPage(pageNo - 1);
}
@@ -1773,7 +1788,14 @@ void PDFDocument::doFindAgain(bool newSearch /* = false */)
for (pageIdx = firstPage; pageIdx != lastPage; pageIdx += deltaPage) {
page = document->page(pageIdx);
+ #if QT_VERSION >= 0x050000
+ double left, top, bottom, right;
+ lastSearchResult.selRect.getCoords(&left, &top, &right, &bottom);
+ if (page->search(searchText, left, top, right, bottom, searchDir, searchMode)) {
+ lastSearchResult.selRect.setCoords(left, top, right, bottom);
+ #else
if (page->search(searchText, lastSearchResult.selRect, searchDir, searchMode)) {
+ #endif
lastSearchResult.doc = this;
lastSearchResult.pageIdx = pageIdx;
QPainterPath p;
diff --git a/src/PDFDocument.h b/src/PDFDocument.h
index 86cebe3..f0c04e9 100644
--- a/src/PDFDocument.h
+++ b/src/PDFDocument.h
@@ -35,7 +35,11 @@
#include "TWApp.h"
#include "FindDialog.h"
+#if QT_VERSION < 0x050000
#include "poppler-qt4.h"
+#else
+#include "poppler-qt5.h"
+#endif
#include "synctex_parser.h"
#include "ui_PDFDocument.h"
diff --git a/src/PrefsDialog.cpp b/src/PrefsDialog.cpp
index 2461445..6342a4d 100644
--- a/src/PrefsDialog.cpp
+++ b/src/PrefsDialog.cpp
@@ -672,7 +672,7 @@ QDialog::DialogCode PrefsDialog::doPrefsDialog(QWidget *parent)
font = QFont(dlg.editorFont->currentText());
font.setPointSize(dlg.fontSize->value());
settings.setValue("font", font.toString());
- TWApp::instance()->setDefaultCodec(QTextCodec::codecForName(dlg.encoding->currentText().toAscii()));
+ TWApp::instance()->setDefaultCodec(QTextCodec::codecForName(dlg.encoding->currentText().toLatin1()));
if (dlg.language->currentIndex() >= 0) {
QVariant data = dlg.language->itemData(dlg.language->currentIndex());
if (data.isValid())
diff --git a/src/SvnRev.h b/src/SvnRev.h
index 3c0193b..082d2af 100644
--- a/src/SvnRev.h
+++ b/src/SvnRev.h
@@ -1,2 +1,2 @@
-#define SVN_REVISION 1286
-#define SVN_REVISION_STR "1286"
+#define SVN_REVISION 1300
+#define SVN_REVISION_STR "1300"
diff --git a/src/TWApp.cpp b/src/TWApp.cpp
index d3966cc..6425bc9 100644
--- a/src/TWApp.cpp
+++ b/src/TWApp.cpp
@@ -186,7 +186,7 @@ void TWApp::init()
recentFilesLimit = settings.value("maxRecentFiles", kDefaultMaxRecentFiles).toInt();
QString codecName = settings.value("defaultEncoding", "UTF-8").toString();
- defaultCodec = QTextCodec::codecForName(codecName.toAscii());
+ defaultCodec = QTextCodec::codecForName(codecName.toLatin1());
if (defaultCodec == NULL)
defaultCodec = QTextCodec::codecForName("UTF-8");
@@ -1188,7 +1188,6 @@ void TWApp::createMessageTarget(QWidget* aWindow)
}
#endif
-#ifdef Q_WS_X11
void TWApp::bringToFront()
{
foreach (QWidget* widget, topLevelWidgets()) {
@@ -1199,7 +1198,6 @@ void TWApp::bringToFront()
}
}
}
-#endif
QList<QVariant> TWApp::getOpenWindows() const
{
@@ -1225,9 +1223,11 @@ void TWApp::setGlobal(const QString& key, const QVariant& val)
case QMetaType::QObjectStar:
connect(v.value<QObject*>(), SIGNAL(destroyed(QObject*)), this, SLOT(globalDestroyed(QObject*)));
break;
+ #if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
connect((QWidget*)v.data(), SIGNAL(destroyed(QObject*)), this, SLOT(globalDestroyed(QObject*)));
break;
+ #endif
default: break;
}
m_globals[key] = v;
@@ -1245,12 +1245,14 @@ void TWApp::globalDestroyed(QObject * obj)
else
++i;
break;
+ #if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
if (i.value().value<QWidget*>() == obj)
i = m_globals.erase(i);
else
++i;
break;
+ #endif
default:
++i;
break;
diff --git a/src/TWApp.h b/src/TWApp.h
index 8159716..17805b8 100644
--- a/src/TWApp.h
+++ b/src/TWApp.h
@@ -121,9 +121,7 @@ public:
static QString GetWindowsVersionString();
static unsigned int GetWindowsVersion();
#endif
-#ifdef Q_WS_X11
void bringToFront();
-#endif
QObject* openFile(const QString& fileName, const int pos = -1);
Q_INVOKABLE
diff --git a/src/TWScript.cpp b/src/TWScript.cpp
index 06777b2..bd84c9a 100644
--- a/src/TWScript.cpp
+++ b/src/TWScript.cpp
@@ -188,8 +188,13 @@ TWScript::PropertyResult TWScript::doGetProperty(const QObject * obj, const QStr
// if we didn't find a property maybe it's a method
if (iProp < 0) {
for (i = 0; i < obj->metaObject()->methodCount(); ++i) {
+ #if QT_VERSION >= 0x050000
+ if (QString(obj->metaObject()->method(i).methodSignature()).startsWith(name + "("))
+ return Property_Method;
+ #else
if (QString(obj->metaObject()->method(i).signature()).startsWith(name + "("))
return Property_Method;
+ #endif
}
return Property_DoesNotExist;
}
@@ -253,8 +258,13 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
for (i = 0; i < mo->methodCount(); ++i) {
mm = mo->method(i);
// Check for the method name
+ #if QT_VERSION >= 0x050000
+ if (!QString(mm.methodSignature()).startsWith(name + "("))
+ continue;
+ #else
if (!QString(mm.signature()).startsWith(name + "("))
continue;
+ #endif
// we can only call public methods
if (mm.access() != QMetaMethod::Public)
continue;
@@ -279,6 +289,10 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
if (arguments[j].canConvert((QVariant::Type)type))
continue;
// allow invalid===NULL for pointers
+ #if QT_VERSION >= 0x050000
+ if (typeOfArg == QVariant::Invalid && type == QMetaType::QObjectStar)
+ continue;
+ #else
if (typeOfArg == QVariant::Invalid && (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar))
continue;
// QObject* and QWidget* may be convertible
@@ -286,6 +300,7 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
continue;
if (typeOfArg == QMetaType::QObjectStar && type == QMetaType::QWidgetStar && (arguments[j].value<QObject*>() == NULL || qobject_cast<QWidget*>(arguments[j].value<QObject*>())))
continue;
+ #endif
break;
}
if (j < arguments.count())
@@ -307,6 +322,12 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
}
if (arguments[j].canConvert((QVariant::Type)type))
arguments[j].convert((QVariant::Type)type);
+ #if QT_VERSION >= 0x050000
+ else if (typeOfArg == QVariant::Invalid && type == QMetaType::QObjectStar) {
+ genericArgs.append(QGenericArgument(strTypeName, &myNullPtr));
+ continue;
+ }
+ #else
else if (typeOfArg == QVariant::Invalid && (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar)) {
genericArgs.append(QGenericArgument(strTypeName, &myNullPtr));
continue;
@@ -315,6 +336,7 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
arguments[j] = QVariant::fromValue(qobject_cast<QObject*>(arguments[j].value<QWidget*>()));
else if (typeOfArg == QMetaType::QObjectStar && type == QMetaType::QWidgetStar && (arguments[j].value<QObject*>() == NULL || qobject_cast<QWidget*>(arguments[j].value<QObject*>())))
arguments[j] = QVariant::fromValue(qobject_cast<QWidget*>(arguments[j].value<QObject*>()));
+ #endif
// \TODO handle failure during conversion
else { }
@@ -341,7 +363,11 @@ TWScript::MethodResult TWScript::doCallMethod(QObject * obj, const QString& name
// Note: These two lines are a hack!
// QGenericReturnArgument should not be constructed directly; if
// this ever causes problems, think of another (better) way to do this
+ #if QT_VERSION >= 0x050000
+ retValBuffer = QMetaType::create(QMetaType::type(mm.typeName()));
+ #else
retValBuffer = QMetaType::construct(QMetaType::type(mm.typeName()));
+ #endif
retValArg = QGenericReturnArgument(mm.typeName(), retValBuffer);
}
@@ -399,9 +425,11 @@ void TWScript::setGlobal(const QString& key, const QVariant& val)
case QMetaType::QObjectStar:
connect(v.value<QObject*>(), SIGNAL(destroyed(QObject*)), this, SLOT(globalDestroyed(QObject*)));
break;
+ #if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
connect((QWidget*)v.data(), SIGNAL(destroyed(QObject*)), this, SLOT(globalDestroyed(QObject*)));
break;
+ #endif
default: break;
}
m_globals[key] = v;
@@ -419,12 +447,14 @@ void TWScript::globalDestroyed(QObject * obj)
else
++i;
break;
+ #if QT_VERSION < 0x050000
case QMetaType::QWidgetStar:
if (i.value().value<QWidget*>() == obj)
i = m_globals.erase(i);
else
++i;
break;
+ #endif
default:
++i;
break;
diff --git a/src/TWScriptable.cpp b/src/TWScriptable.cpp
index cd32b50..2fbcc80 100644
--- a/src/TWScriptable.cpp
+++ b/src/TWScriptable.cpp
@@ -38,9 +38,12 @@
#include <QtScriptTools>
#endif
-#ifdef STATIC_SCRIPTING_PLUGINS
+#if STATIC_LUA_SCRIPTING_PLUGIN
#include <QtPlugin>
Q_IMPORT_PLUGIN(TWLuaPlugin)
+#endif
+#if STATIC_PYTHON_SCRIPTING_PLUGIN
+#include <QtPlugin>
Q_IMPORT_PLUGIN(TWPythonPlugin)
#endif
diff --git a/src/TWSystemCmd.h b/src/TWSystemCmd.h
index 48f4947..0220ac4 100644
--- a/src/TWSystemCmd.h
+++ b/src/TWSystemCmd.h
@@ -37,6 +37,7 @@ public:
connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)));
finishedSuccessfully = false;
+ finished = false;
}
virtual ~TWSystemCmd() {}
@@ -46,24 +47,32 @@ public:
// unlike the QProcess version, this returns true if the process has already
// finished when the function is called
bool waitForStarted(int msecs = 30000) {
- return (QProcess::waitForStarted(msecs) || finishedSuccessfully);
+ if (finished)
+ return finishedSuccessfully;
+ else
+ return QProcess::waitForStarted(msecs);
}
// replacement of QProcess::waitForFinished()
// unlike the QProcess version, this returns true if the process has already
// finished when the function is called
bool waitForFinished(int msecs = 30000) {
- return (QProcess::waitForFinished(msecs) || finishedSuccessfully);
+ if (finished)
+ return finishedSuccessfully;
+ else
+ return QProcess::waitForFinished(msecs);
}
private slots:
void processError(QProcess::ProcessError error) {
+ finished = true;
if (wantOutput)
result = tr("ERROR: failure code %1").arg(error);
if (deleteOnFinish)
deleteLater();
}
void processFinished(int exitCode, QProcess::ExitStatus exitStatus) {
+ finished = true;
finishedSuccessfully = (exitStatus == QProcess::NormalExit);
if (wantOutput) {
if (exitStatus == QProcess::NormalExit) {
@@ -89,6 +98,7 @@ private slots:
private:
bool wantOutput;
bool deleteOnFinish;
+ bool finished;
bool finishedSuccessfully;
QString result;
};
diff --git a/src/TWUtils.cpp b/src/TWUtils.cpp
index f195101..338e610 100644
--- a/src/TWUtils.cpp
+++ b/src/TWUtils.cpp
@@ -1275,7 +1275,7 @@ FileVersionDatabase FileVersionDatabase::load(const QString & path)
if (line.startsWith('#')) continue;
rec.version = line.section(' ', 0, 0).toUInt();
- rec.hash = QByteArray::fromHex(line.section(' ', 1, 1).toAscii());
+ rec.hash = QByteArray::fromHex(line.section(' ', 1, 1).toLatin1());
rec.filePath = line.section(' ', 2).trimmed();
rec.filePath = rootDir.absoluteFilePath(rec.filePath.filePath());
retVal.m_records.append(rec);
diff --git a/src/TeXDocks.cpp b/src/TeXDocks.cpp
index b277c9e..ad75ba6 100644
--- a/src/TeXDocks.cpp
+++ b/src/TeXDocks.cpp
@@ -26,7 +26,6 @@
#include <QTreeWidget>
#include <QHeaderView>
#include <QScrollBar>
-#include <QDomNode>
TeXDock::TeXDock(const QString& title, TeXDocument *doc)
: QDockWidget(title, doc), document(doc), filled(false)
diff --git a/src/TeXDocument.cpp b/src/TeXDocument.cpp
index 9d9ef84..6e29e3b 100644
--- a/src/TeXDocument.cpp
+++ b/src/TeXDocument.cpp
@@ -926,7 +926,7 @@ QTextCodec *TeXDocument::scanForEncoding(const QString &peekStr, bool &hasMetada
if (pos > -1) {
hasMetadata = true;
reqName = re.cap(1).trimmed();
- reqCodec = QTextCodec::codecForName(reqName.toAscii());
+ reqCodec = QTextCodec::codecForName(reqName.toLatin1());
if (reqCodec == NULL) {
static QHash<QString,QString> *synonyms = NULL;
if (synonyms == NULL) {
@@ -935,7 +935,7 @@ QTextCodec *TeXDocument::scanForEncoding(const QString &peekStr, bool &hasMetada
synonyms->insert(QString(texshopSynonyms[i]).toLower(), texshopSynonyms[i+1]);
}
if (synonyms->contains(reqName.toLower()))
- reqCodec = QTextCodec::codecForName(synonyms->value(reqName.toLower()).toAscii());
+ reqCodec = QTextCodec::codecForName(synonyms->value(reqName.toLower()).toLatin1());
}
}
else
@@ -990,7 +990,7 @@ QString TeXDocument::readFile(const QString &fileName,
"It will be interpreted as %3 instead, which may result in incorrect text.")
.arg(reqName)
.arg(fileName)
- .arg(QString::fromAscii((*codecUsed)->name())),
+ .arg(QString::fromLatin1((*codecUsed)->name())),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok) == QMessageBox::Cancel)
return QString();
}
@@ -1643,7 +1643,7 @@ void TeXDocument::encodingPopup(const QPoint loc)
; // FIXME
}
else {
- QTextCodec *newCodec = QTextCodec::codecForName(result->text().toAscii());
+ QTextCodec *newCodec = QTextCodec::codecForName(result->text().toLatin1());
if (newCodec && newCodec != codec) {
codec = newCodec;
showEncodingSetting();
@@ -1756,9 +1756,15 @@ void TeXDocument::doLineDialog()
QTextCursor cursor = textEdit->textCursor();
cursor.setPosition(cursor.selectionStart());
bool ok;
+ #if QT_VERSION >= 0x050000
+ int lineNo = QInputDialog::getInt(this, tr("Go to Line"),
+ tr("Line number:"), cursor.blockNumber() + 1,
+ 1, textEdit->document()->blockCount(), 1, &ok);
+ #else
int lineNo = QInputDialog::getInteger(this, tr("Go to Line"),
tr("Line number:"), cursor.blockNumber() + 1,
1, textEdit->document()->blockCount(), 1, &ok);
+ #endif
if (ok)
goToLine(lineNo);
}
diff --git a/testcases/logParser/tests-texlive-ubuntu/16.test b/testcases/logParser/tests-texlive-ubuntu/16.test
new file mode 100644
index 0000000..e909b85
--- /dev/null
+++ b/testcases/logParser/tests-texlive-ubuntu/16.test
@@ -0,0 +1,45 @@
+[
+ {
+ "Severity":Severity.BadBox,"File":"./untitled-1.tex","Row":4,
+ "Description":"Underfull \\hbox (badness 10000) in paragraph at lines 4--5\n[][]\\OT1/cmr/m/n/42.99 Crazy for-"
+ },
+ {
+ "Severity":Severity.BadBox,"File":"./untitled-1.tex","Row":4,
+ "Description":"Underfull \\hbox (badness 10000) in paragraph at lines 4--5\n\\OT1/cmr/m/n/42.99 mat-ting"
+ },
+ {
+ "Severity":Severity.BadBox,"File":"./untitled-1.tex","Row":4,
+ "Description":"Tight \\hbox (badness 57) in paragraph at lines 4--5\n\\OT1/cmr/m/n/42.99 leads to crazy"
+ },
+]
+-----BEGIN OUTPUT BLOCK-----
+This is LuaTeX, Version beta-0.70.2-2012052410 (TeX Live 2012)
+ restricted \write18 enabled.
+(./untitled-1.tex
+LaTeX2e <2011/06/27>
+LuaTeX adaptation of babel <v3.8m-luatex-1.5> and hyphenation patterns for engl
+ish, dumylang, nohyphenation, loaded.
+(/usr/local/texlive/2011/texmf-dist/tex/latex/extsizes/extarticle.cls
+Document Class: extarticle 1996/10/08 v1.0 Non Standard LaTeX document class
+(/usr/local/texlive/2011/texmf-dist/tex/latex/extsizes/size20.clo)
+(/usr/local/texlive/201/texmf-dist/tex/latex/base/exscale.sty))
+(./untitled-1.aux)
+Underfull \hbox (badness 10000) in paragraph at lines 4--5
+[][]\OT1/cmr/m/n/42.99 Crazy for-
+
+Underfull \hbox (badness 10000) in paragraph at lines 4--5
+\OT1/cmr/m/n/42.99 mat-ting
+
+Tight \hbox (badness 57) in paragraph at lines 4--5
+\OT1/cmr/m/n/42.99 leads to crazy
+[1{/usr/local/texlive/201/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
+(./untitled-1.aux) )
+(see the transcript file for additional information)
+ 260 words of node memory still in use:
+ 2 hlist, 1 vlist, 1 rule, 2 glue, 39 glue_spec, 1 write nodes
+ avail lists: 2:12,3:8,4:43,6:45,7:9,9:16,10:6
+</usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/cm/cmr17.pfb>
+Output written on untitled-1.pdf (1 page, 11727 bytes).
+
+SyncTeX written on untitled-1.synctex.gz.Transcript written on untitled-1.log.
+
diff --git a/testcases/logParser/tests-texlive-ubuntu/files.js b/testcases/logParser/tests-texlive-ubuntu/files.js
index b8d07c9..f6afd49 100644
--- a/testcases/logParser/tests-texlive-ubuntu/files.js
+++ b/testcases/logParser/tests-texlive-ubuntu/files.js
@@ -27,6 +27,7 @@
"./show-long-macro.tex",
"./show-long-macro.aux",
"./10.tex",
+ "./untitled-1.tex",
"/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.sty",
"/usr/local/texlive/2011/texmf-dist/tex/generic/babel/italian.ldf",
"/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii",
@@ -135,5 +136,6 @@
"/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgffor.sty",
"/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty",
"/usr/local/texlive/2011/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty",
- "/usr/local/texlive/2011/texmf-dist/tex/latex/xcolor/xcolor.sty"
+ "/usr/local/texlive/2011/texmf-dist/tex/latex/xcolor/xcolor.sty",
+ "/usr/local/texlive/2011/texmf-dist/tex/latex/extsizes/extarticle.cls"
]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-tex/texworks.git
Reply to: