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()); }
MessageView* SessionTabWidget::openView(const QString& receiver) { MessageView* view = d.views.value(receiver.toLower()); if (!view) { view = new MessageView(d.handler.session(), this); view->setReceiver(receiver); connect(view, SIGNAL(alert(MessageView*, bool)), this, SLOT(alertTab(MessageView*, bool))); connect(view, SIGNAL(highlight(MessageView*, bool)), this, SLOT(highlightTab(MessageView*, bool))); connect(view, SIGNAL(query(QString)), this, SLOT(openView(QString))); connect(view, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); d.handler.addReceiver(receiver, view); d.views.insert(receiver.toLower(), view); addTab(view, receiver); }
FirmwareUpdate::FirmwareUpdate(QWidget *parent) : QWidget(parent) { isIntroNextBtn = true; isFrameTurn = false; isDownloading = true; mUimanager = sHandler->getUiManager(); Q_ASSERT(mUimanager); mInfoManager = sHandler->getInfoManager(); Q_ASSERT(mInfoManager); //IUiManager *mUimanager = sHandler->getUiManager(); //Q_ASSERT(mUimanager); //mUimanager->setNetStateFlag("c02fb5db-6c62-42e7-bf4a-f704247ed7b8", true); //UpdateUrl = "http://routerlogin.net/cgi-bin/upgrade.html"; //UpdateUrl = "http://routerlogin.net/UPG_upgrade.htm"; UpdateUrl = "http://routerlogin.net"; isChecked = false; WholeLayout = new QVBoxLayout(parent); IntroPage = new IntroWizard(parent); CheckPage = new CheckWizard(parent); DownloadPage = new DownloadWizard(parent); //UpdatePage = new UpdateWizard(parent); CompletePage = new CompleteWizard(parent); FinishPage = new FinishWizard(parent); WizardLayout = new QStackedWidget(); WizardLayout->addWidget(IntroPage); WizardLayout->addWidget(CheckPage); WizardLayout->addWidget(DownloadPage); //WizardLayout->addWidget(UpdatePage); WizardLayout->addWidget(CompletePage); WizardLayout->addWidget(FinishPage); //////Search NETGEAR's Firmware Version // NetgearProduct = new InfoFirmware(); ProductInfo = new QMap<QString, QString>; // //rError = new QString; intErr = new QList<int>; // //NetgearProduct->GetInfo(&ProductInfo, &rError); // //connect(NetgearProduct, SIGNAL(GetSuccess()), this, SLOT(SetNetgear())); // //connect(NetgearProduct, SIGNAL(GetFailed()), this, SLOT(NotNetgear())); // //connect(NetgearProduct, SIGNAL(GetFinish(bool)), IntroPage, SLOT(closeView())); //////Check NETGEAR's Firmware Version ProductCheck = new CheckFirmware(); CheckInfo = new QMap<QString, QString>; intCheckErr = new QList<int>; connect(ProductCheck, SIGNAL(CheckFinish(bool)), this, SLOT(CheckResult(bool))); connect(ProductCheck, SIGNAL(CheckFinish(bool)), IntroPage, SLOT(closeView())); connect(ProductCheck, SIGNAL(GetNewTimeOut(int)), this, SLOT(viewGetNewTimeout(int))); //////Download Firmware Infomation DownInfo = new QString; intDownloadErr = new QList<int>; WholeLayout->addWidget(WizardLayout); setLayout(WholeLayout); connect(DownloadPage, SIGNAL(DownloadFinish(bool)), this, SLOT(DownloadOver(bool))); connect(CheckPage, SIGNAL(ToBack()), this, SLOT(PageToBack())); connect(DownloadPage, SIGNAL(ToBack()), this, SLOT(PageToBack())); //connect(UpdatePage, SIGNAL(ToBack()), this, SLOT(PageToBack())); connect(CompletePage, SIGNAL(ToBack()), this, SLOT(PageToBack())); connect(FinishPage, SIGNAL(ToBack()), this, SLOT(PageToBack())); connect(IntroPage, SIGNAL(ToNext()), this, SLOT(PageToNext())); connect(IntroPage, SIGNAL(ToNext()), IntroPage, SLOT(openView())); connect(CheckPage, SIGNAL(ToNext()), this, SLOT(PageToNext())); connect(DownloadPage, SIGNAL(ToNext()), this, SLOT(PageToNext())); //connect(UpdatePage, SIGNAL(ToNext()), this, SLOT(PageToNext())); connect(CompletePage, SIGNAL(ToNext()), this, SLOT(PageToNext())); //connect(CompletePage, SIGNAL(ToNext()), this, SLOT(UpgradeComplete())); connect(IntroPage, SIGNAL(ToCancel()), this, SLOT(PageToHome())); connect(CheckPage, SIGNAL(ToCancel()), this, SLOT(PageToHome())); connect(DownloadPage, SIGNAL(ToCancel()), this, SLOT(PageToHome())); //connect(UpdatePage, SIGNAL(ToCancel()), this, SLOT(PageToHome())); connect(CompletePage, SIGNAL(ToCancel()), this, SLOT(PageToHome())); connect(FinishPage, SIGNAL(ToNext()), this, SLOT(FinishToHome())); TranslateUi(); WizardLayout->setCurrentWidget(IntroPage); //WizardLayout->setCurrentIndex(4); }