Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/mainwin.cpp b/src/mainwin.cpp
- index 3bbd663b..b45ffce7 100644
- --- a/src/mainwin.cpp
- +++ b/src/mainwin.cpp
- @@ -71,6 +71,8 @@
- #include <QtAlgorithms>
- #ifdef Q_OS_WIN
- #include <windows.h>
- +#include "widgets/thumbnailtoolbar.h"
- +#include <QWinTaskbarButton>
- #endif
- #ifdef HAVE_X11
- #include <x11windowsystem.h>
- @@ -154,6 +156,8 @@ public:
- #ifdef Q_OS_WIN
- DWORD deactivationTickCount;
- + QPointer<QWinTaskbarButton> taskbarBtn_;
- + QPointer<PsiThumbnailToolBar> thumbnailToolBar_;
- #endif
- void registerActions();
- @@ -510,16 +514,9 @@ MainWin::MainWin(bool _onTop, bool _asTool, PsiCon *psi) :
- buildToolbars();
- // setUnifiedTitleAndToolBarOnMac(true);
- +
- #ifdef Q_OS_WIN
- - thumbnailToolBar_ = new PsiThumbnailToolBar(this, windowHandle());
- - connect(thumbnailToolBar_, &PsiThumbnailToolBar::openOptions, this, &MainWin::doOptions);
- - connect(thumbnailToolBar_, &PsiThumbnailToolBar::setOnline, this,
- - [this]() { d->getAction("status_online")->trigger(); });
- - connect(thumbnailToolBar_, &PsiThumbnailToolBar::setOffline, this,
- - [this]() { d->getAction("status_offline")->trigger(); });
- - connect(thumbnailToolBar_, &PsiThumbnailToolBar::runActiveEvent, this, &MainWin::doRecvNextEvent);
- - connect(psi->contactList(), &PsiContactList::queueChanged, this,
- - [this]() { thumbnailToolBar_->updateToolBar(d->nextAmount > 0); });
- + updateWinTaskbar(_asTool);
- #endif
- connect(qApp, SIGNAL(dockActivated()), SLOT(dockActivated()));
- @@ -752,6 +749,9 @@ void MainWin::setWindowOpts(bool _onTop, bool _asTool)
- setWindowFlags(flags);
- show();
- +#ifdef Q_OS_WIN
- + updateWinTaskbar(_asTool);
- +#endif
- }
- void MainWin::setUseDock(bool use)
- @@ -1478,6 +1478,35 @@ bool MainWin::nativeEvent(const QByteArray &eventType, MSG *msg, long *result)
- }
- return false;
- }
- +
- +void MainWin::updateWinTaskbar(bool enabled)
- +{
- + if(! enabled) {
- + if(!d->thumbnailToolBar_) {
- + d->thumbnailToolBar_ = new PsiThumbnailToolBar(this, windowHandle());
- + connect(d->thumbnailToolBar_, &PsiThumbnailToolBar::openOptions, this, &MainWin::doOptions);
- + connect(d->thumbnailToolBar_, &PsiThumbnailToolBar::setOnline, this,
- + [this]() { d->getAction("status_online")->trigger(); });
- + connect(d->thumbnailToolBar_, &PsiThumbnailToolBar::setOffline, this,
- + [this]() { d->getAction("status_offline")->trigger(); });
- + connect(d->thumbnailToolBar_, &PsiThumbnailToolBar::runActiveEvent, this, &MainWin::doRecvNextEvent);
- + connect(d->psi->contactList(), &PsiContactList::queueChanged, this,
- + [this]() { d->thumbnailToolBar_->updateToolBar(d->nextAmount > 0); });
- + }
- + if(!d->taskbarBtn_)
- + d->taskbarBtn_ = new QWinTaskbarButton(this);
- + }
- + else {
- + if(d->thumbnailToolBar_) {
- + delete d->thumbnailToolBar_;
- + d->thumbnailToolBar_ = nullptr;
- + }
- + if(d->taskbarBtn_) {
- + delete d->taskbarBtn_;
- + d->taskbarBtn_ = nullptr;
- + }
- + }
- +}
- #endif
- void MainWin::updateCaption()
- diff --git a/src/mainwin.h b/src/mainwin.h
- index 02f38fde..802f064e 100644
- --- a/src/mainwin.h
- +++ b/src/mainwin.h
- @@ -22,9 +22,6 @@
- #include "advwidget.h"
- #include "xmpp_status.h"
- -#ifdef Q_OS_WIN
- -#include "widgets/thumbnailtoolbar.h"
- -#endif
- #include <QList>
- #include <QMainWindow>
- @@ -188,14 +185,15 @@ private:
- void buildStatusMenu(GlobalStatusMenu *statusMenu);
- +#ifdef Q_OS_WIN
- + void updateWinTaskbar(bool enabled);
- +#endif
- +
- private:
- class Private;
- Private *d;
- friend class Private;
- QList<PsiToolBar *> toolbars_;
- -#ifdef Q_OS_WIN
- - PsiThumbnailToolBar *thumbnailToolBar_;
- -#endif
- };
- #endif // MAINWIN_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement