Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added tracks list, and continued work on ipod->pc saving

  • Loading branch information...
commit 84a03c172ba6e839597056840e24dba487de0338 1 parent dc9ef11
Adam Lamers authored
11 iphone.cpp
@@ -11,6 +11,7 @@
11 11 #include <windows.h>
12 12 #include <commctrl.h>
13 13 #include "songlist.h"
  14 +#include "statusbar.h"
14 15
15 16 #ifdef __cplusplus
16 17 extern "C"
@@ -23,25 +24,28 @@ extern void __declspec(dllimport) ConvertiTunesCDB(char *filePath, char *newFile
23 24
24 25 extern CSongList *SongList;
25 26 extern int DisplayType;
26   -extern HWND StatusBar;
  27 +extern CStatusBar *StatusBar;
27 28
28 29 iPhone *phone;
29 30 Itdb_iTunesDB *itunesdb;
30 31
31 32 void FetchITunesDB()
32 33 {
  34 + std::list <Itdb_Track*> *tracksList = new std::list<Itdb_Track*>;
33 35 iPhone_CopyFileFromDevice(phone, "/private/var/mobile/Media/iTunes_Control/iTunes/iTunesCDB", "iTunesCDB");
34 36 ConvertiTunesCDB("iTunesCDB", "iTunesDB");
35 37 itunesdb = itdb_parse_file("iTunesDB", NULL);
36 38 GList *tracks = itunesdb->tracks;
37 39 Itdb_Track *track;
38   - while(tracks->next != NULL)
  40 + while(tracks != NULL)
39 41 {
40 42 track = (Itdb_Track*)tracks->data;
  43 + tracksList->push_back(track);
41 44 //if(track->mediatype & ITDB_MEDIATYPE_AUDIO)
42 45 SongList->AddRow(track->title, track->artist, track->album, track->genre);
43 46 tracks = tracks->next;
44 47 }
  48 + SongList->SetTrackList(tracksList);
45 49 }
46 50
47 51 DWORD WINAPI ThreadCallback(void *param)
@@ -60,10 +64,11 @@ void NotifyCallback(AMDeviceNotificationCallbackInfo* callback)
60 64 {
61 65 CreateThread(NULL, 0, ThreadCallback, NULL, 0, NULL);
62 66 }
63   - SendMessage(StatusBar, SB_SETTEXT, 0, (LPARAM)"Connected");
  67 + StatusBar->SetSegmentText(0, "Connected");
64 68 break;
65 69 case Disconnected:
66 70 phone->connected = FALSE;
  71 + StatusBar->SetSegmentText(0, "Disconnected");
67 72 break;
68 73 default:
69 74 break;
3  main.cpp
@@ -118,7 +118,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
118 118 return TRUE;
119 119
120 120 case IDM_CONTEXTSAVESONG:
121   - MessageBox(NULL, "Context Save Song", "", MB_OK);
  121 + //MessageBox(NULL, "Context Save Song", "", MB_OK);
  122 + SongList->ContextSaveSong();
122 123 return TRUE;
123 124
124 125 case IDM_CONTEXTCHECKSELECTED:
3  projects/CodeBlocks/iPod_Recovery.cbp
@@ -59,9 +59,10 @@
59 59 <Unit filename="..\..\resource.rc">
60 60 <Option compilerVar="WINDRES" />
61 61 </Unit>
62   - <Unit filename="..\..\resource2.h" />
63 62 <Unit filename="..\..\songlist.cpp" />
64 63 <Unit filename="..\..\songlist.h" />
  64 + <Unit filename="..\..\statusbar.cpp" />
  65 + <Unit filename="..\..\statusbar.h" />
65 66 <Unit filename="..\..\tungsten.h" />
66 67 <Unit filename="..\..\util.cpp" />
67 68 <Unit filename="..\..\util.h" />
158 projects/CodeBlocks/iPod_Recovery.depend
@@ -321,19 +321,20 @@
321 321 1264489822 d:\projects\c++\ipod_recovery\util.h
322 322 <iostream>
323 323
324   -1266781449 source:d:\projects\git\c\ipod_recovery\iphone.cpp
  324 +1268665618 source:d:\projects\git\c\ipod_recovery\iphone.cpp
325 325 "tungsten.h"
326 326 "itdb.h"
327 327 "glib.h"
328 328 <windows.h>
329 329 <commctrl.h>
330 330 "songlist.h"
  331 + "statusbar.h"
331 332
332   -1264218442 d:\projects\git\c\ipod_recovery\tungsten.h
  333 +1264222042 d:\projects\git\c\ipod_recovery\tungsten.h
333 334 <windows.h>
334 335 "iTunesMobileDevice.h"
335 336
336   -1263845530 d:\projects\git\c\ipod_recovery\itunesmobiledevice.h
  337 +1263849130 d:\projects\git\c\ipod_recovery\itunesmobiledevice.h
337 338
338 339 1264485504 d:\projects\git\c\ipod_recovery\itdb.h
339 340 <config.h>
@@ -341,7 +342,7 @@
341 342 <time.h>
342 343 <glib.h>
343 344
344   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib.h
  345 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib.h
345 346 <glib/galloca.h>
346 347 <glib/garray.h>
347 348 <glib/gasyncqueue.h>
@@ -400,212 +401,212 @@
400 401 <glib/gutils.h>
401 402 <glib/gwin32.h>
402 403
403   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\galloca.h
  404 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\galloca.h
404 405 <glib/gtypes.h>
405 406 <alloca.h>
406 407 <malloc.h>
407 408
408   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gtypes.h
  409 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gtypes.h
409 410 <glibconfig.h>
410 411 <glib/gmacros.h>
411 412
412   -1260308296 c:\mingw\lib\glib-2.0\include\glibconfig.h
  413 +1260311896 c:\mingw\lib\glib-2.0\include\glibconfig.h
413 414 <glib/gmacros.h>
414 415 <limits.h>
415 416 <float.h>
416 417
417   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmacros.h
  418 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmacros.h
418 419 <stddef.h>
419 420
420   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\garray.h
  421 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\garray.h
421 422 <glib/gtypes.h>
422 423
423   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gasyncqueue.h
  424 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gasyncqueue.h
424 425 <glib/gthread.h>
425 426
426   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gthread.h
  427 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gthread.h
427 428 <glib/gerror.h>
428 429 <glib/gtypes.h>
429 430 <glib/gutils.h>
430 431 <glib/gatomic.h>
431 432
432   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gerror.h
  433 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gerror.h
433 434 <stdarg.h>
434 435 <glib/gquark.h>
435 436
436   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gquark.h
  437 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gquark.h
437 438 <glib/gtypes.h>
438 439
439   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gutils.h
  440 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gutils.h
440 441 <glib/gtypes.h>
441 442 <stdarg.h>
442 443
443   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gatomic.h
  444 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gatomic.h
444 445 <glib/gtypes.h>
445 446
446   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gbacktrace.h
  447 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gbacktrace.h
447 448 <glib/gtypes.h>
448 449 <signal.h>
449 450
450   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gbase64.h
  451 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gbase64.h
451 452 <glib/gtypes.h>
452 453
453   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gbookmarkfile.h
  454 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gbookmarkfile.h
454 455 <glib/gerror.h>
455 456 <time.h>
456 457
457   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gcache.h
  458 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gcache.h
458 459 <glib/glist.h>
459 460
460   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\glist.h
  461 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\glist.h
461 462 <glib/gmem.h>
462 463
463   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmem.h
  464 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmem.h
464 465 <glib/gslice.h>
465 466 <glib/gtypes.h>
466 467
467   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gslice.h
  468 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gslice.h
468 469 <glib/gtypes.h>
469 470
470   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gchecksum.h
  471 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gchecksum.h
471 472 <glib/gtypes.h>
472 473
473   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gcompletion.h
  474 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gcompletion.h
474 475 <glib/glist.h>
475 476
476   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gconvert.h
  477 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gconvert.h
477 478 <glib/gerror.h>
478 479
479   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gdataset.h
  480 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gdataset.h
480 481 <glib/gquark.h>
481 482
482   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gdate.h
  483 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gdate.h
483 484 <time.h>
484 485 <glib/gtypes.h>
485 486 <glib/gquark.h>
486 487
487   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gdir.h
  488 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gdir.h
488 489 <glib/gerror.h>
489 490
490   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gfileutils.h
  491 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gfileutils.h
491 492 <glib/gerror.h>
492 493
493   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\ghash.h
  494 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\ghash.h
494 495 <glib/gtypes.h>
495 496 <glib/glist.h>
496 497
497   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\ghook.h
  498 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\ghook.h
498 499 <glib/gmem.h>
499 500
500   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\ghostutils.h
  501 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\ghostutils.h
501 502 <glib/gtypes.h>
502 503
503   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\giochannel.h
  504 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\giochannel.h
504 505 <glib/gconvert.h>
505 506 <glib/gmain.h>
506 507 <glib/gstring.h>
507 508
508   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmain.h
  509 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmain.h
509 510 <glib/gpoll.h>
510 511 <glib/gslist.h>
511 512 <glib/gthread.h>
512 513
513   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gpoll.h
  514 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gpoll.h
514 515 <glib/gtypes.h>
515 516
516   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gslist.h
  517 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gslist.h
517 518 <glib/gmem.h>
518 519
519   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gstring.h
  520 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gstring.h
520 521 <glib/gtypes.h>
521 522 <glib/gunicode.h>
522 523 <glib/gutils.h>
523 524
524   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gunicode.h
  525 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gunicode.h
525 526 <glib/gerror.h>
526 527 <glib/gtypes.h>
527 528
528   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gkeyfile.h
  529 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gkeyfile.h
529 530 <glib/gerror.h>
530 531
531   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmappedfile.h
  532 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmappedfile.h
532 533 <glib/gerror.h>
533 534
534   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmarkup.h
  535 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmarkup.h
535 536 <stdarg.h>
536 537 <glib/gerror.h>
537 538 <glib/gslist.h>
538 539
539   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gmessages.h
  540 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gmessages.h
540 541 <stdarg.h>
541 542 <glib/gtypes.h>
542 543 <glib/gmacros.h>
543 544
544   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gnode.h
  545 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gnode.h
545 546 <glib/gmem.h>
546 547
547   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\goption.h
  548 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\goption.h
548 549 <glib/gerror.h>
549 550 <glib/gquark.h>
550 551
551   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gpattern.h
  552 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gpattern.h
552 553 <glib/gtypes.h>
553 554
554   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gprimes.h
  555 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gprimes.h
555 556 <glib/gtypes.h>
556 557
557   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gqsort.h
  558 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gqsort.h
558 559 <glib/gtypes.h>
559 560
560   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gqueue.h
  561 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gqueue.h
561 562 <glib/glist.h>
562 563
563   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\grand.h
  564 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\grand.h
564 565 <glib/gtypes.h>
565 566
566   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\grel.h
  567 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\grel.h
567 568 <glib/gtypes.h>
568 569
569   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gregex.h
  570 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gregex.h
570 571 <glib/gerror.h>
571 572 <glib/gstring.h>
572 573
573   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gscanner.h
  574 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gscanner.h
574 575 <glib/gdataset.h>
575 576 <glib/ghash.h>
576 577
577   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gsequence.h
  578 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gsequence.h
578 579 <glib/gtypes.h>
579 580
580   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gshell.h
  581 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gshell.h
581 582 <glib/gerror.h>
582 583
583   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gspawn.h
  584 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gspawn.h
584 585 <glib/gerror.h>
585 586
586   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gstrfuncs.h
  587 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gstrfuncs.h
587 588 <stdarg.h>
588 589 <glib/gtypes.h>
589 590
590   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gtestutils.h
  591 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gtestutils.h
591 592 <glib.h>
592 593
593   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gthreadpool.h
  594 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gthreadpool.h
594 595 <glib/gthread.h>
595 596
596   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gtimer.h
  597 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gtimer.h
597 598 <glib/gtypes.h>
598 599
599   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gtree.h
  600 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gtree.h
600 601 <glib/gnode.h>
601 602
602   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gurifuncs.h
  603 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gurifuncs.h
603 604 <glib.h>
604 605
605   -1260308358 c:\msys\1.0\local\include\glib-2.0\glib\gwin32.h
  606 +1260311958 c:\msys\1.0\local\include\glib-2.0\glib\gwin32.h
606 607 <glib/gtypes.h>
607 608
608   -1266852460 source:d:\projects\git\c\ipod_recovery\main.cpp
  609 +1268659271 source:d:\projects\git\c\ipod_recovery\main.cpp
609 610 <windows.h>
610 611 <iostream>
611 612 <commctrl.h>
@@ -618,35 +619,35 @@
618 619 "songlist.h"
619 620 "statusbar.h"
620 621
621   -1261607480 d:\projects\git\c\ipod_recovery\dialogs.h
  622 +1261611080 d:\projects\git\c\ipod_recovery\dialogs.h
622 623 <windows.h>
623 624 <shlobj.h>
624 625
625   -1266851359 d:\projects\git\c\ipod_recovery\resource.h
  626 +1266938281 d:\projects\git\c\ipod_recovery\resource.h
626 627
627   -1264489640 d:\projects\git\c\ipod_recovery\iphone.h
  628 +1264493240 d:\projects\git\c\ipod_recovery\iphone.h
628 629 <windows.h>
629 630 "tungsten.h"
630 631
631   -1266849921 d:\projects\git\c\ipod_recovery\util.h
  632 +1266853521 d:\projects\git\c\ipod_recovery\util.h
632 633 <iostream>
633 634 <windows.h>
634 635
635   -1266851359 source:d:\projects\git\c\ipod_recovery\resource.rc
  636 +1266891248 source:d:\projects\git\c\ipod_recovery\resource.rc
636 637 <windows.h>
637 638 <commctrl.h>
638 639 <richedit.h>
639 640 "resource.h"
640 641
641   -1266849912 source:d:\projects\git\c\ipod_recovery\util.cpp
  642 +1266853512 source:d:\projects\git\c\ipod_recovery\util.cpp
642 643 <windows.h>
643 644 <iostream>
644 645 <commctrl.h>
645 646
646   -1261607477 source:d:\projects\git\c\ipod_recovery\dialogs.cpp
  647 +1261611077 source:d:\projects\git\c\ipod_recovery\dialogs.cpp
647 648 "Dialogs.h"
648 649
649   -1249765746 d:\libs\c\libgpod\itdb.h
  650 +1249769346 d:\libs\c\libgpod\itdb.h
650 651 <config.h>
651 652 <sys/types.h>
652 653 <time.h>
@@ -656,29 +657,32 @@
656 657 <windows.h>
657 658 <commctrl.h>
658 659
659   -1266778647 source:d:\projects\git\c\ipod_recovery\listview.cpp
  660 +1266782247 source:d:\projects\git\c\ipod_recovery\listview.cpp
660 661 <windows.h>
661 662 <commctrl.h>
662 663
663   -1266778805 d:\projects\git\c\ipod_recovery\listview.h
  664 +1266782405 d:\projects\git\c\ipod_recovery\listview.h
664 665 <windows.h>
665 666
666 667 1266779519 d:\projects\git\c\ipod_recovery\resource2.h
667 668
668   -1266852421 source:d:\projects\git\c\ipod_recovery\songlist.cpp
  669 +1268665543 source:d:\projects\git\c\ipod_recovery\songlist.cpp
669 670 "songlist.h"
670 671
671   -1266852973 d:\projects\git\c\ipod_recovery\songlist.h
  672 +1268665502 d:\projects\git\c\ipod_recovery\songlist.h
672 673 <windows.h>
673 674 <commctrl.h>
674 675 <cstdio>
  676 + <vector>
  677 + <list>
  678 + <itdb.h>
675 679 "resource.h"
676 680 "listview.h"
677 681
678   -1266849571 source:d:\projects\git\c\ipod_recovery\statusbar.cpp
  682 +1266853171 source:d:\projects\git\c\ipod_recovery\statusbar.cpp
679 683 "statusbar.h"
680 684
681   -1266849292 d:\projects\git\c\ipod_recovery\statusbar.h
  685 +1266852892 d:\projects\git\c\ipod_recovery\statusbar.h
682 686 <windows.h>
683 687 <commctrl.h>
684 688 "resource.h"
29 projects/CodeBlocks/iPod_Recovery.layout
... ... @@ -1,25 +1,40 @@
1 1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 2 <CodeBlocks_layout_file>
3 3 <ActiveTarget name="Debug" />
  4 + <File name="..\..\Dialogs.cpp" open="0" top="0" tabpos="0">
  5 + <Cursor position="610" topLine="0" />
  6 + </File>
4 7 <File name="..\..\iTunesMobileDevice.h" open="0" top="0" tabpos="3">
5 8 <Cursor position="1979" topLine="51" />
6 9 </File>
7 10 <File name="..\..\iphone.cpp" open="0" top="0" tabpos="2">
8   - <Cursor position="1717" topLine="24" />
  11 + <Cursor position="930" topLine="11" />
9 12 </File>
10 13 <File name="..\..\main.cpp" open="0" top="0" tabpos="1">
11   - <Cursor position="6599" topLine="0" />
  14 + <Cursor position="5286" topLine="134" />
  15 + </File>
  16 + <File name="..\..\resource.h" open="0" top="0" tabpos="0">
  17 + <Cursor position="747" topLine="0" />
12 18 </File>
13 19 <File name="..\..\resource.rc" open="0" top="0" tabpos="0">
14   - <Cursor position="2295" topLine="0" />
  20 + <Cursor position="558" topLine="0" />
  21 + </File>
  22 + <File name="..\..\songlist.cpp" open="0" top="0" tabpos="2">
  23 + <Cursor position="4595" topLine="108" />
15 24 </File>
16   - <File name="..\..\songlist.cpp" open="0" top="0" tabpos="0">
17   - <Cursor position="1972" topLine="0" />
  25 + <File name="..\..\songlist.h" open="0" top="0" tabpos="3">
  26 + <Cursor position="564" topLine="0" />
18 27 </File>
19   - <File name="..\..\songlist.h" open="0" top="0" tabpos="0">
20   - <Cursor position="562" topLine="0" />
  28 + <File name="..\..\statusbar.cpp" open="0" top="0" tabpos="0">
  29 + <Cursor position="923" topLine="0" />
21 30 </File>
22 31 <File name="..\..\tungsten.h" open="0" top="0" tabpos="0">
23 32 <Cursor position="0" topLine="51" />
24 33 </File>
  34 + <File name="..\..\util.cpp" open="0" top="0" tabpos="0">
  35 + <Cursor position="962" topLine="0" />
  36 + </File>
  37 + <File name="..\..\util.h" open="0" top="0" tabpos="0">
  38 + <Cursor position="382" topLine="0" />
  39 + </File>
25 40 </CodeBlocks_layout_file>
4 resource.h
@@ -10,12 +10,12 @@
10 10 #define IDM_CONTEXTSAVESONG 789
11 11 #define IDM_CONTEXTUNCHECKSELECTED 790
12 12 #define IDM_CONTEXTCHECKSELECTED 791
13   -#define IDC_RADIO2 792
14 13 #define IDC_SONGLIST 1001
15 14 #define IDC_SEARCH 1002
16 15 #define IDC_RADIO1 1004
  16 +#define IDC_RADIO2 1005
  17 +#define IDC_RADIO3 1006
17 18 #define IDM_EXIT1 40000
18 19 #define IDM_SAVE_SELECTED_SONGS1 40001
19 20 #define IDM_SAVE_ALL_SONGS1 40002
20   -#define IDC_RADIO3 40003
21 21 #define IDC_STATUSBAR 40004
53 songlist.cpp
@@ -14,7 +14,7 @@ typedef struct
14 14 bool sortDir; /** < Sort direction (true = ascending, false = descending) */
15 15 } ListViewSortInfo;
16 16
17   -CSongList::CSongList(HWND Parent) : OnAddItem(NULL)
  17 +CSongList::CSongList(HWND Parent) : tracks(NULL), OnAddItem(NULL)
