9 Commits
6 changed files with 42 additions and 15 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>PAiPlayer - A school project that helps me learn C++</description>
<description>ClickPlay - a simple C++ music player</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -22,7 +22,7 @@
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{c734fda7-262e-4202-8f4e-5e3031cb9935}</ProjectGuid>
<RootNamespace>EasyAudioPlayer</RootNamespace>
<RootNamespace>ClickPlay</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>ClickPlay</ProjectName>
</PropertyGroup>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+40 -13
View File
@@ -109,7 +109,7 @@ int WINAPI WinMain(HINSTANCE currentInst, HINSTANCE previousInst, LPSTR lpCmdLin
//INITIALIZE MESSAGE LOOP
while (GetMessage(&msg, NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, shortcuts, &msg)) {
if (!TranslateAccelerator(mainWindow, shortcuts, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -180,8 +180,8 @@ int LoadSelection(int index) {
LPCWSTR fullCommand = fullCommandS.c_str();
if (mciSendString(fullCommand, NULL, 0, mainWindow) != 0) {
MessageBox(mainWindow, L"Nieznany b³¹d uniemo¿liwia odtworzenie tego pliku. SprawdŸ czy plik nie jest uszkodzony.", L"B³¹d wczytywania", MB_ICONERROR);
UnloadSelection();
MessageBox(mainWindow, L"Nieznany b³¹d uniemo¿liwia odtworzenie tego pliku. SprawdŸ czy plik nie jest uszkodzony.", L"B³¹d wczytywania", MB_ICONERROR);
return -4;
}
selected = index;
@@ -291,16 +291,23 @@ int FolderBrowseDialog(HWND window) {
}
//SEARCH DIRECTORY
void SearchDir(wstring phrase) {
/*ERROR CODES
* -1 - no files found
* -2 - LoadDir error
* -3 - empty input
*/
int SearchDir(wstring phrase) {
//PERFORM CHECKING
if (path.empty()) {
return;
return -2;
}
//RELOAD DIR
LoadDir(path);
if (LoadDir(path) != 0) {
return -2;
}
//PREPARE
if (phrase.empty()) {
return;
return -3;
}
vector<WIN32_FIND_DATA> results;
//GET FILES
@@ -311,12 +318,13 @@ void SearchDir(wstring phrase) {
}
if (results.empty()) {
MessageBox(mainWindow, L"Nie znaleziono plików zawieraj¹cych wpisan¹ frazê.", L"Brak plików", MB_ICONEXCLAMATION);
return;
return -1;
}
std::sort(results.begin(), results.end(), alphabeticSort);
files = results;
//ADD FILTERED CONTENT
GenerateList(files);
return 0;
}
//GET SEARCH PHRASE FROM searchBox
@@ -365,11 +373,18 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
}
}
else {
SendMessage(mainWindow, STATE_CHANGE, 0, 0);
}
}
break;
case IDC_SEARCHBTN:
SearchDir(GetSearchPhrase());
SendMessage(mainWindow, STATE_CHANGE, 0, 0);
if (SearchDir(GetSearchPhrase()) == -2) {
SendMessage(mainWindow, STATE_CHANGE, -1, 0);
}
else {
SendMessage(mainWindow, STATE_CHANGE, 0, 0);
}
break;
case IDC_PLAYBTN:
switch (currentState) {
@@ -377,6 +392,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
if (LoadSelection(GetIndex()) == 0) {
SendMessage(mainWindow, STATE_CHANGE, 1, NULL);
}
else {
SendMessage(mainWindow, STATE_CHANGE, 0, 0);
}
break;
case 1:
SendMessage(mainWindow, STATE_CHANGE, 2, NULL);
@@ -402,7 +420,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SendMessage(mainWindow, STATE_CHANGE, -1, 0);
}
if (SendMessage(searchBox, WM_GETTEXTLENGTH, 0, 0) > 0) {
SearchDir(GetSearchPhrase());
if (SearchDir(GetSearchPhrase()) == -2) {
SendMessage(mainWindow, STATE_CHANGE, -1, 0);
}
}
break;
case ID_OPCJE_ONCLICK:
@@ -438,6 +458,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
}
if (!path.empty() && !files.empty()) {
GenerateList(files);
if (selected != -1) {
SendMessage(filesListCtrl, LB_SETCURSEL, selected, 0);
}
}
break;
case ID_PLIK_CLOSEDIR:
@@ -458,9 +481,13 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
srand(time(NULL));
//LOAD AND PLAY
randIndex = rand() % files.size();
LoadSelection(randIndex);
SendMessage(filesListCtrl, LB_SETCURSEL, randIndex, 0);
SendMessage(mainWindow, STATE_CHANGE, 1, 0);
if (LoadSelection(randIndex) == 0) {
SendMessage(filesListCtrl, LB_SETCURSEL, randIndex, 0);
SendMessage(mainWindow, STATE_CHANGE, 1, 0);
}
else {
SendMessage(mainWindow, STATE_CHANGE, 0, 0);
}
break;
case ID_OPCJE_AUTOPLAY:
if (isAutoPlayEnabled) {