Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Tutorial added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flone-dnb committed Nov 2, 2019
1 parent 48dc6d9 commit ae7a9f2
Show file tree
Hide file tree
Showing 22 changed files with 947 additions and 15 deletions.
4 changes: 1 addition & 3 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
- Add a little (non-modal window) "Tutorial" (with pictures) on first startup: tell user to drag'n'drop, Ctrl + F, RMB to create repeat section, RMB on tracks, FX.
And if user not finished th tutorial then show it again on next start. Or, if user checked "don't show again" don't show it again.
- Speed up the process of adding the tracks.
- Speed up the process of adding the tracks.
- When adding music, we need to add it in the same order in which it was in the folder.
- Seems like with 'speed (by pitch)' effect we also need to increase mid-high frequencies on like 3-4 dB and maybe do the same thing with the low and the mid-low.
- After the tracklist was cleared volume returns to the default value of 75%, we don't want that, don't change master volume when tracklist is clear and allow to change it if tracklist is clear.
Expand Down
6 changes: 6 additions & 0 deletions ide/BloodyPlayer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ SOURCES += \
../src/View/SearchWindow/searchwindow.cpp \
../src/View/TrackList/tracklist.cpp \
../src/View/TrackWidget/trackwidget.cpp \
../src/View/TutorialWindows/TutorialWindow/tutorialwindow.cpp \
../src/View/TutorialWindows/WelcomeWindow/welcomewindow.cpp \
../src/View/VSTWindow/vstwindow.cpp \
../src/View/WaitWindow/waitwindow.cpp \
../src/main.cpp \
Expand All @@ -51,6 +53,8 @@ HEADERS += \
../src/View/SearchWindow/searchwindow.h \
../src/View/TrackList/tracklist.h \
../src/View/TrackWidget/trackwidget.h \
../src/View/TutorialWindows/TutorialWindow/tutorialwindow.h \
../src/View/TutorialWindows/WelcomeWindow/welcomewindow.h \
../src/View/VSTWindow/vstwindow.h \
../src/View/WaitWindow/waitwindow.h \
../src/globalparams.h
Expand All @@ -62,6 +66,8 @@ FORMS += \
../src/View/SearchWindow/searchwindow.ui \
../src/View/TrackList/tracklist.ui \
../src/View/TrackWidget/trackwidget.ui \
../src/View/TutorialWindows/TutorialWindow/tutorialwindow.ui \
../src/View/TutorialWindows/WelcomeWindow/welcomewindow.ui \
../src/View/VSTWindow/vstwindow.ui \
../src/View/WaitWindow/waitwindow.ui

Expand Down
2 changes: 1 addition & 1 deletion ide/BloodyPlayer.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.1, 2019-11-02T18:43:46. -->
<!-- Written by QtCreator 4.10.1, 2019-11-02T21:32:04. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
Binary file added res/context_slide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/dragndrop_slide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/find_slide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions res/qt_rec_file.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
<file>fx_hover.png</file>
<file>GitHub-Mark-Light-Hover.png</file>
<file>GitHub-Mark-Light.png</file>
<file>dragndrop_slide.png</file>
<file>find_slide.png</file>
<file>repeat_slide.png</file>
<file>context_slide.png</file>
</qresource>
</RCC>
Binary file added res/repeat_slide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/Controller/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Controller::Controller(MainWindow* pMainWindow)
bRandomTrack = false;
}

void Controller::doNotShowTutorialAgain()
{
pAudioService->doNotShowTutorialAgain();
}

void Controller::tutorialEnd()
{
pAudioService->tutorialEnd();
}




Expand Down
4 changes: 4 additions & 0 deletions src/Controller/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class Controller
Controller(MainWindow* pMainWindow);


// Tutorial

void doNotShowTutorialAgain();
void tutorialEnd ();


// Main buttons
Expand Down
136 changes: 131 additions & 5 deletions src/Model/AudioService/audioservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#include "../src/Model/Track/track.h"
#include "../src/globalparams.h"

