1
0
forked from blue/squawk
squawk/ui/squawk.cpp

44 lines
831 B
C++
Raw Normal View History

2019-03-29 14:54:34 +00:00
#include "squawk.h"
#include "ui_squawk.h"
Squawk::Squawk(QWidget *parent) :
QMainWindow(parent),
m_ui(new Ui::Squawk),
accounts(0)
{
m_ui->setupUi(this);
connect(m_ui->actionAccounts, SIGNAL(triggered()), this, SLOT(onAccounts()));
}
Squawk::~Squawk() {
}
void Squawk::onAccounts()
{
if (accounts == 0) {
accounts = new Accounts(this);
accounts->setAttribute(Qt::WA_DeleteOnClose);
connect(accounts, SIGNAL(destroyed(QObject*)), this, SLOT(onAccountsClosed(QObject*)));
accounts->show();
} else {
accounts->focusWidget();
}
}
void Squawk::closeEvent(QCloseEvent* event)
{
if (accounts != 0) {
accounts->close();
}
QMainWindow::closeEvent(event);
}
void Squawk::onAccountsClosed(QObject* parent)
{
accounts = 0;
}