Remove debug console and QtScript, which was deprecated with Qt5
authorJanne Koschinski <janne@kuschku.de>
Sun, 4 Aug 2019 20:46:26 +0000 (22:46 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 29 Aug 2019 05:14:04 +0000 (07:14 +0200)
- reduces dependencies, allows building quasselcore on most distros
  without pulling in X11
- removes unused code and dependencies, reduces size

CMakeLists.txt
src/core/CMakeLists.txt
src/core/coresession.cpp
src/core/coresession.h
src/qtui/CMakeLists.txt
src/qtui/debugconsole.cpp [deleted file]
src/qtui/debugconsole.h [deleted file]
src/qtui/debugconsole.ui [deleted file]

index c3acc21..cd9f79d 100644 (file)
@@ -169,7 +169,7 @@ if (BUILD_GUI)
     list(APPEND qt_components Gui Widgets)
 endif()
 if (BUILD_CORE)
-    list(APPEND qt_components Script Sql)
+    list(APPEND qt_components Sql)
 endif()
 
 find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS ${qt_components})
index 230f370..017bccf 100644 (file)
@@ -49,7 +49,6 @@ target_link_libraries(${TARGET}
     PUBLIC
         Qt5::Core
         Qt5::Network
-        Qt5::Script
         Qt5::Sql
         Quassel::Common
 )
index f4196b0..961fcaf 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <utility>
 
-#include <QtScript>
-
 #include "core.h"
 #include "corebacklogmanager.h"
 #include "corebuffersyncer.h"
@@ -78,7 +76,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled,
     , _sessionEventProcessor(new CoreSessionEventProcessor(this))
     , _ctcpParser(new CtcpParser(this))
     , _ircParser(new IrcParser(this))
-    , scriptEngine(new QScriptEngine(this))
     , _processMessages(false)
     , _ignoreListManager(this)
     , _highlightRuleManager(this)
@@ -121,7 +118,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled,
     _coreInfo->setCoreData(data);
 
     loadSettings();
-    initScriptEngine();
 
     eventManager()->registerObject(ircParser(), EventManager::NormalPriority);
     eventManager()->registerObject(sessionEventProcessor(), EventManager::HighPriority);  // needs to process events *before* the stringifier!
@@ -532,21 +528,6 @@ Protocol::SessionState CoreSession::sessionState() const
     return Protocol::SessionState(identities, bufferInfos, networkIds);
 }
 