// Other
#include <windows.h>
#include <shlobj.h>


AudioService::AudioService(MainWindow* pMainWindow)
Expand Down Expand Up @@ -53,13 +55,80 @@ AudioService::AudioService(MainWindow* pMainWindow)
fCurrentSpeedByTime = 1.0f;


FMODinit();
if ( FMODinit() == false )
{
showTutorial();
}
}

void AudioService::doNotShowTutorialAgain()
{
TCHAR my_documents[MAX_PATH];
HRESULT result = SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);

if (result == S_OK)
{
std::wstring adressToSettings = std::wstring(my_documents);
std::wstring adressToOldSettings = std::wstring(my_documents);
adressToSettings += L"\\BloodyPlayerSettings.data";
adressToOldSettings += L"\\BloodyPlayerSettings_.data";

_wrename(adressToSettings.c_str(), adressToOldSettings.c_str());

std::ofstream settingsFileNew (adressToSettings, std::ios::binary);

void AudioService::FMODinit()
char cNeverShowTutorialAgain = 1;
char cTutorialFinished = 0;

settingsFileNew.write ( &cNeverShowTutorialAgain, sizeof(cNeverShowTutorialAgain) );
settingsFileNew.write ( &cTutorialFinished, sizeof(cTutorialFinished) );

settingsFileNew.close();

_wremove(adressToOldSettings.c_str());
}
else
{
pMainWindow->showMessageBox(true, "AudioService::doNotShowTutorialAgain::SHGetFolderPathW() failed.");
}
}

void AudioService::tutorialEnd()
{
TCHAR my_documents[MAX_PATH];
HRESULT result = SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);

if (result == S_OK)
{
std::wstring adressToSettings = std::wstring(my_documents);
std::wstring adressToOldSettings = std::wstring(my_documents);
adressToSettings += L"\\BloodyPlayerSettings.data";
adressToOldSettings += L"\\BloodyPlayerSettings_.data";

_wrename(adressToSettings.c_str(), adressToOldSettings.c_str());

std::ofstream settingsFileNew (adressToSettings, std::ios::binary);

char cNeverShowTutorialAgain = 0;
char cTutorialFinished = 1;

settingsFileNew.write ( &cNeverShowTutorialAgain, sizeof(cNeverShowTutorialAgain) );
settingsFileNew.write ( &cTutorialFinished, sizeof(cTutorialFinished) );

settingsFileNew.close();

_wremove(adressToOldSettings.c_str());
}
else
{
pMainWindow->showMessageBox(true, "AudioService::doNotShowTutorialAgain::SHGetFolderPathW() failed.");
}
}




bool AudioService::FMODinit()
{
// FMOD initialization
FMOD_RESULT result;
Expand All @@ -71,7 +140,7 @@ void AudioService::FMODinit()
// Look main.cpp (isSystemReady() function)
// app will be closed.
pMainWindow->markAnError();
return;
return true;
}

result = pSystem->init(MAX_CHANNELS, FMOD_INIT_NORMAL, nullptr);
Expand All @@ -82,7 +151,7 @@ void AudioService::FMODinit()
// Look main.cpp (isSystemReady() function)
// app will be closed.
pMainWindow->markAnError();
return;
return true;
}

result = pSystem->update();
Expand All @@ -93,7 +162,7 @@ void AudioService::FMODinit()
// Look main.cpp (isSystemReady() function)
// app will be closed.
pMainWindow->markAnError();
return;
return true;
}


Expand Down Expand Up @@ -163,6 +232,63 @@ void AudioService::FMODinit()
}

pMaster->setPan(0.0f);


return false;
}

void AudioService::showTutorial()
{
TCHAR my_documents[MAX_PATH];
HRESULT result = SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);