18 18 {
19 19 for(unsigned int i = 0; i < (sizeof(colSortDirs) / sizeof(bool)); i++)
20 20 {
@@ -68,7 +68,7 @@ bool CSongList::AddRow(char *name, char *artist, char *album, char *genre)
68 68 item.pszText = genre;
69 69 if(ListView_SetItem(handle, &item) == -1) return false;
70 70
71   - if(OnAddItem)OnAddItem();
  71 + if(OnAddItem) OnAddItem();
72 72 return true;
73 73 }
74 74
@@ -129,18 +129,15 @@ void CSongList::ShowContextMenu()
129 129 bool CSongList::Sort(int colIndex)
130 130 {
131 131 colSortDirs[colIndex] = !colSortDirs[colIndex]; //Reverse sort direction
132   - char text[32];
133   - sprintf(text, "%d", colSortDirs[colIndex]);
134   - MessageBox(NULL, text, "", MB_OK);
135 132 ListViewSortInfo sortinfo;
136 133 sortinfo.handle = handle;
137 134 sortinfo.colIndex = colIndex;
138 135 sortinfo.sortDir = colSortDirs[colIndex];
139   - ListView_SortItemsEx(handle, &CSongList::CompareText, &sortinfo);
  136 + ListView_SortItemsEx(handle, &CSongList::SortCallback, &sortinfo);
140 137 return false;
141 138 }
142 139
143   -int CALLBACK CSongList::CompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
  140 +int CALLBACK CSongList::SortCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
144 141 {
145 142 static char buf1[128], buf2[128];
146 143 ListViewSortInfo *sortinfo = (ListViewSortInfo*)lParamSort;
@@ -157,4 +154,44 @@ HWND CSongList::GetHandle()
157 154 return handle;
158 155 }
159 156
160   -CSongList::~CSongList(){}
  157 +void CSongList::ContextSaveSong()
  158 +{
  159 + std::vector<int> selectedItems = GetSelected();
  160 + if(tracks)
  161 + {
  162 + MessageBox(NULL, ((Itdb_Track*)(tracks->front()))->title, ((Itdb_Track*)(tracks->front()))->ipod_path, MB_OK);
  163 + }
  164 +}
  165 +
  166 +std::vector<int> CSongList::GetSelected()
  167 +{
  168 + std::vector<int> ret;
  169 + int ItemCount = ListView_GetItemCount(handle);
  170 + int i;
  171 + for(i = 0; i < ItemCount; i++)
  172 + {
  173 + LVITEM item;
  174 + memset(&item, 0, sizeof(item));
  175 + item.iItem = i;
  176 + item.mask = LVIF_STATE;
  177 + item.stateMask = LVIS_SELECTED;
  178 + if(ListView_GetItem(handle, &item))
  179 + {
  180 + if(item.state == LVIS_SELECTED)
  181 + {
  182 + ret.push_back(i);
  183 + }
  184 + }
  185 + }
  186 + return ret;
  187 +}
  188 +
  189 +void CSongList::SetTrackList(std::list<Itdb_Track*> *list)
  190 +{
  191 + tracks = list;
  192 +}
  193 +
  194 +CSongList::~CSongList()
  195 +{
  196 + if(tracks) delete tracks;
  197 +}
10 songlist.h
@@ -14,6 +14,9 @@
14 14 #include <windows.h>
15 15 #include <commctrl.h>
16 16 #include <cstdio>
  17 +#include <vector>
  18 +#include <list>
  19 +#include <itdb.h>
17 20 #include "resource.h"
18 21 #include "listview.h"
19 22
@@ -22,8 +25,9 @@ class CSongList
22 25 HWND handle;
23 26 HWND parent;
24 27 HMENU ContextMenu;
  28 + std::list<Itdb_Track*> *tracks;
25 29 bool colSortDirs[5];
26   - static int CompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  30 + static int SortCallback(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
27 31
28 32 public:
29 33 void(*OnAddItem)();
@@ -34,6 +38,10 @@ class CSongList
34 38 void Scale();
35 39 void CheckSelectedItems(bool check);
36 40 void ShowContextMenu();
  41 + void ContextSaveSong();
  42 +
  43 + std::vector<int> GetSelected();
  44 + void SetTrackList(std::list<Itdb_Track*> *list);
37 45 bool Sort(int columnIndex);
38 46 HWND GetHandle();
39 47 ~CSongList();

0 comments on commit 84a03c1

Please sign in to comment.
Something went wrong with that request. Please try again.