forked from blue/squawk
44 lines
831 B
C++
44 lines
831 B
C++
|
#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;
|
||
|
}
|