Clementine-audio-player-Mac.../src/main.cpp

33 lines
860 B
C++
Raw Normal View History

2009-12-24 20:16:07 +01:00
#include "mainwindow.h"
#include "directory.h"
#include "song.h"
2010-01-17 17:10:26 +01:00
#include <QtSingleApplication>
#include <QtDebug>
2009-12-24 20:16:07 +01:00
int main(int argc, char *argv[]) {
2010-01-08 17:21:22 +01:00
QCoreApplication::setApplicationName("Clementine");
2009-12-29 20:22:02 +01:00
QCoreApplication::setApplicationVersion("0.1");
2010-01-08 17:21:22 +01:00
QCoreApplication::setOrganizationName("Clementine");
2009-12-24 20:16:07 +01:00
QCoreApplication::setOrganizationDomain("davidsansome.com");
qRegisterMetaType<DirectoryList>("DirectoryList");
qRegisterMetaType<SongList>("SongList");
2010-01-17 17:10:26 +01:00
QtSingleApplication a(argc, argv);
if (a.isRunning()) {
qDebug() << "Clementine is already running - activating existing window";
if (a.sendMessage("wake up!"))
return 0;
// Couldn't send the message so start anyway
}
2009-12-24 20:16:07 +01:00
MainWindow w;
2010-01-17 17:10:26 +01:00
a.setActivationWindow(&w);
QObject::connect(&a, SIGNAL(messageReceived(QString)), &w, SLOT(show()));
2009-12-24 20:16:07 +01:00
return a.exec();
}