MapZoom::MapZoom() : QMainWindow(0) { map = new LightMaps(this); setCentralWidget(map); map->setFocus(); QAction *osloAction = new QAction(tr("&Oslo"), this); QAction *berlinAction = new QAction(tr("&Berlin"), this); QAction *jakartaAction = new QAction(tr("&Jakarta"), this); QAction *nightModeAction = new QAction(tr("Night Mode"), this); nightModeAction->setCheckable(true); nightModeAction->setChecked(false); QAction *osmAction = new QAction(tr("About OpenStreetMap"), this); connect(osloAction, SIGNAL(triggered()), SLOT(chooseOslo())); connect(berlinAction, SIGNAL(triggered()), SLOT(chooseBerlin())); connect(jakartaAction, SIGNAL(triggered()), SLOT(chooseJakarta())); connect(nightModeAction, SIGNAL(triggered()), map, SLOT(toggleNightMode())); connect(osmAction, SIGNAL(triggered()), SLOT(aboutOsm())); QMenu *menu = menuBar()->addMenu(tr("&Options")); menu->addAction(osloAction); menu->addAction(berlinAction); menu->addAction(jakartaAction); menu->addSeparator(); menu->addAction(nightModeAction); menu->addAction(osmAction); QNetworkConfigurationManager manager; if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) { // Get saved network configuration QSettings settings(QSettings::UserScope, QLatin1String("QtProject")); settings.beginGroup(QLatin1String("QtNetwork")); const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString(); settings.endGroup(); // If the saved network configuration is not currently discovered use the system // default QNetworkConfiguration config = manager.configurationFromIdentifier(id); if ((config.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { config = manager.defaultConfiguration(); } networkSession = new QNetworkSession(config, this); connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened())); networkSession->open(); } else { networkSession = 0; } setWindowTitle(tr("Light Maps")); }
int LightMaps::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: toggleNightMode(); break; case 1: setZoom_p(); break; case 2: setZoom_m(); break; case 3: updateMap((*reinterpret_cast< const QRect(*)>(_a[1]))); break; default: ; } _id -= 4; } return _id; }
/*! \class MainWindow mainwindow.h \brief Class fills graphical user interface with controls. */ MainWindow::MainWindow() : QWidget(0, Qt::FramelessWindowHint), m_embedded(false) { // create a widget we can access in CSS: QWidget#PatientCare QWidget* top = new QWidget(this); #if defined(Q_WS_HILDON) || defined(Q_WS_S60) || defined(Q_WS_QWS) || defined(Q_OS_WINCE) m_embedded = true; #endif if (QApplication::arguments().contains("-embedded")) m_embedded = true; if (QApplication::arguments().contains("-no-embedded")) m_embedded = false; m_embOffSwitch = QApplication::arguments().contains("-embOffSwitch"); ui.setupUi(top); connect(ui.switchNightMode, SIGNAL(toggled(bool)), this, SLOT(toggleNightMode(bool))); setWindowTitle("PatientCare (Demo)"); setWindowIcon(QIcon(":/qt-logo32x32")); setSkins(); ui.switchSystemOff->setChecked(true); ui.switchNightMode->setChecked(true); toggleNightMode(true); m_controller = new PatientCareController(&ui, this); if (!m_embedded) { updateDecoration(); top->setGeometry(153, 95, 636, 476); QtSvgToggleSwitch* offSwitch = new QtSvgToggleSwitch(this); offSwitch->setSkin("Beryl"); offSwitch->setChecked(true); offSwitch->setGeometry(795, 568, 50, 50); connect(offSwitch, SIGNAL(toggled(bool)), top, SLOT(setVisible(bool))); connect(offSwitch, SIGNAL(toggled(bool)), this, SLOT(quitDelay())); } else {