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 1b2a8897..f4b26f6c 100644
- --- a/src/mainwin.cpp
- +++ b/src/mainwin.cpp
- @@ -70,9 +70,6 @@
- #include <QVBoxLayout>
- #include <QtAlgorithms>
- #ifdef Q_OS_WIN
- -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- -#include "widgets/thumbnailtoolbar.h"
- -#endif
- #include <windows.h>
- #endif
- #ifdef HAVE_X11
- @@ -158,9 +155,6 @@ public:
- #ifdef Q_OS_WIN
- DWORD deactivationTickCount;
- -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- - QPointer<PsiThumbnailToolBar> thumbnailToolBar_;
- -#endif
- #endif
- void registerActions();
- @@ -533,10 +527,6 @@ MainWin::MainWin(bool _onTop, bool _asTool, PsiCon *psi) :
- });
- d->eventNotifier->hide();
- -#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- - updateWinTaskbar(_asTool);
- -#endif
- -
- connect(qApp, SIGNAL(dockActivated()), SLOT(dockActivated()));
- qApp->installEventFilter(this);
- @@ -742,9 +732,6 @@ void MainWin::setWindowOpts(bool _onTop, bool _asTool)
- setWindowFlags(flags);
- show();
- -#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- - updateWinTaskbar(_asTool);
- -#endif
- }
- void MainWin::setUseDock(bool use)
- @@ -1363,6 +1350,10 @@ void MainWin::closeEvent(QCloseEvent *e)
- trayHide();
- e->ignore();
- return;
- + } else if (!quitOnClose) { //Minimize window to taskbar if there is no trayicon and quit-on-close option is disabled
- + setWindowState(windowState() | Qt::WindowMinimized);
- + e->ignore();
- + return;
- }
- if (!askQuit()) {
- @@ -1465,30 +1456,6 @@ bool MainWin::nativeEvent(const QByteArray &eventType, MSG *msg, long *result)
- }
- return false;
- }
- -
- -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- -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 (!isActiveWindow() && d->allInOne)
- - qApp->alert(this, 0);
- - });
- - }
- - } else {
- - delete d->thumbnailToolBar_;
- - }
- -}
- -#endif
- #endif
- void MainWin::updateCaption()
- @@ -1645,12 +1612,21 @@ void MainWin::updateReadNext(PsiIcon *anim, int amount)
- d->eventNotifier->hide();
- d->eventNotifier->setText("");
- d->eventNotifier->setPsiIcon("");
- + if(d->allInOne) // set window header icon accordig to status
- + setWindowIcon(PsiIconset::instance()->statusPtr(d->lastStatus)->icon());
- } else {
- d->eventNotifier->setPsiIcon(anim);
- d->eventNotifier->setText(QString("<b>") + numEventsString(d->nextAmount) + "</b>");
- d->eventNotifier->show();
- // make sure it shows
- // qApp->processEvents();
- + // Hack. If All-in-one mode is enabled there is no reacton on incoming events
- + // so we have to flash taskbar icon by qApp->alert
- + // and change window header icon according to status
- + if(d->allInOne) {
- + setWindowIcon(anim->icon());
- + qApp->alert(this, 0);
- + }
- }
- updateTray();
- diff --git a/src/mainwin.h b/src/mainwin.h
- index e5a104ff..fe61532d 100644
- --- a/src/mainwin.h
- +++ b/src/mainwin.h
- @@ -189,10 +189,6 @@ private:
- void buildStatusMenu(GlobalStatusMenu *statusMenu);
- -#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- - void updateWinTaskbar(bool enabled);
- -#endif
- -
- private:
- class Private;
- Private *d;
- diff --git a/src/options/opt_application.cpp b/src/options/opt_application.cpp
- index 618252cb..d8459cba 100644
- --- a/src/options/opt_application.cpp
- +++ b/src/options/opt_application.cpp
- @@ -272,7 +272,7 @@ void OptionsTabApplication::doEnableQuitOnClose(Qt::CheckState state)
- const auto enabled = state != Qt::Unchecked;
- #endif
- OptApplicationUI *d = static_cast<OptApplicationUI *>(w);
- - d->ck_quitOnClose->setEnabled(enabled);
- + //d->ck_quitOnClose->setEnabled(enabled);
- d->ck_dockToolMW->setEnabled(enabled);
- #ifdef Q_OS_WIN
- d->ck_dockDCstyle->setEnabled(enabled);
- diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
- index 06436cb4..28de63ab 100644
- --- a/src/widgets/CMakeLists.txt
- +++ b/src/widgets/CMakeLists.txt
- @@ -62,19 +62,6 @@ set(HEADERS
- stretchwidget.h
- )
- -if(WIN32 AND (${QT_DEFAULT_MAJOR_VERSION} LESS_EQUAL 5))
- - find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS WinExtras REQUIRED)
- - list(APPEND QT_LIBRARIES
- - Qt${QT_DEFAULT_MAJOR_VERSION}::WinExtras
- - )
- - list(APPEND SOURCES
- - thumbnailtoolbar.cpp
- - )
- - list(APPEND HEADERS
- - thumbnailtoolbar.h
- - )
- -endif()
- -
- set(FORMS
- fancypopup.ui
- grepshortcutkeydialog.ui
- diff --git a/src/widgets/thumbnailtoolbar.cpp b/src/widgets/thumbnailtoolbar.cpp
- deleted file mode 100644
- index ae83f143..00000000
- --- a/src/widgets/thumbnailtoolbar.cpp
- +++ /dev/null
- @@ -1,64 +0,0 @@
- -/*
- - * thumbnailtoolbar.cpp - Thumbnail Toolbar Widget
- - * Copyright (C) 2021 Vitaly Tonkacheyev
- - *
- - * This library is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU Lesser General Public
- - * License as published by the Free Software Foundation; either
- - * version 2.1 of the License, or (at your option) any later version.
- - *
- - * This library 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
- - * Lesser General Public License for more details.
- - *
- - * You should have received a copy of the GNU Lesser General Public License
- - * along with this program. If not, see <https://www.gnu.org/licenses/>.
- - *
- - */
- -
- -#include "thumbnailtoolbar.h"
- -#include "iconset.h"
- -
- -#include <QWinThumbnailToolButton>
- -#include <QWindow>
- -
- -PsiThumbnailToolBar::PsiThumbnailToolBar(QObject *parent, QWindow *parentWindow) :
- - QWinThumbnailToolBar(parent), optionsBtn_(new QWinThumbnailToolButton(this)),
- - onlineStatusBtn_(new QWinThumbnailToolButton(this)), offlineStatusBtn_(new QWinThumbnailToolButton(this)),
- - eventsBtn_(new QWinThumbnailToolButton(this)), taskbarBtn_(new QWinTaskbarButton(this))
- -{
- - // ToolTips
- - optionsBtn_->setToolTip(tr("Options"));
- - onlineStatusBtn_->setToolTip(tr("Online"));
- - offlineStatusBtn_->setToolTip(tr("Offline"));
- - eventsBtn_->setToolTip(tr("Show Next Event"));
- - // Icons
- - optionsBtn_->setIcon(IconsetFactory::iconPtr("psi/options")->icon());
- - onlineStatusBtn_->setIcon(IconsetFactory::iconPtr("status/online")->icon());
- - offlineStatusBtn_->setIcon(IconsetFactory::iconPtr("status/offline")->icon());
- - eventsBtn_->setIcon(IconsetFactory::iconPtr("psi/events")->icon());
- - // Set dismiss
- - optionsBtn_->setDismissOnClick(true);
- - onlineStatusBtn_->setDismissOnClick(true);
- - offlineStatusBtn_->setDismissOnClick(true);
- - eventsBtn_->setDismissOnClick(true);
- -
- - updateToolBar(false);
- -
- - connect(optionsBtn_, &QWinThumbnailToolButton::clicked, this, &PsiThumbnailToolBar::openOptions);
- - connect(onlineStatusBtn_, &QWinThumbnailToolButton::clicked, this, &PsiThumbnailToolBar::setOnline);
- - connect(offlineStatusBtn_, &QWinThumbnailToolButton::clicked, this, &PsiThumbnailToolBar::setOffline);
- - connect(eventsBtn_, &QWinThumbnailToolButton::clicked, this, [this]() {
- - if (eventsBtn_->isEnabled())
- - emit runActiveEvent();
- - });
- - addButton(eventsBtn_);
- - addButton(onlineStatusBtn_);
- - addButton(offlineStatusBtn_);
- - addButton(optionsBtn_);
- - setWindow(parentWindow);
- - taskbarBtn_->setWindow(parentWindow);
- -}
- -
- -void PsiThumbnailToolBar::updateToolBar(bool hasEvents) { eventsBtn_->setEnabled(hasEvents); }
- diff --git a/src/widgets/thumbnailtoolbar.h b/src/widgets/thumbnailtoolbar.h
- deleted file mode 100644
- index d3ae87f8..00000000
- --- a/src/widgets/thumbnailtoolbar.h
- +++ /dev/null
- @@ -1,47 +0,0 @@
- -/*
- - * thumbnailtoolbar.h - Thumbnail Toolbar Widget
- - * Copyright (C) 2021 Vitaly Tonkacheyev
- - *
- - * This library is free software; you can redistribute it and/or
- - * modify it under the terms of the GNU Lesser General Public
- - * License as published by the Free Software Foundation; either
- - * version 2.1 of the License, or (at your option) any later version.
- - *
- - * This library 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
- - * Lesser General Public License for more details.
- - *
- - * You should have received a copy of the GNU Lesser General Public License
- - * along with this program. If not, see <https://www.gnu.org/licenses/>.
- - *
- - */
- -#ifndef THUMBNAIL_TOOLBAR_H
- -#define THUMBNAIL_TOOLBAR_H
- -
- -#include <QObject>
- -#include <QWinTaskbarButton>
- -#include <QWinThumbnailToolBar>
- -
- -class QWindow;
- -
- -class PsiThumbnailToolBar : public QWinThumbnailToolBar {
- - Q_OBJECT
- -public:
- - explicit PsiThumbnailToolBar(QObject *parent = 0, QWindow *parentWindow = 0);
- - void updateToolBar(bool hasEvents);
- -
- -signals:
- - void openOptions();
- - void setOnline();
- - void setOffline();
- - void runActiveEvent();
- -
- -private:
- - QWinThumbnailToolButton *optionsBtn_;
- - QWinThumbnailToolButton *onlineStatusBtn_;
- - QWinThumbnailToolButton *offlineStatusBtn_;
- - QWinThumbnailToolButton *eventsBtn_;
- - QWinTaskbarButton *taskbarBtn_;
- -};
- -#endif // THUMBNAIL_TOOLBAR_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement