Skip to content

Commit

Permalink
Hells. Yes. Make TH window come to front when launched with a URL. (X…
Browse files Browse the repository at this point in the history
…11, not sure if Win works yet.)
  • Loading branch information
jefferai committed Aug 27, 2011
1 parent fcb70b5 commit 4687e73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/libtomahawk/utils/tomahawkutils.cpp
Expand Up @@ -530,8 +530,14 @@ setNam( QNetworkAccessManager* nam )
qDebug() << Q_FUNC_INFO;
QWidgetList widgetList = qApp->topLevelWidgets();
int i = 0;
while( !widgetList.at( i )->isWindow() )
while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" )
i++;
if ( i == widgetList.count() )
{
qDebug() << Q_FUNC_INFO << " could not find main TH window";
return;
}

QWidget *widget = widgetList.at( i );

widget->show();
Expand Down Expand Up @@ -564,8 +570,14 @@ setNam( QNetworkAccessManager* nam )
qDebug() << Q_FUNC_INFO;
QWidgetList widgetList = qApp->topLevelWidgets();
int i = 0;
while( !widgetList.at( i )->isWindow() )
while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" )
i++;
if ( i == widgetList.count() )
{
qDebug() << Q_FUNC_INFO << " could not find main TH window";
return;
}

QWidget *widget = widgetList.at( i );

widget->show();
Expand Down
1 change: 1 addition & 0 deletions src/tomahawkapp.cpp
Expand Up @@ -222,6 +222,7 @@ TomahawkApp::init()
tDebug() << "Init MainWindow.";
m_mainwindow = new TomahawkWindow();
m_mainwindow->setWindowTitle( "Tomahawk" );
m_mainwindow->setObjectName( "TH_Main_Window" );
m_mainwindow->show();
}
#endif
Expand Down

0 comments on commit 4687e73

Please sign in to comment.