-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpandaqt5.cpp
105 lines (81 loc) · 2.63 KB
/
pandaqt5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "pandaqt5.h"
#include "ui_pandaqt5.h"
#include <QtWidgets>
#include <QtNetwork/QNetworkAccessManager>
#include <QUrl>
#include "customwidgets/pandatvchannelthumbnail.h"
#include "forms/FormSettings.h"
#include "forms/formgamecategories.h"
#include "forms/formbookmarks.h"
#include "forms/formchannels.h"
Pandaqt5::Pandaqt5(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Pandaqt5)
{
ui->setupUi(this);
qDebug() << "Adding forms";
//Adding forms
frm_settings = new FormSettings(ui->tabWidget);
ui->tabWidget->addTab(frm_settings, "Settings");
frm_channels = new FormChannels(ui->tabWidget, frm_settings);
ui->tabWidget->addTab(frm_channels, "Channels");
frm_bookmarks = new FormBookmarks(ui->tabWidget, frm_settings);
ui->tabWidget->addTab(frm_bookmarks, "Bookmarks");
frm_gameCategories = new FormGameCategories(ui->tabWidget);
ui->tabWidget->addTab(frm_gameCategories, "GameCategories");
connect(frm_gameCategories, SIGNAL(categoryChanged(QString)), this, SLOT(slot_categoryChanged(QString)));
connect(frm_gameCategories, SIGNAL(categoryChanged(QString)), frm_channels, SLOT(slot_categoryChanged(QString)));
connect(frm_channels, SIGNAL(addedBookmark(QString)), frm_bookmarks, SLOT(slot_addBookmark(QString)));
ui->tabWidget->tabBar()->hide();
//end add forms
//Startup with game categories
ui->tabWidget->setCurrentWidget(frm_gameCategories);
/* Tray Icon
*/
m_trayIcon = new QSystemTrayIcon(QIcon(":/pandatray"));
m_trayIcon->show();
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &Pandaqt5::slot_handleActivateTray);
}
Pandaqt5::~Pandaqt5()
{
delete m_trayIcon;
delete ui;
}
void Pandaqt5::changeEvent(QEvent *event)
{
QMainWindow::changeEvent(event);
if(event->type() == QEvent::WindowStateChange)
if(isMinimized()&&frm_settings->isMinimizeToTray())
this->hide();
}
void Pandaqt5::slot_categoryChanged(QString)
{
ui->tabWidget->setCurrentWidget(frm_channels);
}
void Pandaqt5::slot_handleActivateTray(QSystemTrayIcon::ActivationReason)
{
if(isHidden()){
this->show();
}else{
if(frm_settings->isMinimizeToTray())
{
this->hide();
}
}
}
void Pandaqt5::on_m_buttonBookmarks_clicked()
{
ui->tabWidget->setCurrentWidget(frm_bookmarks);
}
void Pandaqt5::on_m_buttonSettings_clicked()
{
ui->tabWidget->setCurrentWidget(frm_settings);
}
void Pandaqt5::on_m_buttonChannels_clicked()
{
ui->tabWidget->setCurrentWidget(frm_channels);
}
void Pandaqt5::on_m_buttonGameCategories_clicked()
{
ui->tabWidget->setCurrentWidget(frm_gameCategories);
}