+jspeed (0.1-4) unstable; urgency=low
+
+ * Fixed a bug in theme scheduler settings saving.
+
+ -- Jesse Hakanen <jessehakanen@gmail.com> Tue, 27 Jul 2010 16:59:38 +0100
+
jspeed (0.1-3) unstable; urgency=low
* Speed camera support added.
#include "widgetscreen.h"
#include "poialerts.h"
#include "speedalarm.h"
+#include "mediaplayer.h"
MainWindow::MainWindow(): QMainWindow(0), menu_(0), themeLoader_(0), mainScreen_(0)
{
setWindowTitle(tr("jSpeed"));
showFullScreen();
addScreens();
- QTimer::singleShot(800, this, SLOT(loadServices()));
+ QTimer::singleShot(500, this, SLOT(loadServices()));
}
MainWindow::~MainWindow()
{
Odometer::instance().start();
QApplication::processEvents();
+ startBacklight();
+ QApplication::processEvents();
PoiAlerts::instance().start();
QApplication::processEvents();
SpeedAlarm::instance().start();
QApplication::processEvents();
- startBacklight();
+ MediaPlayer::init();
}
void MainWindow::addScreens()
QString const LOCAL_SOUND_DIR = ":/resources/sounds/";
}
+void MediaPlayer::init()
+{
+ getPlayer();
+}
+
bool MediaPlayer::play(QString const& file)
{
- static QMediaPlayer player;
+ QMediaPlayer* player = getPlayer();
QMediaContent media(QUrl::fromLocalFile(file));
return false;
}
- player.setMedia(media);
- player.play();
+ player->setMedia(media);
+ player->play();
return true;
}
+QMediaPlayer* MediaPlayer::getPlayer()
+{
+ static QMediaPlayer player;
+ return &player;
+}
+
void MediaPlayer::getSupportedFormats(QList<QString>& formats)
{
formats.clear();
#include <QtCore/QStringList>
#include <QtCore/QList>
+class QMediaPlayer;
+
class MediaPlayer
{
public:
enum Format {MP3, WAV, AAC, FORMAT_COUNT};
+ static void init();
static bool play(QString const& file);
static void getSupportedFormats(QList<QString>& formats);
static QString getFormatPattern();
static QStringList getFormatPatterns();
static QString getSoundDir();
static QString const& getLocalSoundDir();
+
+private:
+ static QMediaPlayer* getPlayer();
};
#endif