File indexing completed on 2024-04-21 04:55:26

0001 /*
0002     This file is part of Choqok, the KDE micro-blogging client
0003 
0004     SPDX-FileCopyrightText: 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 */
0008 
0009 #include "choqokuiglobal.h"
0010 
0011 #include <QApplication>
0012 #include <QPointer>
0013 
0014 #include "notifymanager.h"
0015 #include "postwidget.h"
0016 #include "quickpost.h"
0017 
0018 namespace Choqok
0019 {
0020 
0021 namespace
0022 {
0023 QPointer<Choqok::UI::MainWindow> g_mainWidget;
0024 QPointer<UI::QuickPost> g_quickPost;
0025 }
0026 
0027 void UI::Global::setMainWindow(Choqok::UI::MainWindow *widget)
0028 {
0029     g_mainWidget = widget;
0030 }
0031 
0032 Choqok::UI::MainWindow *UI::Global::mainWindow()
0033 {
0034     return g_mainWidget;
0035 }
0036 
0037 UI::QuickPost *UI::Global::quickPostWidget()
0038 {
0039     return g_quickPost;
0040 }
0041 
0042 void UI::Global::setQuickPostWidget(UI::QuickPost *quickPost)
0043 {
0044     g_quickPost = quickPost;
0045 }
0046 
0047 UI::Global::SessionManager::SessionManager():
0048     QObject(qApp)
0049 {
0050 
0051 }
0052 
0053 UI::Global::SessionManager::~SessionManager()
0054 {
0055 
0056 }
0057 
0058 UI::Global::SessionManager *UI::Global::SessionManager::m_self = nullptr;
0059 
0060 UI::Global::SessionManager *UI::Global::SessionManager::self()
0061 {
0062     if (!m_self) {
0063         m_self = new SessionManager;
0064     }
0065     return m_self;
0066 }
0067 
0068 void UI::Global::SessionManager::emitNewPostWidgetAdded(UI::PostWidget *widget, Choqok::Account *theAccount,
0069         const QString &timelineName)
0070 {
0071     Q_EMIT newPostWidgetAdded(widget, theAccount, timelineName);
0072 }
0073 
0074 void UI::Global::SessionManager::resetNotifyManager()
0075 {
0076     NotifyManager::resetNotifyManager();
0077 }
0078 
0079 }
0080 
0081 #include "moc_choqokuiglobal.cpp"