From: Manuel Nickschas Date: Sun, 28 Feb 2016 19:29:29 +0000 (+0100) Subject: Merge pull request #180 from digitalcircuit/ircv3-expanded-caps X-Git-Tag: travis-deploy-test~513 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=0cdc3bdc397e5d9b45fecb682f0de73d47f9e228;hp=4aea5769f4c155234394957aa55360f111c12cbb Merge pull request #180 from digitalcircuit/ircv3-expanded-caps Implement IRCv3.2 CAP LS, away-notify and friends --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 046b66d8..7268dac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,17 +275,22 @@ if (USE_QT5) if (ECM_FOUND) list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) - endif() - - if (WITH_KDE) - find_package(KF5 COMPONENTS ConfigWidgets CoreAddons Notifications NotifyConfig TextWidgets WidgetsAddons XmlGui QUIET) - set_package_properties(KF5 PROPERTIES TYPE REQUIRED - URL "http://www.kde.org" - DESCRIPTION "KDE Frameworks" - PURPOSE "Required for integration into the Plasma desktop" - ) - - endif() + if (WITH_KDE) + find_package(KF5 COMPONENTS ConfigWidgets CoreAddons Notifications NotifyConfig TextWidgets WidgetsAddons XmlGui QUIET) + set_package_properties(KF5 PROPERTIES TYPE REQUIRED + URL "http://www.kde.org" + DESCRIPTION "KDE Frameworks" + PURPOSE "Required for integration into the Plasma desktop" + ) + else(WITH_KDE) + find_package(KF5Sonnet QUIET) + set_package_properties(KF5Sonnet PROPERTIES TYPE RECOMMENDED + URL "http://api.kde.org/frameworks-api/frameworks5-apidocs/sonnet/html" + DESCRIPTION "framework for providing spell-checking capabilities" + PURPOSE "Enables spell-checking support in input widgets" + ) + endif(WITH_KDE) + endif(ECM_FOUND) endif(BUILD_GUI) diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 8510a715..eedb69c6 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -156,6 +156,12 @@ if (WITH_NOTIFICATION_CENTER) list(APPEND LIBS "/System/Library/Frameworks/Foundation.framework") endif() +if (KF5Sonnet_FOUND) + add_definitions(-DHAVE_SONNET) + list(APPEND SOURCES settingspages/sonnetsettingspage.cpp) + list(APPEND LIBS KF5::SonnetUi) +endif() + foreach(FORM ${FORMS}) set(FORMPATH ${FORMPATH} ui/${FORM}) endforeach(FORM ${FORMS}) diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 95d2e6f6..e27c2fe2 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -153,6 +153,11 @@ # include "settingspages/shortcutssettingspage.h" #endif +#ifdef HAVE_SONNET +# include "settingspages/sonnetsettingspage.h" +#endif + + MainWin::MainWin(QWidget *parent) #ifdef HAVE_KDE : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)), @@ -1367,6 +1372,9 @@ void MainWin::showSettingsDlg() dlg->registerSettingsPage(new BufferViewSettingsPage(dlg)); dlg->registerSettingsPage(new InputWidgetSettingsPage(dlg)); dlg->registerSettingsPage(new TopicWidgetSettingsPage(dlg)); +#ifdef HAVE_SONNET + dlg->registerSettingsPage(new SonnetSettingsPage(dlg)); +#endif dlg->registerSettingsPage(new HighlightSettingsPage(dlg)); dlg->registerSettingsPage(new NotificationsSettingsPage(dlg)); dlg->registerSettingsPage(new BacklogSettingsPage(dlg)); diff --git a/src/qtui/settingspages/sonnetsettingspage.cpp b/src/qtui/settingspages/sonnetsettingspage.cpp new file mode 100644 index 00000000..73b739d6 --- /dev/null +++ b/src/qtui/settingspages/sonnetsettingspage.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2005-2014 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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) version 3. * + * * + * 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 "sonnetsettingspage.h" + +#include + +#include "qtui.h" + +SonnetSettingsPage::SonnetSettingsPage(QWidget *parent) + : SettingsPage(tr("Interface"), tr("Spell Checking"), parent) +{ + QVBoxLayout *layout = new QVBoxLayout(this); + _configWidget = new Sonnet::ConfigWidget(this); + layout->addWidget(_configWidget); + connect(_configWidget, SIGNAL(configChanged()), SLOT(widgetHasChanged())); +} + + +bool SonnetSettingsPage::hasDefaults() const +{ + return true; +} + + +void SonnetSettingsPage::defaults() +{ + _configWidget->slotDefault(); + widgetHasChanged(); +} + + +void SonnetSettingsPage::load() +{ + +} + + +void SonnetSettingsPage::save() +{ + _configWidget->save(); + setChangedState(false); +} + + +void SonnetSettingsPage::widgetHasChanged() +{ + if (!hasChanged()) + setChangedState(true); +} diff --git a/src/qtui/settingspages/sonnetsettingspage.h b/src/qtui/settingspages/sonnetsettingspage.h new file mode 100644 index 00000000..c9ad34a7 --- /dev/null +++ b/src/qtui/settingspages/sonnetsettingspage.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2005-2014 by the Quassel Project * + * devel@quassel-irc.org * + * * + * 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) version 3. * + * * + * 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. * + ***************************************************************************/ + +#pragma once + +#include + +#include "settingspage.h" + +//! A settings page for configuring the Sonnet spell-checking engine +class SonnetSettingsPage : public SettingsPage +{ + Q_OBJECT + +public: + SonnetSettingsPage(QWidget *parent = 0); + + bool hasDefaults() const; + +public slots: + void save(); + void load(); + void defaults(); + +private slots: + void widgetHasChanged(); + +private: + Sonnet::ConfigWidget *_configWidget; +}; diff --git a/src/uisupport/CMakeLists.txt b/src/uisupport/CMakeLists.txt index 37ea3114..a72a9c73 100644 --- a/src/uisupport/CMakeLists.txt +++ b/src/uisupport/CMakeLists.txt @@ -60,4 +60,7 @@ endif() if (WITH_KF5) target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets KF5::XmlGui) +elseif (KF5Sonnet_FOUND) + add_definitions(-DHAVE_SONNET) + target_link_libraries(mod_uisupport KF5::SonnetUi) endif() diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 37f1f62a..68de3578 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -19,10 +19,13 @@ ***************************************************************************/ #include -#include #include #include +#ifdef HAVE_SONNET +# include +#endif + #include "actioncollection.h" #include "bufferview.h" #include "graphicalui.h" @@ -51,6 +54,10 @@ MultiLineEdit::MultiLineEdit(QWidget *parent) enableFindReplace(false); #endif +#ifdef HAVE_SONNET + new Sonnet::SpellCheckDecorator(this); +#endif + setMode(SingleLine); setLineWrapEnabled(false); reset();