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("Pica Pica Messenger " VERSION_STRING "
Copyright (c) 2012 - 2019 Anton Sviridenko
\
https://picapica.im
\
User Manual
\
protocol version " PICA_PROTO_VER_STRING "
"
"client protocol version " PICA_PROTO_CLIENT_VER_STRING "
"
""
"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/>.
"));
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);
}