| 95 | extern char const * kOauthTokenSetting; |
| 96 | |
| 97 | MainWindow::MainWindow(Framework & framework, std::unique_ptr<ScreenshotParams> && screenshotParams, |
| 98 | QRect const & screenGeometry |
| 99 | #ifdef BUILD_DESIGNER |
| 100 | , |
| 101 | QString const & mapcssFilePath |
| 102 | #endif |
| 103 | ) |
| 104 | : m_locationService(CreateDesktopLocationService(*this)) |
| 105 | , m_screenshotMode(screenshotParams != nullptr) |
| 106 | #ifdef BUILD_DESIGNER |
| 107 | , m_mapcssFilePath(mapcssFilePath) |
| 108 | #endif |
| 109 | { |
| 110 | setGeometry(screenGeometry); |
| 111 | |
| 112 | if (m_screenshotMode) |
| 113 | { |
| 114 | screenshotParams->m_statusChangedFn = [this](std::string const & state, bool finished) |
| 115 | { |
| 116 | statusBar()->showMessage(QString::fromStdString(state)); |
| 117 | if (finished) |
| 118 | QCoreApplication::quit(); |
| 119 | }; |
| 120 | } |
| 121 | |
| 122 | int const width = m_screenshotMode ? static_cast<int>(screenshotParams->m_width) : 0; |
| 123 | int const height = m_screenshotMode ? static_cast<int>(screenshotParams->m_height) : 0; |
| 124 | m_pDrawWidget = new DrawWidget(framework, std::move(screenshotParams), this); |
| 125 | |
| 126 | setCentralWidget(m_pDrawWidget); |
| 127 | |
| 128 | if (m_screenshotMode) |
| 129 | { |
| 130 | m_pDrawWidget->setFixedSize(width, height); |
| 131 | setFixedSize(width, height + statusBar()->height()); |
| 132 | } |
| 133 | |
| 134 | connect(m_pDrawWidget, SIGNAL(BeforeEngineCreation()), this, SLOT(OnBeforeEngineCreation())); |
| 135 | |
| 136 | CreateCountryStatusControls(); |
| 137 | CreateNavigationBar(); |
| 138 | CreateSearchBarAndPanel(); |
| 139 | |
| 140 | QString caption = QCoreApplication::applicationName(); |
| 141 | |
| 142 | #ifdef BUILD_DESIGNER |
| 143 | if (!m_mapcssFilePath.isEmpty()) |
| 144 | caption += QString(" - ") + m_mapcssFilePath; |
| 145 | #endif |
| 146 | |
| 147 | setWindowTitle(caption); |
| 148 | setWindowIcon(QIcon(":/ui/logo.png")); |
| 149 | |
| 150 | #ifndef OMIM_OS_WINDOWS |
| 151 | QMenu * helpMenu = new QMenu(tr("Help"), this); |
| 152 | menuBar()->addMenu(helpMenu); |
| 153 | helpMenu->addAction(tr("OpenStreetMap Login"), QKeySequence(Qt::CTRL | Qt::Key_O), this, SLOT(OnLoginMenuItem())); |
| 154 | helpMenu->addAction(tr("Upload Edits"), QKeySequence(Qt::CTRL | Qt::Key_U), this, SLOT(OnUploadEditsMenuItem())); |
nothing calls this directly
no test coverage detected