MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) : QWidget(parent) { mainObject = mOb; setProperty("settings_namespace", QVariant("mp_map_window")); mainObject->settings->restoreWindow(this); setWindowTitle(tr("Multi Player Map")); setWindowIcon(QIcon(":/icons/mpmap")); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); //** Toolbar QToolBar *toolbar = new QToolBar(); mainLayout->addWidget(toolbar, 1); //** Select server QLabel *lblSelectServer = new QLabel("Select Server:"); toolbar->addWidget(lblSelectServer); comboServer = new QComboBox(); toolbar->addWidget(comboServer); comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org")); comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org")); connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server(int))); //** Browser browser = new QWebView(this); mainLayout->addWidget(browser, 100); connect(browser, SIGNAL(loadStarted()), this, SLOT(start_progress())); connect(browser, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int))); connect(browser, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool))); //*** Status Bar statusBar = new QStatusBar(this); mainLayout->addWidget(statusBar); statusBar->showMessage("Idle"); //** Progress Bar progressBar = new QProgressBar(); progressBar->setVisible(false); statusBar->addPermanentWidget(progressBar); //*** Initialise on_combo_server(0); }
MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) : QWidget(parent) { mainObject = mOb; setProperty("settings_namespace", QVariant("mp_map_window")); mainObject->settings->restoreWindow(this); setWindowTitle(tr("Multi Player Map")); setWindowIcon(QIcon(":/icon/mpmap")); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); //** Toolbar QToolBar *toolbar = new QToolBar(); mainLayout->addWidget(toolbar, 1); //** Select server QLabel *lblSelectServer = new QLabel(tr("Select Server:")); toolbar->addWidget(lblSelectServer); comboServer = new QComboBox(); toolbar->addWidget(comboServer); //**get callsign //**add callsign to url comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org/")); comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org/")); comboServer->setCurrentIndex(0); connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server()) ); //============================================================= //== Cache //qDebug() << QDesktopServices::storageLocation(QDesktopServices::CacheLocation); networkDiskCache = new QNetworkDiskCache(this); networkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation)); networkCookieJar = new QNetworkCookieJar(this); //== Browser webView = new QWebView(this); mainLayout->addWidget(webView, 100); webView->page()->networkAccessManager()->setCache(networkDiskCache); webView->page()->networkAccessManager()->setCookieJar(networkCookieJar); connect(webView, SIGNAL(loadStarted()), this, SLOT(start_progress())); connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool))); //*** Status Bar statusBar = new QStatusBar(this); mainLayout->addWidget(statusBar); statusBar->showMessage("Idle"); //** Progress Bar progressBar = new QProgressBar(); progressBar->setVisible(false); statusBar->addPermanentWidget(progressBar); //*** Initialise on_combo_server(); }