Fix mainwindow titles: do not prepend ourselves the appname

Summary:
The appname is appended by the platform (integration) usually,
so that only results in duplication.

Also fix code to now show the map in the title on start.

Reviewers: rahn, nienhueser, #marble

Reviewed By: nienhueser, #marble

Differential Revision: https://phabricator.kde.org/D2088
parent 558039e1
......@@ -69,7 +69,8 @@ MainWindow::MainWindow( const QString& marbleDataPath, QWidget *parent )
setAutoSaveSettings();
connect( marbleWidget(), SIGNAL(themeChanged(QString)),
this, SLOT(setMapTitle()));
this, SLOT(updateWindowTitle()));
updateWindowTitle();
}
MainWindow::~MainWindow()
......@@ -88,12 +89,10 @@ MarbleWidget* MainWindow::marbleWidget() const
return m_part->controlView()->marbleWidget();
}
void MainWindow::setMapTitle()
void MainWindow::updateWindowTitle()
{
GeoSceneDocument *mapTheme = marbleWidget()->mapTheme();
if ( mapTheme ) {
setWindowTitle(i18n("Marble Virtual Globe") + " - " + mapTheme->head()->name());
}
setWindowTitle(mapTheme ? mapTheme->head()->name() : QString());
}
void MainWindow::changeViewSize( QAction* action )
......
......@@ -39,7 +39,7 @@ class MainWindow : public KXmlGuiWindow
MarbleWidget* marbleWidget() const;
public Q_SLOTS:
void setMapTitle();
void updateWindowTitle();
void changeViewSize( QAction* );
protected:
......
......@@ -183,7 +183,6 @@ MainWindow::MainWindow(const QString& marbleDataPath, const QVariantMap& cmdLine
m_controlView = new ControlView( this );
setWindowTitle( tr("Marble - Virtual Globe") );
setWindowIcon( QIcon(":/icons/marble.png") );
setCentralWidget( m_controlView );
......@@ -213,10 +212,11 @@ MainWindow::MainWindow(const QString& marbleDataPath, const QVariantMap& cmdLine
connect( m_controlView->marbleWidget(), SIGNAL(themeChanged(QString)),
this, SLOT(updateMapEditButtonVisibility(QString)) );
connect(m_controlView->marbleModel(), SIGNAL(themeChanged(QString)),
this, SLOT(updateApplicationTitle(QString)));
this, SLOT(updateWindowTitle()));
connect( m_controlView, SIGNAL(showMapWizard()), this, SLOT(showMapWizard()) );
connect( m_controlView, SIGNAL(mapThemeDeleted()), this, SLOT(fallBackToDefaultTheme()) );
updateWindowTitle();
setUpdatesEnabled( true );
m_position = QCoreApplication::translate( "Marble", NOT_AVAILABLE );
......@@ -1613,12 +1613,10 @@ void MainWindow::changeRecordingState()
m_stopRecordingAction->setEnabled( !m_stopRecordingAction->isEnabled() );
}
void MainWindow::updateApplicationTitle(const QString&)
void MainWindow::updateWindowTitle()
{
GeoSceneDocument *theme = m_controlView->marbleModel()->mapTheme();
if (theme) {
setWindowTitle(tr("Marble Virtual Globe") + " - " + theme->head()->name());
}
setWindowTitle(theme ? theme->head()->name() : QString());
}
void MainWindow::showMapWizard()
......
......@@ -82,7 +82,7 @@ private Q_SLOTS:
void changeRecordingState();
void updateApplicationTitle(const QString&);
void updateWindowTitle();
// File Menu
void openFile();
......
......@@ -50,6 +50,7 @@ int main(int argc, char *argv[])
QTranslator translator;
translator.load( "marble-" + lang, MarbleDirs::path(QString("lang") ) );
app.installTranslator(&translator);
app.setApplicationDisplayName(MainWindow::tr("Marble - Virtual Globe"));
// For non static builds on mac and win
// we need to be sure we can find the qt image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment