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
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*
(c) Copyright 2012 - 2018 Anton Sviridenko
https://picapica.im
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "picaactioncenter.h"
#include "globals.h"
#include "mainwindow.h"
#include "skynet.h"
#include <QApplication>
#include "../PICA_proto.h"
#include "accounts.h"
#include "dialogs/showpicaiddialog.h"
#include "sound.h"
#include "dialogs/settingsdialog.h"
#include "dialogs/nodesdialog.h"
#include <QMessageBox>
PicaActionCenter::PicaActionCenter(QObject *parent) :
QObject(parent)
{
exitAct = new QAction(tr("E&xit"), this);
exitAct->setStatusTip(tr("Close Pica Pica messenger and exit"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(exit()));
aboutAct = new QAction(tr("A&bout"), this);
aboutAct->setStatusTip(tr("About Pica Pica Messenger"));
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
showmyidAct = new QAction(tr("Show My Pica Pica ID"), this);
connect(showmyidAct, SIGNAL(triggered()), this, SLOT(showmyid()));
muteSoundsAct = new QAction(tr("&Mute Sounds"), this);
muteSoundsAct->setCheckable(true);
connect(muteSoundsAct, SIGNAL(triggered(bool)), this, SLOT(muteSounds(bool)));
settingsAct = new QAction(tr("&Configure Messenger..."), this);
connect(settingsAct, SIGNAL(triggered(bool)), this, SLOT(showsettings()));
nodesAct = new QAction(tr("Show &Nodes..."), this);
connect(nodesAct, SIGNAL(triggered()), this, SLOT(shownodes()));
}
void PicaActionCenter::about()
{
#ifdef PACKAGE_VERSION
#define VERSION_STRING "v" PACKAGE_VERSION
#else
#define VERSION_STRING ""
#endif
QMessageBox mbx;
mbx.setWindowIcon(picapica_ico_sit);
mbx.setIconPixmap(picapica_ico_sit.pixmap(32));
mbx.setTextFormat(Qt::RichText);
mbx.setText(tr("<b>Pica Pica Messenger " VERSION_STRING "<br>Copyright (c) 2012 - 2019 Anton Sviridenko</b><br><br>\
<a href=https://picapica.im>https://picapica.im</a><br><br>\
<a href=\"https://picapica.im/?page_id=192&lang=en\">User Manual</a><br><br>\
protocol version " PICA_PROTO_VER_STRING "<br>"
"client protocol version " PICA_PROTO_CLIENT_VER_STRING "<br>"
"<pre>"
"This program is free software: you can redistribute it and/or modify" "<br>"
"it under the terms of the GNU General Public License as published by" "<br>"
"the Free Software Foundation, either version 3 of the License, or" "<br>"
"(at your option) any later version." "<br>"
"<br><br>"
"This program is distributed in the hope that it will be useful," "<br>"
"but WITHOUT ANY WARRANTY; without even the implied warranty of" "<br>"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" "<br>"
"GNU General Public License for more details." "<br>"
"<br><br>"
"You should have received a copy of the GNU General Public License" "<br>"
"along with this program. If not, see <https://www.gnu.org/licenses/>.</pre><br>"));
mbx.exec();
}
void PicaActionCenter::exit()
{
if (mainwindow)
mainwindow->close();
skynet->Exit();
QApplication::instance()->quit();
}
void PicaActionCenter::showsettings()
{
SettingsDialog sd;
sd.exec();
}
void PicaActionCenter::shownodes()
{
NodesDialog nd;
nd.exec();
}
void PicaActionCenter::showmyid()
{
ShowPicaIdDialog d(Accounts::GetCurrentAccount().name, Accounts::GetCurrentAccount().id, tr("My Current Account"));
d.exec();
}
void PicaActionCenter::muteSounds(bool yes)
{
Sound::mute(yes);
}
|