Permalink
Browse files

Drop Qt 4 support

With this CL, --qtver configure option will be removed and Mozc no
longer supports to be built with Qt 4.

BUG=#327
TEST=
REF_BUG=26887740
REF_CL=141386550
REF_TIME=2016-12-08T11:43:38+09:00
REF_TIME_RAW=1481165018 +0900
  • Loading branch information...
hiroyuki-komatsu committed Dec 8, 2016
1 parent fdfe0d7 commit 280e38fe3d9db4df52f0713acf2ca65898cd697a
Showing with 71 additions and 614 deletions.
  1. +2 −2 docs/build_mozc_in_docker.md
  2. +3 −21 src/build_mozc.py
  3. +8 −11 src/build_tools/change_reference_mac.py
  4. +24 −34 src/build_tools/copy_qt_frameworks_mac.py
  5. +1 −1 src/data/version/mozc_version_template.bzl
  6. +0 −4 src/gui/about_dialog/about_dialog.h
  7. +0 −4 src/gui/about_dialog/about_dialog_libmain.cc
  8. +1 −4 src/gui/administration_dialog/administration_dialog.cc
  9. +1 −4 src/gui/administration_dialog/administration_dialog.h
  10. +1 −4 src/gui/administration_dialog/administration_dialog_libmain.cc
  11. +0 −19 src/gui/base/debug_util.cc
  12. +0 −8 src/gui/base/debug_util.h
  13. +0 −11 src/gui/base/locale_util.cc
  14. +0 −4 src/gui/base/table_util.cc
  15. +0 −9 src/gui/base/window_title_modifier.cc
  16. +0 −4 src/gui/character_pad/character_pad_libmain.cc
  17. +0 −4 src/gui/character_pad/character_palette.cc
  18. +0 −4 src/gui/character_pad/character_palette.h
  19. +0 −2 src/gui/character_pad/character_palette_table_widget.cc
  20. +0 −4 src/gui/character_pad/character_palette_table_widget.h
  21. +2 −8 src/gui/character_pad/hand_writing.cc
  22. +0 −4 src/gui/character_pad/hand_writing.h
  23. +0 −4 src/gui/character_pad/hand_writing_canvas.h
  24. +0 −2 src/gui/character_pad/hand_writing_thread.cc
  25. +0 −2 src/gui/character_pad/result_list.cc
  26. +0 −5 src/gui/character_pad/result_list.h
  27. +0 −6 src/gui/character_pad/selection_handler.cc
  28. +0 −4 src/gui/character_pad/unicode_util.cc
  29. +0 −2 src/gui/config_dialog/character_form_editor.cc
  30. +0 −4 src/gui/config_dialog/character_form_editor.h
  31. +0 −4 src/gui/config_dialog/combobox_delegate.cc
  32. +0 −5 src/gui/config_dialog/combobox_delegate.h
  33. +0 −8 src/gui/config_dialog/config_dialog.cc
  34. +1 −6 src/gui/config_dialog/config_dialog_libmain.cc
  35. +0 −9 src/gui/config_dialog/generic_table_editor.cc
  36. +0 −4 src/gui/config_dialog/generic_table_editor.h
  37. +0 −9 src/gui/config_dialog/keybinding_editor.cc
  38. +0 −4 src/gui/config_dialog/keybinding_editor.h
  39. +0 −4 src/gui/config_dialog/keybinding_editor_delegate.cc
  40. +0 −4 src/gui/config_dialog/keybinding_editor_delegate.h
  41. +0 −5 src/gui/config_dialog/keymap_editor.cc
  42. +0 −4 src/gui/config_dialog/keymap_editor.h
  43. +0 −2 src/gui/config_dialog/roman_table_editor.cc
  44. +0 −4 src/gui/config_dialog/roman_table_editor.h
  45. +0 −4 src/gui/confirmation_dialog/confirmation_dialog.cc
  46. +0 −4 src/gui/confirmation_dialog/confirmation_dialog.h
  47. +0 −5 src/gui/confirmation_dialog/confirmation_dialog_libmain.cc
  48. +0 −4 src/gui/dictionary_tool/dictionary_content_table_widget.h
  49. +0 −8 src/gui/dictionary_tool/dictionary_tool.cc
  50. +0 −7 src/gui/dictionary_tool/dictionary_tool.h
  51. +1 −4 src/gui/dictionary_tool/dictionary_tool_libmain.cc
  52. +0 −2 src/gui/dictionary_tool/find_dialog.cc
  53. +1 −4 src/gui/dictionary_tool/find_dialog.h
  54. +0 −2 src/gui/dictionary_tool/import_dialog.cc
  55. +1 −4 src/gui/dictionary_tool/import_dialog.h
  56. +0 −4 src/gui/dictionary_tool/zero_width_splitter.cc
  57. +0 −4 src/gui/dictionary_tool/zero_width_splitter.h
  58. +0 −4 src/gui/error_message_dialog/error_message_dialog.cc
  59. +0 −4 src/gui/error_message_dialog/error_message_dialog.h
  60. +1 −5 src/gui/error_message_dialog/error_message_dialog_libmain.cc
  61. +1 −8 src/gui/gui.gyp
  62. +1 −6 src/gui/mac_gui.gypi
  63. +1 −4 src/gui/post_install_dialog/post_install_dialog_libmain.cc
  64. +15 −49 src/gui/qt_libraries.gypi
  65. +1 −7 src/gui/qt_moc.gypi
  66. +1 −8 src/gui/qt_rcc.gypi
  67. +1 −7 src/gui/qt_uic.gypi
  68. +1 −4 src/gui/set_default_dialog/set_default_dialog_libmain.cc
  69. +0 −4 src/gui/tool/mozc_tool_libmain.cc
  70. +0 −6 src/gui/word_register_dialog/word_register_dialog.cc
  71. +0 −4 src/gui/word_register_dialog/word_register_dialog.h
  72. +1 −5 src/gui/word_register_dialog/word_register_dialog_libmain.cc
  73. +0 −6 src/gyp/defines.gypi
  74. +0 −16 src/win32/installer/installer.gyp
  75. +0 −60 src/win32/installer/installer_32bit.wxs
  76. +0 −60 src/win32/installer/installer_64bit.wxs
  77. +0 −20 src/win32/installer/wix.gypi
