diff --git a/saori.pro b/saori.pro index 7be987b..ec4d807 100644 --- a/saori.pro +++ b/saori.pro @@ -34,7 +34,8 @@ saoriviewentry.cpp \ saoriconfiguredialog.cpp \ saoritootwidget.cpp \ - saoridownloader.cpp + saoridownloader.cpp \ + saorisystemtray.cpp HEADERS += \ saoriwindow.h \ @@ -48,7 +49,8 @@ saoriviewentry.h \ saoriconfiguredialog.h \ saoritootwidget.h \ - saoridownloader.h + saoridownloader.h \ + saorisystemtray.h FORMS += \ saoriwindow.ui \ diff --git a/saorisystemtray.cpp b/saorisystemtray.cpp new file mode 100644 index 0000000..91d170f --- /dev/null +++ b/saorisystemtray.cpp @@ -0,0 +1,41 @@ +/*** + +The MIT License + +Copyright (c) 2018 Teppei Tamra (TAM) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +***/ + +#include "saorisystemtray.h" +#include + +SaoriSystemTray::SaoriSystemTray(QWidget *parent) : + QSystemTrayIcon(parent) +{ + QImage icon(":/icons/saori.svg"); + m_icon = QIcon(QPixmap::fromImage(icon.scaled(QSize(44,44)))); + m_menu = new QMenu(); + m_action_quit = new QAction(tr("Quit"),this); + m_action_show = new QAction(tr("Show MainWindow"),this); + + m_menu->addAction(m_action_show); + m_menu->addAction(m_action_quit); +} diff --git a/saorisystemtray.h b/saorisystemtray.h new file mode 100644 index 0000000..cf5c850 --- /dev/null +++ b/saorisystemtray.h @@ -0,0 +1,48 @@ +/*** + +The MIT License + +Copyright (c) 2018 Teppei Tamra (TAM) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +***/ + +#ifndef SAORISYSTEMTRAY_H +#define SAORISYSTEMTRAY_H + +#include +#include +#include +#include +#include + +class SaoriSystemTray : public QSystemTrayIcon +{ +public: + SaoriSystemTray(QWidget *parent = 0); + +protected: + QIcon m_icon; + QMenu *m_menu; + QAction *m_action_quit; + QAction *m_action_show; +}; + +#endif // SAORISYSTEMTRAY_H