diff --git a/CMakeLists.txt b/CMakeLists.txt index 47171cb..ff3a6e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,61 +1,62 @@ project(Knights) cmake_minimum_required(VERSION 2.8.12) set (QT_MIN_VERSION "5.6.0") find_package(ECM 1.7.0 REQUIRED CONFIG) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align -Wunreachable-code -fno-omit-frame-pointer -fstack-protector -fno-exceptions") #set(CMAKE_CXX_FLAGS_PROFILE "-fprofile-arcs -ftest-coverage -pg") include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Concurrent Core Gui Widgets Svg ) find_package(Qt5TextToSpeech ${QT_REQUIRED_VERSION} QUIET) set_package_properties(Qt5TextToSpeech PROPERTIES PURPOSE "Speaking of opponents moves") if (Qt5TextToSpeech_FOUND) add_definitions(-DHAVE_SPEECH) endif () find_package(KF5 REQUIRED COMPONENTS DBusAddons ConfigWidgets + Crash TextWidgets XmlGui KIO Plotting DocTools Wallet Plasma ) find_package(KF5KDEGames 4.9.0 REQUIRED) include(FeatureSummary) include(ECMAddAppIcon) include(ECMInstallIcons) include(ECMQtDeclareLoggingCategory) include(KDEInstallDirs) include(KDECompilerSettings) include(KDECMakeSettings) add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII) add_subdirectory(doc) add_subdirectory(icons) add_subdirectory(sounds) add_subdirectory(src) add_subdirectory(themes) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b62442..87b0b82 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,93 +1,94 @@ include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) set(knights_SRCS core/pos.cpp core/move.cpp core/item.cpp core/piece.cpp proto/protocol.cpp proto/localprotocol.cpp proto/textprotocol.cpp proto/ficsprotocol.cpp proto/computerprotocol.cpp proto/xboardprotocol.cpp proto/uciprotocol.cpp proto/seekgraph.cpp proto/chatwidget.cpp proto/ficsdialog.cpp rules/chessrules.cpp difficultydialog.cpp gamedialog.cpp offerwidget.cpp clock.cpp clockwidget.cpp historywidget.cpp enginesettings.cpp externalcontrol.cpp gamemanager.cpp board.cpp knightsview.cpp knights.cpp main.cpp ) ki18n_wrap_ui(knights_SRCS knightsview_base.ui prefs_base.ui prefs_access.ui gamedialog.ui clockwidget.ui historywidget.ui promotiondialog.ui proto/ficsdialog.ui proto/chatwidget.ui popup.ui enginesettings.ui customdifficultydialog.ui ) kconfig_add_kcfg_files(knights_SRCS settings.kcfgc ) qt5_add_dbus_adaptor(knights_SRCS org.kde.Knights.xml externalcontrol.h Knights::ExternalControl) ecm_qt_declare_logging_category(knights_SRCS HEADER knightsdebug.h IDENTIFIER LOG_KNIGHTS CATEGORY_NAME log_knights) add_executable(knights ${knights_SRCS}) if (Qt5TextToSpeech_FOUND) target_link_libraries(knights Qt5::TextToSpeech) endif() target_link_libraries(knights Qt5::Network Qt5::Svg Qt5::Gui Qt5::Concurrent + KF5::Crash KF5::Solid KF5::WidgetsAddons KF5::DBusAddons KF5::XmlGui KF5KDEGames KF5::Plotting KF5::Plasma KF5::Completion KF5::TextWidgets KF5::Wallet) install(TARGETS knights ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ) ########### install files ############### install( PROGRAMS org.kde.knights.desktop DESTINATION ${KDE_INSTALL_APPDIR} ) install( FILES knights.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES knightsui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/knights ) install( FILES knights.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} ) install( FILES org.kde.Knights.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) install( FILES org.kde.knights.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} ) diff --git a/src/main.cpp b/src/main.cpp index 8725e26..f2884e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,92 +1,94 @@ /*************************************************************************** File : main.cpp Project : Knights Description : main function -------------------------------------------------------------------- Copyright : (C) 2016-2017 by Alexander Semke (alexander.semke@web.de) Copyright : (C) 2009-2011 by Miha Čančula (miha@noughmad.eu) ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * ***************************************************************************/ #include "knights.h" #include +#include #include #include #include static const char description[] = I18N_NOOP ( "KDE Chess Board" ); static QString version = QStringLiteral ("2.6.0"); int main ( int argc, char **argv ) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication app(argc, argv); KLocalizedString::setApplicationDomain("knights"); + KCrash::initialize(); KAboutData about ( QStringLiteral("knights"), i18n ( "Knights" ), version, i18n( description ), KAboutLicense::GPL, i18n ( "(C) 2016-2017 Alexander Semke, 2009-2011 Miha Čančula" )); about.addAuthor(i18n("Alexander Semke"), QString(), QStringLiteral("alexander.semke@web.de")); about.addAuthor ( i18n ( "Miha Čančula" ), QString(), QStringLiteral ("miha@noughmad.eu"), QStringLiteral ("http://noughmad.eu"), QStringLiteral ("noughmad") ); about.addCredit ( i18n ( "Troy Corbin" ), i18n ( "Original Knights for KDE3 and theme author" ), QStringLiteral ("troy@pedanticwebspaces.com") ); about.addCredit ( i18n ( "Dave Kaye" ), i18n ( "Help with new theme features and rendering without KGameRenderer" ) ); about.addCredit ( i18n ( "Thomas Kamps" ), i18n ( "Clock displaying the remaining time" ), QString(), QString(), QStringLiteral("cpttom") ); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("knights"))); KAboutData::setApplicationData(about); QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); parser.addOption(QCommandLineOption( QStringLiteral ("+[URL]"), i18n ( "Document to open" ) )); about.setupCommandLine(&parser); parser.process(app); about.processCommandLine(&parser); // register types for connecting with Qt::QueuedConnection qRegisterMetaType("Color"); // see if we are starting with session management if ( app.isSessionRestored() ) { RESTORE ( Knights::MainWindow ); } else { // no session.. just start up normally if ( parser.positionalArguments().isEmpty() ) { Knights::MainWindow *widget = new Knights::MainWindow; widget->show(); } else { int i = 0; for ( ; i < parser.positionalArguments().count(); i++ ) { Knights::MainWindow *widget = new Knights::MainWindow; widget->show(); } } } return app.exec(); }