if (result == S_OK)
{
std::wstring adressToSettings = std::wstring(my_documents);
adressToSettings += L"\\BloodyPlayerSettings.data";

std::ifstream settingsFile (adressToSettings, std::ios::binary);

if ( settingsFile.is_open() )
{
// Check if tutorial finished

char cNeverShowTutorialAgain = 0;
char cTutorialFinished = 0;

settingsFile.read ( &cNeverShowTutorialAgain, sizeof(cNeverShowTutorialAgain) );
settingsFile.read ( &cTutorialFinished, sizeof(cTutorialFinished) );

settingsFile.close();



if (cNeverShowTutorialAgain == 0 && cTutorialFinished == 0)
{
pMainWindow->showTutorialWindow();
}
}
else
{
// First time opened app

std::ofstream settingsFileNew (adressToSettings, std::ios::binary);

char cNeverShowTutorialAgain = 0;
char cTutorialFinished = 0;

settingsFileNew.write ( &cNeverShowTutorialAgain, sizeof(cNeverShowTutorialAgain) );
settingsFileNew.write ( &cTutorialFinished, sizeof(cTutorialFinished) );

settingsFileNew.close();

pMainWindow->showTutorialWindow();
}
}
else
{
pMainWindow->showMessageBox(true, "AudioService::showTutorial::SHGetFolderPathW() failed.");
}
}

void AudioService::addTrack(const wchar_t *pFilePath)
Expand Down
7 changes: 6 additions & 1 deletion src/Model/AudioService/audioservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class AudioService
AudioService(MainWindow* pMainWindow);


// Tutorial

void doNotShowTutorialAgain();
void tutorialEnd ();


// Main functions
Expand Down Expand Up @@ -107,7 +110,9 @@ class AudioService

// First and most important function of our system.
// If this function fails, the application will terminate.
void FMODinit ();
bool FMODinit ();

void showTutorial ();

// Functions for execution in a separete thread
void threadAddTracks (std::vector<wchar_t*>* paths, size_t iStart, size_t iStop, bool* done, int* allCount, int all);
Expand Down
22 changes: 22 additions & 0 deletions src/View/MainWindow/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "../src/View/VSTWindow/vstwindow.h"
#include "../src/View/AboutWindow/aboutwindow.h"
#include "../src/View/SearchWindow/searchwindow.h"
#include "../src/View/TutorialWindows/WelcomeWindow/welcomewindow.h"
#include "../src/globalparams.h"


Expand Down Expand Up @@ -346,6 +347,17 @@ bool MainWindow::isSystemReady()
return bSystemReady;
}

void MainWindow::showTutorialWindow()
{
WelcomeWindow* pWelcomeWindow = new WelcomeWindow(this);
pWelcomeWindow->setWindowModality(Qt::WindowModal);

connect(pWelcomeWindow, &WelcomeWindow::signalDoNotShowTutorialAgain, this, &MainWindow::slotDoNotShowTutorialAgain);
connect(pWelcomeWindow, &WelcomeWindow::signalEndTutorial, this, &MainWindow::slotTutorialEnd);

pWelcomeWindow->show();
}


void MainWindow::on_actionOpen_triggered()
{
Expand Down Expand Up @@ -450,6 +462,16 @@ void MainWindow::slotSearchTextSet(QString keyword)
pController->searchTextSet (keyword.toStdWString());
}

void MainWindow::slotDoNotShowTutorialAgain()
{
pController->doNotShowTutorialAgain();
}

void MainWindow::slotTutorialEnd()
{
pController->tutorialEnd();
}

void MainWindow::keyPressEvent(QKeyEvent *ev)
{
if (ev->key() == Qt::Key_Delete)
Expand Down
7 changes: 7 additions & 0 deletions src/View/MainWindow/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class MainWindow : public QMainWindow

void markAnError();
bool isSystemReady();
void showTutorialWindow();


// VST
Expand Down Expand Up @@ -177,6 +178,12 @@ public slots:
void slotSearchTextSet (QString keyword);


// Tutorial

void slotDoNotShowTutorialAgain();
void slotTutorialEnd();


protected:

void keyPressEvent (QKeyEvent* ev);
Expand Down
Loading

0 comments on commit ae7a9f2

Please sign in to comment.