Skip to content

Commit

Permalink
Added the sample music player to the editors code
Browse files Browse the repository at this point in the history
Added the  sample music player to the editors code,  now the users can
listen to music while editing with out any other program opened.
  • Loading branch information
Lobomon committed Jan 13, 2014
1 parent b39ce37 commit 884da67
Show file tree
Hide file tree
Showing 7 changed files with 717 additions and 4 deletions.
12 changes: 8 additions & 4 deletions EasyRPG-Editor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#
#-------------------------------------------------

QT += core gui
QT += core gui multimedia winextras

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia winextras

TARGET = EasyRPG-Editor
TEMPLATE = app
Expand All @@ -23,7 +23,9 @@ SOURCES += src/mainwindow.cpp \
src/gamecharacter.cpp \
src/dialogopenproject.cpp \
src/EasyRPGCore.cpp \
src/gamemap.cpp
src/gamemap.cpp \
src/musicplayer.cpp \
src/volumebutton.cpp

HEADERS += src/mainwindow.h \
src/dialogresourcemanager.h \
Expand All @@ -37,7 +39,9 @@ HEADERS += src/mainwindow.h \
src/tools/picojson.h \
src/dialogopenproject.h \
src/EasyRPGCore.h \
src/gamemap.h
src/gamemap.h \
src/musicplayer.h \
src/volumebutton.h

FORMS += src/mainwindow.ui \
src/dialogresourcemanager.ui \
Expand Down
47 changes: 47 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,41 @@
#include <QDir>
#include "EasyRPGCore.h"

#include <QApplication>
#include <QFileInfo>
#include <QSettings>
#include <QIcon>
#include <QDir>

#include "musicplayer.h"



static void associateFileTypes(const QStringList &fileTypes)
{
QString displayName = QGuiApplication::applicationDisplayName();
QString filePath = QCoreApplication::applicationFilePath();
QString fileName = QFileInfo(filePath).fileName();

QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\" + fileName, QSettings::NativeFormat);
settings.setValue("FriendlyAppName", displayName);

settings.beginGroup("SupportedTypes");
foreach (const QString& fileType, fileTypes)
settings.setValue(fileType, QString());
settings.endGroup();

settings.beginGroup("shell");
settings.beginGroup("open");
settings.setValue("FriendlyAppName", displayName);
settings.beginGroup("Command");
settings.setValue(".", QChar('"') + QDir::toNativeSeparators(filePath) + QString("\" \"%1\""));
}
//! [0]




MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
Expand Down Expand Up @@ -251,6 +286,18 @@ void MainWindow::on_action_Open_Project_triggered()
m_defDir = dlg.getDefDir();
}

void MainWindow::on_actionJukebox_triggered()
{

associateFileTypes(QStringList(".mp3,.midi"));
static MusicPlayer player;
player.playFile("C:\\Users\\Public\\Music\\Sample Music\\Kalimba.mp3");
player.resize(300, 60);
player.show();


}

void MainWindow::on_actionChipset_triggered()
{
if (!EasyRPGCore::debugChipset())
Expand Down
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ private slots:
void on_action_Close_Project_triggered();

void on_action_Open_Project_triggered();
void on_actionJukebox_triggered();


void on_actionChipset_triggered();

Expand Down

0 comments on commit 884da67

Please sign in to comment.