3 #include "MainArea.moc"
4 #include "SessionManager.h"
9 MainArea::MainArea(QWidget
*parent
) {
10 SessionManager
*manager
= new SessionManager
;
11 this->addTab(manager
, tr("&Session Manager"));
12 connect(manager
, SIGNAL(new_tab_request(QWidget
*, QString
)), this, SLOT(add_tab(QWidget
*, QString
)));
13 connect(manager
, SIGNAL(remove_tab_request(QWidget
*)), this, SLOT(remove_tab(QWidget
*)));
14 this->setTabsClosable(true);
16 connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(tab_close_requested(int)));
19 void MainArea::add_tab(QWidget
*tab
, QString name
) {
20 this->addTab(tab
, name
);
21 this->setCurrentWidget(tab
);
24 void MainArea::remove_tab(QWidget
*tab
) {
25 if(this->indexOf(tab
)) this->removeTab(indexOf(tab
));
28 void MainArea::tab_close_requested(int index
) {
29 if(index
== 0) return;
30 this->widget(index
)->deleteLater();
34 } // namespace Aesalon