-void CoreSession::initScriptEngine()
-{
-    signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, &CoreSession::scriptRequest);
-    signalProxy()->attachSignal(this, &CoreSession::scriptResult);
-
-    // FIXME
-    // QScriptValue storage_ = scriptEngine->newQObject(storage);
-    // scriptEngine->globalObject().setProperty("storage", storage_);
-}
-
-void CoreSession::scriptRequest(QString script)
-{
-    emit scriptResult(scriptEngine->evaluate(script).toString());
-}
-
 /*** Identity Handling ***/
 void CoreSession::createIdentity(const Identity& identity, const QVariantMap& additional)
 {
index cfa04e3..3e08eac 100644 (file)
@@ -58,8 +58,6 @@ class SignalProxy;
 
 struct NetworkInfo;
 
-class QScriptEngine;
-
 class CoreSession : public QObject
 {
     Q_OBJECT
@@ -173,8 +171,6 @@ signals:
     void displayMsg(Message message);
     void displayStatusMsg(QString, QString);
 
-    void scriptResult(QString result);
-
     //! Identity has been created.
     /** This signal is propagated to the clients to tell them that the given identity has been created.
      *  \param identity The new identity.
@@ -206,8 +202,6 @@ private slots:
 
     void destroyNetwork(NetworkId);
 
-    void scriptRequest(QString script);
-
     void clientsConnected();
     void clientsDisconnected();
 
@@ -221,7 +215,6 @@ private:
     void processMessages();
 
     void loadSettings();
-    void initScriptEngine();
 
     /// Hook for converting events to the old displayMsg() handlers
     Q_INVOKABLE void processMessageEvent(MessageEvent* event);
@@ -253,8 +246,6 @@ private:
     CtcpParser* _ctcpParser;
     IrcParser* _ircParser;
 
-    QScriptEngine* scriptEngine;
-
     /**
      * This method obtains the prefixes of the message's sender within a channel, by looking up their channelmodes, and
      * processing them to prefixes based on the network's settings.
index eee27cb..034d6c6 100644 (file)
@@ -24,7 +24,6 @@ target_sources(${TARGET} PRIVATE
     coreinfodlg.cpp
     coresessionwidget.cpp
     debugbufferviewoverlay.cpp
-    debugconsole.cpp
     debuglogdlg.cpp
     debugmessagemodelfilter.cpp
     inputwidget.cpp
@@ -71,7 +70,6 @@ target_sources(${TARGET} PRIVATE
     coreinfodlg.ui
     coresessionwidget.ui
     debugbufferviewoverlay.ui
-    debugconsole.ui
     debuglogdlg.ui
     inputwidget.ui
     msgprocessorstatuswidget.ui
diff --git a/src/qtui/debugconsole.cpp b/src/qtui/debugconsole.cpp
deleted file mode 100644 (file)
index 8f7c758..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2019 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 "debugconsole.h"
-
-#include "client.h"
-#include "signalproxy.h"
-
-DebugConsole::DebugConsole(QWidget* parent)
-    : QDialog(parent)
-{
-    ui.setupUi(this);
-
-    Client::signalProxy()->attachSignal(this, &DebugConsole::scriptRequest);
-    Client::signalProxy()->attachSlot(SIGNAL(scriptResult(QString)), this, &DebugConsole::scriptResult);
-}
-
-void DebugConsole::on_evalButton_clicked()
-{
-    if (ui.selectCore->isChecked()) {
-        emit scriptRequest(ui.scriptEdit->toPlainText());
-    }
-}
-
-void DebugConsole::scriptResult(QString result)
-{
-    ui.resultLabel->setText(result);
-}
diff --git a/src/qtui/debugconsole.h b/src/qtui/debugconsole.h
deleted file mode 100644 (file)
index c973f32..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-2019 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.         *
- ***************************************************************************/
-
-#ifndef DEBUGCONSOLE_H
-#define DEBUGCONSOLE_H
-
-#include "ui_debugconsole.h"
-
-class DebugConsole : public QDialog
-{
-    Q_OBJECT
-
-public:
-    DebugConsole(QWidget* parent = nullptr);
-
-public slots:
-    void scriptResult(QString result);
-
-signals:
-    void scriptRequest(QString script);
-
-private slots:
-    void on_evalButton_clicked();
-
-private:
-    Ui::DebugConsole ui;
-};
-
-#endif
diff --git a/src/qtui/debugconsole.ui b/src/qtui/debugconsole.ui
deleted file mode 100644 (file)
index aa0dc34..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DebugConsole</class>
- <widget class="QDialog" name="DebugConsole">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>490</width>
-    <height>435</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Debug Console</string>
-  </property>
-  <layout class="QVBoxLayout">
-   <property name="spacing">
-    <number>2</number>
-   </property>
-   <property name="margin">
-    <number>3</number>
-   </property>
-   <item>
-    <layout class="QHBoxLayout">
-     <property name="spacing">
-      <number>10</number>
-     </property>
-     <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="selectLocal">
-       <property name="text">
-        <string>local</string>
-       </property>
-       <property name="checked">
-        <bool>false</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QRadioButton" name="selectCore">
-       <property name="text">
-        <string>core</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QTextEdit" name="scriptEdit"/>
-   </item>
-   <item>
-    <widget class="QPushButton" name="evalButton">
-     <property name="text">
-      <string>Evaluate!</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLabel" name="resultLabel">
-     <property name="text">
-      <string/>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <tabstops>
-  <tabstop>selectLocal</tabstop>
-  <tabstop>selectCore</tabstop>
-  <tabstop>scriptEdit</tabstop>
-  <tabstop>evalButton</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>