@@ -99,13 +99,13 @@ You can use `--target_platform` option to specify the target OS on which Mozc wi
If you don't specify this option, `--target_platform=Linux` will be used implicitly.
#### --noqt (Linux desktop target only)
You can use `--noqt` option to build Mozc without depending on Qt 4 library.
You can use `--noqt` option to build Mozc without depending on Qt 5 library.
#### --server_dir (Linux desktop target only)
You can use `--server_dir` option to specify the directory name where `mozc_server` will be installed.
## Compile options
In `build_mozc.py build` step, you can specify build types (`Release`` or `Debug`) and one or more build targets. Please find each GYP file to see what build targets are defined.
In `build_mozc.py build` step, you can specify build types (`Release` or `Debug`) and one or more build targets. Please find each GYP file to see what build targets are defined.
```
python build_mozc.py build -c {Release, Debug} [gyp_path_1.gyp:gyp_target_name1] [gyp_path_2.gyp:gyp_target_name2]
View
@@ -272,7 +272,6 @@ def ParseGypOptions(args):
parser.add_option('--gypdir', dest='gypdir',
help='Specifies the location of GYP to be used.')
parser.add_option('--noqt', action='store_true', dest='noqt', default=False)
parser.add_option('--qtver', dest='qtver', choices=('4', '5'), default='5')
parser.add_option('--version_file', dest='version_file',
help='use the specified version template file',
default='data/version/mozc_version_template.bzl')
@@ -505,7 +504,7 @@ def GypMain(options, unused_args):
if options.noqt or options.target_platform in ['Android', 'NaCl']:
qt_version = ''
else:
qt_version = options.qtver
qt_version = '5'
GenerateVersionFile(template_path, version_path, options.target_platform,
options.android_application_id,
options.android_arch, qt_version)
@@ -591,12 +590,7 @@ def GypMain(options, unused_args):
gyp_options.extend(['-D', 'qt_dir='])
# Check if Qt libraries are installed.
if options.qtver == '5':
system_qt_found = PkgExists('Qt5Core', 'Qt5Gui', 'Qt5Widgets')
else:
system_qt_found = PkgExists('QtCore >= 4.0', 'QtCore < 5.0',
'QtGui >= 4.0', 'QtGui < 5.0')
if not system_qt_found:
if not PkgExists('Qt5Core', 'Qt5Gui', 'Qt5Widgets'):
PrintErrorAndExit('Qt is required to build GUI Tool. '
'Specify --noqt to skip building GUI Tool.')
@@ -606,7 +600,6 @@ def GypMain(options, unused_args):
gyp_options.extend(['-D', 'qt_dir=%s' % os.path.abspath(options.qtdir)])
else:
gyp_options.extend(['-D', 'qt_dir='])
gyp_options.extend(['-D', 'qt_ver=%s' % options.qtver])
if target_platform == 'Windows' and options.wix_dir:
gyp_options.extend(['-D', 'use_wix=YES'])
@@ -773,18 +766,7 @@ def SetCommandLineForFeature(option_name, windows=False, mac=False,
copy_script = os.path.join(
ABS_SCRIPT_DIR, 'build_tools', 'copy_dll_and_symbol.py')
copy_params = []
if qt_version == '4':
copy_params.append({
'basenames': 'QtCored4;QtGuid4',
'dll_paths': abs_qt_bin_dir,
'pdb_paths': abs_qt_lib_dir,
'target_dir': os.path.join(abs_out_win_dir, 'DebugDynamic')})
copy_params.append({
'basenames': 'QtCore4;QtGui4',
'dll_paths': abs_qt_bin_dir,
'pdb_paths': abs_qt_lib_dir,
'target_dir': os.path.join(abs_out_win_dir, 'ReleaseDynamic')})
elif qt_version == '5':
if qt_version == '5':
copy_params.append({
'basenames': 'Qt5Cored;Qt5Guid;Qt5Widgetsd',
'dll_paths': abs_qt_bin_dir,
@@ -48,7 +48,6 @@
def ParseOption():
"""Parse command line options."""
parser = optparse.OptionParser()
parser.add_option('--qtver', dest='qtver', choices=('4', '5'), default='4')
parser.add_option('--qtdir', dest='qtdir')
parser.add_option('--target', dest='target')
@@ -80,30 +79,28 @@ def main():
if not opt.target:
PrintErrorAndExit('--target option is mandatory.')
qtver = opt.qtver
qtdir = os.path.abspath(opt.qtdir)
target = os.path.abspath(opt.target)
# Changes the reference to QtCore framework from the target application
# From: /path/to/qt/lib/QtCore.framework/Versions/4/QtCore
# From: /path/to/qt/lib/QtCore.framework/Versions/5/QtCore
# To: @executable_path/../../../MozcTool.app/Contents/Frameworks/...
qtcore_framework = GetFrameworkPath('QtCore', qtver)
qtcore_framework = GetFrameworkPath('QtCore', '5')
InstallNameTool(target,
'%s/lib/%s' % (qtdir, qtcore_framework),
GetReferenceTo(qtcore_framework))
# Changes the reference to QtGui framework from the target application
qtgui_framework = GetFrameworkPath('QtGui', qtver)
qtgui_framework = GetFrameworkPath('QtGui', '5')
InstallNameTool(target,
'%s/lib/%s' % (qtdir, qtgui_framework),
GetReferenceTo(qtgui_framework))
if qtver == '5':
# Changes the reference to QtWidgets framework from the target application
qtwidgets_framework = GetFrameworkPath('QtWidgets', '5')
InstallNameTool(target,
'%s/lib/%s' % (qtdir, qtwidgets_framework),
GetReferenceTo(qtwidgets_framework))
# Changes the reference to QtWidgets framework from the target application
qtwidgets_framework = GetFrameworkPath('QtWidgets', '5')
InstallNameTool(target,
'%s/lib/%s' % (qtdir, qtwidgets_framework),
GetReferenceTo(qtwidgets_framework))
# Change the reference to $(branding)Tool_lib from the target application
# From: @executable_path/../Frameworks/MozcTool_lib.framework/...
@@ -49,7 +49,6 @@
def ParseOption():
"""Parse command line options."""
parser = optparse.OptionParser()
parser.add_option('--qtver', dest='qtver', choices=('4', '5'), default='4')
parser.add_option('--qtdir', dest='qtdir')
parser.add_option('--target', dest='target')
@@ -113,43 +112,34 @@ def main():
if not opt.target:
PrintErrorAndExit('--target option is mandatory.')
qtver = opt.qtver
qtdir = os.path.abspath(opt.qtdir)
target = os.path.abspath(opt.target)
ref_to = '@executable_path/../../../ConfigDialog.app/Contents/Frameworks'
if qtver == '5':
CopyQt(qtdir, 'QtCore', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtGui', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtWidgets', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtPrintSupport', '5', target, copy_resources=True)
ChangeReferences(qtdir, GetFrameworkPath('QtCore', '5'),
'5', target, ref_to)
ChangeReferences(qtdir, GetFrameworkPath('QtGui', '5'),
'5', target, ref_to,
references=['QtCore'])
ChangeReferences(qtdir, GetFrameworkPath('QtWidgets', '5'),
'5', target, ref_to,
references=['QtCore', 'QtGui'])
ChangeReferences(qtdir, GetFrameworkPath('QtPrintSupport', '5'),
'5', target, ref_to,
references=['QtCore', 'QtGui', 'QtWidgets'])
libqcocoa = 'QtCore.framework/Resources/plugins/platforms/libqcocoa.dylib'
CopyFiles(['%s/plugins/platforms/libqcocoa.dylib' % qtdir],
'%s/%s' % (target, libqcocoa))
ChangeReferences(qtdir, libqcocoa, '5', target, ref_to,
references=['QtCore', 'QtGui',
'QtWidgets', 'QtPrintSupport'])
else:
CopyQt(qtdir, 'QtCore', '4', target)
CopyQt(qtdir, 'QtGui', '4', target, copy_resources=True)
ChangeReferences(qtdir, GetFrameworkPath('QtCore', '4'),
'4', target, ref_to)
ChangeReferences(qtdir, GetFrameworkPath('QtGui', '4'),
'4', target, ref_to, references=['QtCore'])
CopyQt(qtdir, 'QtCore', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtGui', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtWidgets', '5', target, copy_resources=True)
CopyQt(qtdir, 'QtPrintSupport', '5', target, copy_resources=True)
ChangeReferences(qtdir, GetFrameworkPath('QtCore', '5'),
'5', target, ref_to)
ChangeReferences(qtdir, GetFrameworkPath('QtGui', '5'),
'5', target, ref_to,
references=['QtCore'])
ChangeReferences(qtdir, GetFrameworkPath('QtWidgets', '5'),
'5', target, ref_to,
references=['QtCore', 'QtGui'])
ChangeReferences(qtdir, GetFrameworkPath('QtPrintSupport', '5'),
'5', target, ref_to,
references=['QtCore', 'QtGui', 'QtWidgets'])
libqcocoa = 'QtCore.framework/Resources/plugins/platforms/libqcocoa.dylib'
CopyFiles(['%s/plugins/platforms/libqcocoa.dylib' % qtdir],
'%s/%s' % (target, libqcocoa))
ChangeReferences(qtdir, libqcocoa, '5', target, ref_to,
references=['QtCore', 'QtGui',
'QtWidgets', 'QtPrintSupport'])
if __name__ == '__main__':
@@ -30,7 +30,7 @@
MAJOR=2
MINOR=20
BUILD=2672
BUILD=2673
REVISION=102
# This version represents the version of Mozc IME engine (converter, predictor,
# etc.). This version info is included both in the Mozc server and in the Mozc
@@ -32,11 +32,7 @@
#ifndef MOZC_GUI_ABOUT_DIALOG_ABOUT_DIALOG_H_
#define MOZC_GUI_ABOUT_DIALOG_ABOUT_DIALOG_H_
#ifdef MOZC_USE_QT5
#include <QtWidgets/QDialog>
#else
#include <QtGui/QDialog>
#endif
#include <memory>
@@ -27,11 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef MOZC_USE_QT5
#include <QtGui/QGuiApplication>
#else
#include <QtGui/QApplication>
#endif
#include <QtGui/QtGui>
#include "base/system_util.h"
#include "gui/about_dialog/about_dialog.h"
@@ -29,11 +29,8 @@
#include "gui/administration_dialog/administration_dialog.h"
#ifdef MOZC_USE_QT5
#include <QtWidgets/QMessageBox>
#else
#include <QtGui/QMessageBox>
#endif
#include "base/run_level.h"
#include "config/stats_config_util.h"
#include "server/cache_service_manager.h"
@@ -31,11 +31,8 @@
#define MOZC_GUI_ADMINISTRATION_DIALOG_H_
#include <QtGui/QtGui>
#ifdef MOZC_USE_QT5
#include <QtWidgets/QDialog>
#else
#include <QtGui/QDialog>
#endif
#include <string>
#include "gui/administration_dialog/ui_administration_dialog.h"
@@ -27,12 +27,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef MOZC_USE_QT5
#include <QtGui/QGuiApplication>
#else
#include <QtGui/QApplication>
#endif
#include <QtGui/QtGui>
#include "base/system_util.h"
#include "gui/administration_dialog/administration_dialog.h"
#include "gui/base/locale_util.h"
View
@@ -36,7 +36,6 @@
namespace mozc {
namespace gui {
#ifdef MOZC_USE_QT5
void DebugUtil::MessageHandler(QtMsgType type,
const QMessageLogContext &context,
const QString &q_msg) {
@@ -57,24 +56,6 @@ void DebugUtil::MessageHandler(QtMsgType type,
break;
}
}
#else // ! MOZC_USE_QT5
void DebugUtil::MessageHandler(QtMsgType type, const char *msg) {
switch (type) {
case QtDebugMsg:
LOG(INFO) << msg;
break;
case QtWarningMsg:
LOG(WARNING) << msg;
break;
case QtCriticalMsg:
LOG(ERROR) << msg;
break;
case QtFatalMsg:
LOG(FATAL) << msg;
break;
}
}
#endif // ! MOZC_USE_QT5
} // namespace gui
} // namespace mozc
@@ -33,11 +33,7 @@
#define MOZC_GUI_BASE_DEBUG_UTIL_H_
#include <string>
#ifdef MOZC_USE_QT5
#include <QtGui/QGuiApplication>
#else
#include <QtGui/QApplication>
#endif
namespace mozc {
namespace gui {
@@ -46,13 +42,9 @@ class DebugUtil {
public:
// Callback function used as a Qt message handler which is called when Qt
// message functions (qDebug, qWarning, qCritical and qFatal) are called.
#ifdef MOZC_USE_QT5
static void MessageHandler(QtMsgType type,
const QMessageLogContext &context,
const QString &q_msg);
#else
static void MessageHandler(QtMsgType type, const char *msg);
#endif
private:
DebugUtil() {}
@@ -44,12 +44,7 @@
#include <CommCtrl.h> // for CCSIZEOF_STRUCT
#endif
#ifdef MOZC_USE_QT5
#include <QtGui/QGuiApplication>
#else
#include <QtCore/QTextCodec>
#include <QtGui/QApplication>
#endif
#include <QtGui/QtGui>
#include <map>
@@ -114,12 +109,6 @@ TranslationDataImpl::TranslationDataImpl() {
if (loaded) {
qApp->installTranslator(&default_translator_);
}
#ifndef MOZC_USE_QT5
// Set default encoding for multi-byte string to be UTF8
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
#endif
}
void TranslationDataImpl::InstallTranslationMessageAndFont(
@@ -29,11 +29,7 @@
#include "gui/base/table_util.h"
#ifdef MOZC_USE_QT5
#include <QtWidgets/QTableWidget>
#else
#include <QtGui/QTableWidget>
#endif
namespace mozc {
namespace gui {
@@ -29,14 +29,9 @@
#include <QtCore/QObject>
#include <QtCore/QString>
#ifdef MOZC_USE_QT5
#include <QtGui/QGuiApplication>
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
#else
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#endif
#include "base/version.h"
#include "gui/base/window_title_modifier.h"
@@ -45,11 +40,7 @@ namespace mozc {
namespace gui {
bool WindowTitleModifier::eventFilter(QObject *obj,
QEvent *event) {
#ifdef MOZC_USE_QT5
QWidget *w = QApplication::activeWindow();
#else
QWidget *w = qApp->activeWindow();
#endif
if (w != NULL && obj != NULL && w == obj &&
QEvent::WindowActivate == event->type() &&
w->windowTitle().indexOf(prefix_) == -1) {
Oops, something went wrong.

0 comments on commit 280e38f

Please sign in to comment.