[haiku-commits] r34120 - haiku/trunk/src/apps/mediaplayer

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 19 Nov 2009 00:25:02 +0100 (CET)

Author: stippi
Date: 2009-11-19 00:25:02 +0100 (Thu, 19 Nov 2009)
New Revision: 34120
Changeset: http://dev.haiku-os.org/changeset/34120/haiku

Modified:
   haiku/trunk/src/apps/mediaplayer/MainApp.cpp
   haiku/trunk/src/apps/mediaplayer/MainApp.h
   haiku/trunk/src/apps/mediaplayer/MainWin.cpp
Log:
* Fixed some regressions I introduced. The video is now correctly layouted
  again. Bute this commit seems to make the old bug that some parts of the GUI
  are black much more likely. Will look into it tomorrow.
* The calculations to move the window wholy into the screen frame were buggy.


Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainApp.cpp        2009-11-18 22:44:20 UTC 
(rev 34119)
+++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp        2009-11-18 23:25:02 UTC 
(rev 34120)
@@ -64,6 +64,32 @@
 {
        mpSettings settings = Settings::CurrentSettings();
        fLastFilePanelFolder = settings.filePanelFolder;
+
+       // Now tell the application roster, that we're interested
+       // in getting notifications of apps being launched or quit.
+       // In this way we are going to detect a media_server restart.
+       be_roster->StartWatching(BMessenger(this, this),
+               B_REQUEST_LAUNCHED | B_REQUEST_QUIT);
+       // we will keep track of the status of media_server
+       // and media_addon_server
+       fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
+       fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
+
+       if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
+               BAlert* alert = new BAlert("start_media_server",
+                       "It appears the Media Server is not running.\n"
+                       "Would you like to start it ?", "Quit", "Start Media 
Server", NULL,
+                       B_WIDTH_AS_USUAL, B_WARNING_ALERT);
+               if (alert->Go() == 0) {
+                       PostMessage(B_QUIT_REQUESTED);
+                       return;
+               }
+
+               launch_media_server();
+
+               fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
+               fMediaAddOnServerRunning = 
be_roster->IsRunning(kMediaServerAddOnSig);
+       }
 }
 
 
@@ -116,32 +142,7 @@
 void
 MainApp::ReadyToRun()
 {
-       // Now tell the application roster, that we're interested
-       // in getting notifications of apps being launched or quit.
-       // In this way we are going to detect a media_server restart.
-       be_roster->StartWatching(BMessenger(this, this),
-               B_REQUEST_LAUNCHED | B_REQUEST_QUIT);
-       // we will keep track of the status of media_server
-       // and media_addon_server
-       fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
-       fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
-
-       if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
-               BAlert* alert = new BAlert("start_media_server",
-                       "It appears the Media Server is not running.\n"
-                       "Would you like to start it ?", "Quit", "Start Media 
Server", NULL,
-                       B_WIDTH_AS_USUAL, B_WARNING_ALERT);
-               if (alert->Go() == 0) {
-                       PostMessage(B_QUIT_REQUESTED);
-                       return;
-               }
-
-               launch_media_server();
-
-               fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
-               fMediaAddOnServerRunning = 
be_roster->IsRunning(kMediaServerAddOnSig);
-       }
-
+printf("MainApp::ReadyToRun()\n");
        // make sure we have at least one window open
        if (fPlayerCount == 0) {
                MainWin* window = NewWindow();
@@ -150,10 +151,11 @@
                        return;
                }
                BMessage lastPlaylistArchive;
-               if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK)
-                       window->OpenPlaylist(&lastPlaylistArchive);
-
-               window->Show();
+               if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK) {
+                       lastPlaylistArchive.what = M_OPEN_PREVIOUS_PLAYLIST;
+                       window->PostMessage(&lastPlaylistArchive);
+               } else
+                       window->Show();
        }
 
        // setup the settings window now, we need to have it

Modified: haiku/trunk/src/apps/mediaplayer/MainApp.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainApp.h  2009-11-18 22:44:20 UTC (rev 
34119)
+++ haiku/trunk/src/apps/mediaplayer/MainApp.h  2009-11-18 23:25:02 UTC (rev 
34120)
@@ -46,7 +46,9 @@
        M_SAVE_PANEL_RESULT                     = 'sprs',
 
        M_MEDIA_SERVER_STARTED          = 'msst',
-       M_MEDIA_SERVER_QUIT                     = 'msqt'
+       M_MEDIA_SERVER_QUIT                     = 'msqt',
+
+       M_OPEN_PREVIOUS_PLAYLIST        = 'oppp'
 };
 
 

Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2009-11-18 22:44:20 UTC 
(rev 34119)
+++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp        2009-11-18 23:25:02 UTC 
(rev 34120)
@@ -218,6 +218,9 @@
        AddShortcut('y', B_COMMAND_KEY, new BMessage(B_UNDO));
        AddShortcut('z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
        AddShortcut('y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
+
+       Hide();
+       Show();
 }
 
 
@@ -384,6 +387,9 @@
                                _RefsReceived(msg);
                        }
                        break;
+               case M_OPEN_PREVIOUS_PLAYLIST:
+                       OpenPlaylist(msg);
+                       break;
 
                case B_UNDO:
                case B_REDO:
@@ -765,6 +771,9 @@
        playlistLocker.Unlock();
 
        playlistArchive->FindInt64("position", (int64*)&fInitialSeekPosition);
+
+       if (IsHidden())
+               Show();
 }
 
 
@@ -1305,9 +1314,9 @@
                                else if (frame.right > screenFrame.right)
                                        offsetX = (int)(screenFrame.right - 
frame.right);
                                if (frame.top < screenFrame.top)
-                                       offsetX = (int)(screenFrame.top - 
frame.top);
+                                       offsetY = (int)(screenFrame.top - 
frame.top);
                                else if (frame.bottom > screenFrame.bottom)
-                                       offsetX = (int)(screenFrame.bottom - 
frame.bottom);
+                                       offsetY = (int)(screenFrame.bottom - 
frame.bottom);
                                MoveBy(offsetX, offsetY);
                        }
                }


Other related posts: