mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 00:58:32 -04:00
YACReaderLibrary: Add a tray icon
This commit is contained in:
parent
afab73cbc6
commit
1815ba64a1
@ -15,9 +15,6 @@
|
|||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
#include <QMatrix>
|
#include <QMatrix>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#ifndef NO_OPENGL
|
|
||||||
#include <QGLFormat>
|
|
||||||
#endif
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@ -88,10 +85,6 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
//#include <QtMacExtras>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LibraryWindow::LibraryWindow()
|
LibraryWindow::LibraryWindow()
|
||||||
:QMainWindow(),fullscreen(false),fetching(false),previousFilter(""),removeError(false),status(LibraryWindow::Normal)
|
:QMainWindow(),fullscreen(false),fetching(false),previousFilter(""),removeError(false),status(LibraryWindow::Normal)
|
||||||
{
|
{
|
||||||
@ -108,8 +101,6 @@ LibraryWindow::LibraryWindow()
|
|||||||
showRootWidget();
|
showRootWidget();
|
||||||
selectedLibrary->setCurrentIndex(0);
|
selectedLibrary->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::setupUI()
|
void LibraryWindow::setupUI()
|
||||||
@ -147,18 +138,36 @@ void LibraryWindow::setupUI()
|
|||||||
//if(settings->value(USE_OPEN_GL).toBool() == false)
|
//if(settings->value(USE_OPEN_GL).toBool() == false)
|
||||||
showMaximized();
|
showMaximized();
|
||||||
|
|
||||||
/*if(settings->contains(COMICS_VIEW_HEADERS_GEOMETRY))
|
trayIcon.setIcon(QApplication::windowIcon());
|
||||||
comicsView->horizontalHeader()->restoreGeometry(settings->value(COMICS_VIEW_HEADERS_GEOMETRY).toByteArray());*/
|
trayIcon.show();
|
||||||
|
connect(&trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||||
|
this, SLOT(trayActivation(QSystemTrayIcon::ActivationReason)));
|
||||||
|
}
|
||||||
|
|
||||||
/*socialDialog = new YACReaderSocialDialog(this);
|
void LibraryWindow::trayActivation(QSystemTrayIcon::ActivationReason reason)
|
||||||
socialDialog->setHidden(true);*/
|
{
|
||||||
|
if (reason == QSystemTrayIcon::Trigger)
|
||||||
|
{
|
||||||
|
setWindowState((windowState() & ~Qt::WindowMinimized));
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::WindowStateChange && isMinimized())
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMainWindow::changeEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::doLayout()
|
void LibraryWindow::doLayout()
|
||||||
{
|
{
|
||||||
//LAYOUT ELEMENTS------------------------------------------------------------
|
//LAYOUT ELEMENTS------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
|
QSplitter * sHorizontal = new QSplitter(Qt::Horizontal); //spliter principal
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
sHorizontal->setStyleSheet("QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}");
|
sHorizontal->setStyleSheet("QSplitter::handle{image:none;background-color:#B8B8B8;} QSplitter::handle:vertical {height:1px;}");
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
|
|
||||||
#include "yacreader_global_gui.h"
|
#include "yacreader_global_gui.h"
|
||||||
#include "yacreader_libraries.h"
|
#include "yacreader_libraries.h"
|
||||||
|
|
||||||
@ -377,14 +379,17 @@ public slots:
|
|||||||
void saveSelectedCoversTo();
|
void saveSelectedCoversTo();
|
||||||
void checkMaxNumLibraries();
|
void checkMaxNumLibraries();
|
||||||
|
|
||||||
|
void changeEvent(QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||||
Qt::WindowFlags previousWindowFlags;
|
Qt::WindowFlags previousWindowFlags;
|
||||||
QPoint previousPos;
|
QPoint previousPos;
|
||||||
QSize previousSize;
|
QSize previousSize;
|
||||||
|
QSystemTrayIcon trayIcon;
|
||||||
|
private slots:
|
||||||
|
void trayActivation(QSystemTrayIcon::ActivationReason reason);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user