mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
FeedReader:
- added notify in main window, systray icon and settings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6021 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b1d887b614
commit
0a499634dd
@ -12,6 +12,7 @@ SOURCES = FeedReaderPlugin.cpp \
|
||||
gui/FeedReaderNotify.cpp \
|
||||
gui/FeedReaderConfig.cpp \
|
||||
gui/FeedReaderStringDefs.cpp \
|
||||
gui/FeedReaderUserNotify.cpp \
|
||||
util/CURLWrapper.cpp \
|
||||
util/XMLWrapper.cpp \
|
||||
util/HTMLWrapper.cpp \
|
||||
@ -28,6 +29,7 @@ HEADERS = FeedReaderPlugin.h \
|
||||
gui/FeedReaderNotify.h \
|
||||
gui/FeedReaderConfig.h \
|
||||
gui/FeedReaderStringDefs.h \
|
||||
gui/FeedReaderUserNotify.h \
|
||||
util/CURLWrapper.h \
|
||||
util/XMLWrapper.h \
|
||||
util/HTMLWrapper.h \
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "FeedReaderUserNotify.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
@ -178,6 +179,11 @@ FeedReaderDialog::~FeedReaderDialog()
|
||||
delete(mNotify);
|
||||
}
|
||||
|
||||
UserNotify *FeedReaderDialog::getUserNotify(QObject *parent)
|
||||
{
|
||||
return new FeedReaderUserNotify(this, mFeedReader, mNotify, parent);
|
||||
}
|
||||
|
||||
void FeedReaderDialog::processSettings(bool load)
|
||||
{
|
||||
mProcessSettings = true;
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
FeedReaderDialog(RsFeedReader *feedReader, QWidget *parent = 0);
|
||||
~FeedReaderDialog();
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *e);
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
106
plugins/FeedReader/gui/FeedReaderUserNotify.cpp
Normal file
106
plugins/FeedReader/gui/FeedReaderUserNotify.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 RetroShare Team
|
||||
*
|
||||
* 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 "FeedReaderUserNotify.h"
|
||||
#include "FeedReaderNotify.h"
|
||||
#include "FeedReaderDialog.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
#include "interface/rsFeedReader.h"
|
||||
|
||||
FeedReaderUserNotify::FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) :
|
||||
UserNotify(parent), mFeedReaderDialog(feedReaderDialog), mFeedReader(feedReader), mNotify(notify)
|
||||
{
|
||||
connect(mNotify, SIGNAL(notifyMsgChanged(QString,QString,int)), this, SLOT(updateIcon()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::hasSetting(QString &name)
|
||||
{
|
||||
name = tr("FeedReader Message");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyEnabled()
|
||||
{
|
||||
bool enable = true;
|
||||
|
||||
Settings->beginGroup(QString("FeedReader"));
|
||||
enable = Settings->value("TrayNotifyEnable", enable).toBool();
|
||||
Settings->endGroup();
|
||||
|
||||
return enable;
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyCombined()
|
||||
{
|
||||
bool combined = false;
|
||||
|
||||
Settings->beginGroup(QString("FeedReader"));
|
||||
combined = Settings->value("TrayNotifyCombined", combined).toBool();
|
||||
Settings->endGroup();
|
||||
|
||||
return combined;
|
||||
}
|
||||
|
||||
bool FeedReaderUserNotify::notifyBlink()
|
||||
{
|
||||
bool blink = false;
|
||||
|
||||
Settings->beginGroup(QString("FeedReader"));
|
||||
blink = Settings->value("TrayNotifyBlink", blink).toBool();
|
||||
Settings->endGroup();
|
||||
|
||||
return blink;
|
||||
}
|
||||
|
||||
void FeedReaderUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
Settings->beginGroup(QString("FeedReader"));
|
||||
Settings->setValue("TrayNotifyEnable", enabled);
|
||||
Settings->setValue("TrayNotifyCombined", combined);
|
||||
Settings->setValue("TrayNotifyBlink", blink);
|
||||
Settings->endGroup();
|
||||
}
|
||||
|
||||
QIcon FeedReaderUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/Feed.png");
|
||||
}
|
||||
|
||||
QIcon FeedReaderUserNotify::getMainIcon(bool hasNew)
|
||||
{
|
||||
return hasNew ? QIcon(":/images/FeedReader.png") : QIcon(":/images/FeedReader.png");
|
||||
}
|
||||
|
||||
unsigned int FeedReaderUserNotify::getNewCount()
|
||||
{
|
||||
uint32_t newMessageCount = 0;
|
||||
mFeedReader->getMessageCount("", NULL, &newMessageCount, NULL);
|
||||
|
||||
return newMessageCount;
|
||||
}
|
||||
|
||||
void FeedReaderUserNotify::iconClicked()
|
||||
{
|
||||
MainWindow::showWindow(mFeedReaderDialog);
|
||||
}
|
55
plugins/FeedReader/gui/FeedReaderUserNotify.h
Normal file
55
plugins/FeedReader/gui/FeedReaderUserNotify.h
Normal file
@ -0,0 +1,55 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2012 RetroShare Team
|
||||
*
|
||||
* 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.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef FEEDREADERUSERNOTIFY_H
|
||||
#define FEEDREADERUSERNOTIFY_H
|
||||
|
||||
#include "gui/common/UserNotify.h"
|
||||
|
||||
class FeedReaderDialog;
|
||||
class RsFeedReader;
|
||||
class FeedReaderNotify;
|
||||
|
||||
class FeedReaderUserNotify : public UserNotify
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FeedReaderUserNotify(FeedReaderDialog *feedReaderDialog, RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
virtual QIcon getMainIcon(bool hasNew);
|
||||
virtual unsigned int getNewCount();
|
||||
virtual void iconClicked();
|
||||
|
||||
FeedReaderDialog *mFeedReaderDialog;
|
||||
RsFeedReader *mFeedReader;
|
||||
FeedReaderNotify *mNotify;
|
||||
};
|
||||
|
||||
#endif // FEEDREADERUSERNOTIFY_H
|
@ -837,27 +837,47 @@ bool p3FeedReader::getMessageCount(const std::string &feedId, uint32_t *msgCount
|
||||
|
||||
RsStackMutex stack(mFeedReaderMtx); /******* LOCK STACK MUTEX *********/
|
||||
|
||||
std::map<std::string, RsFeedReaderFeed*>::iterator feedIt = mFeeds.find(feedId);
|
||||
if (feedIt == mFeeds.end()) {
|
||||
if (feedId.empty()) {
|
||||
std::map<std::string, RsFeedReaderFeed*>::iterator feedIt;
|
||||
for (feedIt = mFeeds.begin(); feedIt != mFeeds.end(); ++feedIt) {
|
||||
RsFeedReaderFeed *fi = feedIt->second;
|
||||
|
||||
std::map<std::string, RsFeedReaderMsg*>::iterator msgIt;
|
||||
for (msgIt = fi->msgs.begin(); msgIt != fi->msgs.end(); ++msgIt) {
|
||||
RsFeedReaderMsg *mi = msgIt->second;
|
||||
|
||||
if (mi->flag & RS_FEEDMSG_FLAG_DELETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msgCount) ++(*msgCount);
|
||||
if (newCount && (mi->flag & RS_FEEDMSG_FLAG_NEW)) ++(*newCount);
|
||||
if (unreadCount && (mi->flag & RS_FEEDMSG_FLAG_READ) == 0) ++(*unreadCount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
std::map<std::string, RsFeedReaderFeed*>::iterator feedIt = mFeeds.find(feedId);
|
||||
if (feedIt == mFeeds.end()) {
|
||||
#ifdef FEEDREADER_DEBUG
|
||||
std::cerr << "p3FeedReader::getMessageCount - feed " << feedId << " not found" << std::endl;
|
||||
std::cerr << "p3FeedReader::getMessageCount - feed " << feedId << " not found" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
RsFeedReaderFeed *fi = feedIt->second;
|
||||
|
||||
std::map<std::string, RsFeedReaderMsg*>::iterator msgIt;
|
||||
for (msgIt = fi->msgs.begin(); msgIt != fi->msgs.end(); ++msgIt) {
|
||||
RsFeedReaderMsg *mi = msgIt->second;
|
||||
|
||||
if (mi->flag & RS_FEEDMSG_FLAG_DELETED) {
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msgCount) ++(*msgCount);
|
||||
if (newCount && (mi->flag & RS_FEEDMSG_FLAG_NEW)) ++(*newCount);
|
||||
if (unreadCount && (mi->flag & RS_FEEDMSG_FLAG_READ) == 0) ++(*unreadCount);
|
||||
RsFeedReaderFeed *fi = feedIt->second;
|
||||
|
||||
std::map<std::string, RsFeedReaderMsg*>::iterator msgIt;
|
||||
for (msgIt = fi->msgs.begin(); msgIt != fi->msgs.end(); ++msgIt) {
|
||||
RsFeedReaderMsg *mi = msgIt->second;
|
||||
|
||||
if (mi->flag & RS_FEEDMSG_FLAG_DELETED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msgCount) ++(*msgCount);
|
||||
if (newCount && (mi->flag & RS_FEEDMSG_FLAG_NEW)) ++(*newCount);
|
||||
if (unreadCount && (mi->flag & RS_FEEDMSG_FLAG_READ) == 0) ++(*unreadCount);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "rshare.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
#include "MessengerWindow.h"
|
||||
#include "NetworkDialog.h"
|
||||
#include "SearchDialog.h"
|
||||
@ -174,10 +175,10 @@
|
||||
|
||||
/** Constructor */
|
||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
: RWindow("MainWindow", parent, flags)
|
||||
: RWindow("MainWindow", parent, flags), ui(new Ui::MainWindow)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
_instance = this;
|
||||
|
||||
@ -217,19 +218,19 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
#endif
|
||||
|
||||
/** Left Side ToolBar**/
|
||||
connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
|
||||
connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) );
|
||||
connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) );
|
||||
connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
|
||||
connect(ui->actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
|
||||
connect(ui->actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) );
|
||||
connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) );
|
||||
connect(ui->actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
|
||||
|
||||
ui.actionMessenger->setVisible(true);
|
||||
ui->actionMessenger->setVisible(true);
|
||||
|
||||
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
|
||||
//connect(ui.actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) );
|
||||
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
|
||||
//connect(ui->actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) );
|
||||
|
||||
/** adjusted quit behaviour: trigger a warning that can be switched off in the saved
|
||||
config file RetroShare.conf */
|
||||
connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(doQuit()));
|
||||
connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(doQuit()));
|
||||
|
||||
QList<QPair<MainPage*, QAction*> > notify;
|
||||
|
||||
@ -237,36 +238,36 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
QActionGroup *grp = new QActionGroup(this);
|
||||
QAction *action;
|
||||
|
||||
ui.stackPages->add(networkDialog = new NetworkDialog(ui.stackPages),
|
||||
ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages),
|
||||
createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp));
|
||||
|
||||
ui.stackPages->add(friendsDialog = new FriendsDialog(ui.stackPages),
|
||||
ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp));
|
||||
notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action));
|
||||
|
||||
ui.stackPages->add(searchDialog = new SearchDialog(ui.stackPages),
|
||||
ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages),
|
||||
createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp));
|
||||
|
||||
ui.stackPages->add(transfersDialog = new TransfersDialog(ui.stackPages),
|
||||
ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp));
|
||||
notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action));
|
||||
|
||||
ui.stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui.stackPages),
|
||||
ui->stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui->stackPages),
|
||||
createPageAction(QIcon(IMAGE_FILES), tr("Files"), grp));
|
||||
|
||||
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages),
|
||||
ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||
notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action));
|
||||
|
||||
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
|
||||
ui->stackPages->add(channelFeed = new ChannelFeed(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
|
||||
notify.push_back(QPair<MainPage*, QAction*>(channelFeed, action));
|
||||
|
||||
#ifdef BLOGS
|
||||
ui.stackPages->add(blogsFeed = new BlogsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
|
||||
ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
|
||||
#endif
|
||||
|
||||
ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
|
||||
ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
|
||||
notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action));
|
||||
|
||||
@ -285,7 +286,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
|
||||
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
|
||||
QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp);
|
||||
ui.stackPages->add(pluginPage, pluginAction);
|
||||
ui->stackPages->add(pluginPage, pluginAction);
|
||||
notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction));
|
||||
}
|
||||
else if(rsPlugins->plugin(i) == NULL)
|
||||
@ -297,7 +298,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
#ifdef PLUGINMGR
|
||||
ui.stackPages->add(pluginsPage = new PluginsPage(ui.stackPages),
|
||||
ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages),
|
||||
createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
|
||||
#endif
|
||||
#endif
|
||||
@ -307,22 +308,22 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
if (!advancedMode)
|
||||
{
|
||||
ui.stackPages->add(getStartedPage = new GetStartedDialog(ui.stackPages),
|
||||
ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages),
|
||||
createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create the toolbar */
|
||||
ui.toolBar->addActions(grp->actions());
|
||||
ui->toolBar->addActions(grp->actions());
|
||||
|
||||
connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
|
||||
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));
|
||||
|
||||
#ifdef UNFINISHED
|
||||
ui.toolBar->addSeparator();
|
||||
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
|
||||
ui->toolBar->addSeparator();
|
||||
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow()));
|
||||
#endif
|
||||
|
||||
ui.stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
|
||||
ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
|
||||
|
||||
/** StatusBar section ********/
|
||||
/* initialize combobox in status bar */
|
||||
@ -368,7 +369,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
|
||||
UserNotify *userNotify = notifyIt->first->getUserNotify(this);
|
||||
if (userNotify) {
|
||||
userNotify->initialize(ui.toolBar, notifyIt->second);
|
||||
userNotify->initialize(ui->toolBar, notifyIt->second);
|
||||
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
|
||||
userNotifyList.push_back(userNotify);
|
||||
}
|
||||
@ -384,7 +385,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
loadOwnStatus();
|
||||
|
||||
/* Set focus to the current page */
|
||||
ui.stackPages->currentWidget()->setFocus();
|
||||
ui->stackPages->currentWidget()->setFocus();
|
||||
|
||||
idle = new Idle();
|
||||
idle->start();
|
||||
@ -398,7 +399,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/** Destructor. */
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
Settings->setLastPageInMainWindow(ui.stackPages->currentIndex());
|
||||
Settings->setLastPageInMainWindow(ui->stackPages->currentIndex());
|
||||
|
||||
delete peerstatus;
|
||||
delete natstatus;
|
||||
@ -409,6 +410,8 @@ MainWindow::~MainWindow()
|
||||
#ifdef UNFINISHED
|
||||
delete applicationWindow;
|
||||
#endif
|
||||
|
||||
delete(ui);
|
||||
}
|
||||
|
||||
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
|
||||
@ -676,7 +679,7 @@ void MainWindow::addAction(QAction *action, const char *slot)
|
||||
font = action->font();
|
||||
font.setPointSize(9);
|
||||
action->setFont(font);
|
||||
ui.toolBar->addAction(action);
|
||||
ui->toolBar->addAction(action);
|
||||
connect(action, SIGNAL(triggered()), this, slot);
|
||||
}
|
||||
|
||||
@ -759,6 +762,19 @@ void SetForegroundWindowInternal(HWND hWnd)
|
||||
activatePage (page);
|
||||
}
|
||||
|
||||
/** Shows the MainWindow with focus set to the given page. */
|
||||
/*static*/ void MainWindow::showWindow(MainPage *page)
|
||||
{
|
||||
if (_instance == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Show the dialog. */
|
||||
raiseWindow();
|
||||
/* Set the focus to the specified page. */
|
||||
_instance->ui->stackPages->setCurrentPage(page);
|
||||
}
|
||||
|
||||
/** Set focus to the given page. */
|
||||
/*static*/ bool MainWindow::activatePage(Page page)
|
||||
{
|
||||
@ -802,7 +818,7 @@ void SetForegroundWindowInternal(HWND hWnd)
|
||||
|
||||
if (Page) {
|
||||
/* Set the focus to the specified page. */
|
||||
_instance->ui.stackPages->setCurrentPage(Page);
|
||||
_instance->ui->stackPages->setCurrentPage(Page);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -816,7 +832,7 @@ void SetForegroundWindowInternal(HWND hWnd)
|
||||
return Network;
|
||||
}
|
||||
|
||||
QWidget *page = _instance->ui.stackPages->currentWidget();
|
||||
QWidget *page = _instance->ui->stackPages->currentWidget();
|
||||
|
||||
if (page == _instance->networkDialog) {
|
||||
return Network;
|
||||
@ -1074,11 +1090,11 @@ void MainWindow::on_actionQuick_Start_Wizard_activated()
|
||||
void
|
||||
MainWindow::retranslateUi()
|
||||
{
|
||||
ui.retranslateUi(this);
|
||||
foreach (MainPage *page, ui.stackPages->pages()) {
|
||||
ui->retranslateUi(this);
|
||||
foreach (MainPage *page, ui->stackPages->pages()) {
|
||||
page->retranslateUi();
|
||||
}
|
||||
foreach (QAction *action, ui.toolBar->actions()) {
|
||||
foreach (QAction *action, ui->toolBar->actions()) {
|
||||
action->setText(tr(qPrintable(action->data().toString()), "MainWindow"));
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,15 @@
|
||||
#include <QSystemTrayIcon>
|
||||
#include <set>
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
#include "gui/common/rwindow.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QActionGroup;
|
||||
class Idle;
|
||||
class PeerStatus;
|
||||
class NATStatus;
|
||||
@ -49,6 +53,8 @@ class MessengerWindow;
|
||||
class PluginsPage;
|
||||
class ChannelFeed;
|
||||
class BandwidthGraph;
|
||||
class MainPage;
|
||||
class UserNotify;
|
||||
|
||||
#ifdef RS_USE_LINKS
|
||||
class LinksDialog;
|
||||
@ -96,6 +102,7 @@ public:
|
||||
static void raiseWindow();
|
||||
/** Shows the MainWindow dialog with focus set to the given page. */
|
||||
static void showWindow(Page page);
|
||||
static void showWindow(MainPage *page);
|
||||
/** Set focus to the given page. */
|
||||
static bool activatePage (Page page);
|
||||
static Page getActivatePage ();
|
||||
@ -240,7 +247,7 @@ private:
|
||||
bool isIdle;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "mainpage.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
static QMap<std::string, ConfCertDialog*> instances;
|
||||
|
Loading…
Reference in New Issue
Block a user