Commit 2396506c authored by Marco Rebhan's avatar Marco Rebhan Committed by Albert Astals Cid
Browse files

Make setupUi public

parent f8764a9c
......@@ -47,7 +47,7 @@
MainWindow::MainWindow() : KXmlGuiWindow(nullptr)
{
IrcContextMenus::self()->setupUi(this);
IrcContextMenus::setupUi(this);
m_hasDirtySettings = false;
m_closeApp = false;
......
......@@ -55,6 +55,11 @@ IrcContextMenus::IrcContextMenus() : QObject()
}
void IrcContextMenus::setupUi(QWidget* parent)
{
self()->doSetupUi(parent);
}
void IrcContextMenus::doSetupUi(QWidget* parent)
{
m_parent = parent;
createSharedBasicNickActions();
......
......@@ -56,9 +56,7 @@ class IrcContextMenus : public QObject
~IrcContextMenus() override = default;
static IrcContextMenus* self();
void setupUi(QWidget* parent);
static void setupUi(QWidget* parent);
static int textMenu(const QPoint& pos, MenuOptions options, Server* server,
const QString& selectedText, const QString& link, const QString& nick = QString());
......@@ -83,6 +81,9 @@ class IrcContextMenus : public QObject
private:
static IrcContextMenus* self();
void doSetupUi(QWidget* parent);
explicit IrcContextMenus();
friend class IrcContextMenusPrivate;
......
......@@ -30,7 +30,6 @@
#include "irccolorchooser.h"
#include "joinchanneldialog.h"
#include "servergroupsettings.h"
#include "irccontextmenus.h"
#include "viewtree.h"
#include "viewspringloader.h"
#include "konversation_log.h"
......@@ -140,25 +139,12 @@ ViewContainer::ViewContainer(MainWindow* window) : QAbstractItemModel(window)
m_dccPanel->hide();
m_dccPanelOpen = false;
connect(m_dccPanel, &DCC::TransferPanel::updateTabNotification, this, &ViewContainer::setViewNotification);
// Pre-construct context menus for better responsiveness when then
// user opens them the first time. This is optional; the IrcContext-
// Menus API would work fine without doing this here.
// IrcContextMenus' setup code calls Application::instance(), and
// ViewContainer is constructed in the scope of the Application
// constructor, so to avoid a crash we need to queue.
QMetaObject::invokeMethod(this, "setupIrcContextMenus", Qt::QueuedConnection);
}
ViewContainer::~ViewContainer()
{
}
void ViewContainer::setupIrcContextMenus()
{
IrcContextMenus::self();
}
void ViewContainer::showQueueTuner(bool p)
{
if (p)
......
......@@ -252,7 +252,6 @@ class ViewContainer : public QAbstractItemModel
void frontServerChanging(Server*);
private Q_SLOTS:
void setupIrcContextMenus();
void viewSwitched(int newIndex);
void onViewTreeDestroyed(QObject *object);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment