SessionTabWidget::SessionTabWidget(Session* session, QWidget* parent) : TabWidget(parent) { d.handler.setSession(session); connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int))); connect(this, SIGNAL(newTabRequested()), this, SLOT(onNewTabRequested()), Qt::QueuedConnection); connect(this, SIGNAL(tabMenuRequested(int,QPoint)), this, SLOT(onTabMenuRequested(int,QPoint))); connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateStatus())); connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateStatus())); connect(&d.handler, SIGNAL(receiverToBeAdded(QString)), this, SLOT(openView(QString))); connect(&d.handler, SIGNAL(receiverToBeRemoved(QString)), this, SLOT(removeView(QString))); connect(&d.handler, SIGNAL(receiverToBeRenamed(QString,QString)), this, SLOT(renameView(QString,QString))); QShortcut* shortcut = new QShortcut(QKeySequence::AddTab, this); connect(shortcut, SIGNAL(activated()), this, SLOT(onNewTabRequested())); shortcut = new QShortcut(QKeySequence::Close, this); connect(shortcut, SIGNAL(activated()), this, SLOT(closeCurrentView())); MessageView* view = openView(d.handler.session()->host()); d.handler.setDefaultReceiver(view); updateStatus(); applySettings(d.settings); }
SessionTabWidget::SessionTabWidget(Session* session, QWidget* parent) : TabWidget(parent) { d.hasQuit = false; d.handler.setSession(session); session->setParent(&d.handler); connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int))); connect(this, SIGNAL(newTabRequested()), this, SLOT(onNewTabRequested()), Qt::QueuedConnection); connect(session, SIGNAL(activeChanged(bool)), this, SLOT(onActiveChanged(bool))); connect(session, SIGNAL(disconnected()), this, SLOT(onDisconnected())); connect(&d.handler, SIGNAL(receiverToBeAdded(QString)), this, SLOT(openView(QString))); connect(&d.handler, SIGNAL(receiverToBeRemoved(QString)), this, SLOT(removeView(QString))); connect(&d.handler, SIGNAL(receiverToBeRenamed(QString,QString)), this, SLOT(renameView(QString,QString))); QShortcut* shortcut = new QShortcut(QKeySequence::AddTab, this); connect(shortcut, SIGNAL(activated()), this, SLOT(onNewTabRequested())); shortcut = new QShortcut(QKeySequence::Close, this); connect(shortcut, SIGNAL(activated()), this, SLOT(closeCurrentView())); applySettings(Application::settings()); registerSwipeGestures(Qt::Horizontal); MessageView* view = openView(d.handler.session()->host()); d.handler.setDefaultReceiver(view); setTabInactive(0, !session->isActive()); }