Ticket #7275: mediaplayer-about-update.patch

File mediaplayer-about-update.patch, 4.6 KB (added by Karvjorm, 13 years ago)

About box update for the MediaPlayer Application

  • src/apps/mediaplayer/MainWin.cpp

     
    3434#include <Debug.h>
    3535#include <fs_attr.h>
    3636#include <Language.h>
    37 #include <Locale.h>
    3837#include <Menu.h>
    3938#include <MenuBar.h>
    4039#include <MenuItem.h>
     
    6564#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
    6665#define MIN_WIDTH 250
    6766
     67extern const char* PLAYER_NAME;
    6868
    6969int MainWin::sNoVideoWidth = MIN_WIDTH;
    7070
     
    172172
    173173MainWin::MainWin(bool isFirstWindow, BMessage* message)
    174174    :
    175     BWindow(BRect(100, 100, 400, 300), NAME, B_TITLED_WINDOW,
     175    BWindow(BRect(100, 100, 400, 300), PLAYER_NAME, B_TITLED_WINDOW,
    176176        B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */),
    177177    fCreationTime(system_time()),
    178178    fInfoWin(NULL),
     
    10821082    if (ret != B_OK) {
    10831083        fprintf(stderr, "MainWin::OpenPlaylistItem() - Failed to send message "
    10841084            "to Controller.\n");
    1085         (new BAlert(B_TRANSLATE("error"),
    1086             B_TRANSLATE(NAME" encountered an internal error. "
    1087             "The file could not be opened."), B_TRANSLATE("OK")))->Go();
     1085        BString errorText(PLAYER_NAME);
     1086        errorText << B_TRANSLATE(" encountered an internal error. "
     1087            "The file could not be opened.");
     1088        errorText << "\n";
     1089        (new BAlert(B_TRANSLATE("Error"), errorText.String(),
     1090            B_TRANSLATE("OK")))->Go();
    10881091        _PlaylistItemOpened(item, ret);
    10891092    } else {
    10901093        BString string;
     
    13461349        fHasFile = false;
    13471350        fHasVideo = false;
    13481351        fHasAudio = false;
    1349         SetTitle(NAME);
     1352        SetTitle(PLAYER_NAME);
    13501353    } else {
    13511354        fHasFile = true;
    13521355        fHasVideo = fController->VideoTrackCount() != 0;
     
    14181421void
    14191422MainWin::_CreateMenu()
    14201423{
    1421     fFileMenu = new BMenu(NAME);
     1424    fFileMenu = new BMenu(PLAYER_NAME);
    14221425    fPlaylistMenu = new BMenu(B_TRANSLATE("Playlist"B_UTF8_ELLIPSIS));
    14231426    fAudioMenu = new BMenu(B_TRANSLATE("Audio"));
    14241427    fVideoMenu = new BMenu(B_TRANSLATE("Video"));
     
    14711474
    14721475    fFileMenu->AddSeparatorItem();
    14731476
    1474     item = new BMenuItem(B_TRANSLATE("About " NAME B_UTF8_ELLIPSIS),
     1477    BString aboutText(B_TRANSLATE("About %1%2"));
     1478    aboutText.ReplaceFirst("%1", PLAYER_NAME);
     1479    aboutText.ReplaceFirst("%2", B_UTF8_ELLIPSIS);
     1480    item = new BMenuItem(aboutText.String(),
    14751481        new BMessage(B_ABOUT_REQUESTED));
    14761482    fFileMenu->AddItem(item);
    14771483    item->SetTarget(be_app);
  • src/apps/mediaplayer/MainApp.cpp

     
    2727#include <Catalog.h>
    2828#include <Entry.h>
    2929#include <FilePanel.h>
    30 #include <Locale.h>
    3130#include <MediaDefs.h>
    3231#include <MediaRoster.h>
    3332#include <MimeType.h>
    3433#include <Path.h>
    3534#include <Resources.h>
    3635#include <Roster.h>
     36#include <TextView.h>
    3737
    3838#include <stdio.h>
    3939#include <stdlib.h>
     
    4848#undef B_TRANSLATE_CONTEXT
    4949#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
    5050
    51 
    5251static const char* kCurrentPlaylistFilename =
    5352    B_TRANSLATE("MediaPlayer Current Playlist");
    5453
    5554const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
     55const char* PLAYER_NAME = B_TRANSLATE("MediaPlayer");
    5656
    5757MainApp* gMainApp;
    5858
     
    411411void
    412412MainApp::AboutRequested()
    413413{
    414     BAlert* alert = new BAlert("about", B_TRANSLATE(
    415         NAME"\n\nWritten by Marcus Overhagen, "
    416         "Stephan Aßmus and Frederik Modéen"),
    417         B_TRANSLATE("Thanks"));
     414    BString aboutText(PLAYER_NAME);
     415    aboutText << "\n\n";
     416    aboutText << B_TRANSLATE("Written by Marcus Overhagen, "
     417        "Stephan Aßmus and Frederik Modéen\n");
     418    BAlert* alert = new BAlert(B_TRANSLATE("About"),
     419        aboutText.String(), B_TRANSLATE("Thanks"));
     420    BTextView* view = alert->TextView();
     421    BFont font;
     422
     423    view->SetStylable(true);
     424
     425    view->GetFont(&font);
     426    font.SetSize(18);
     427    font.SetFace(B_BOLD_FACE);
     428    view->SetFontAndColor(0, strlen(PLAYER_NAME), &font);
    418429    alert->SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
    419430        // Make sure it is on top of any player windows that may have the
    420431        // floating all window feel.
  • src/apps/mediaplayer/MainApp.h

     
    2727
    2828#include "MainWin.h"
    2929
    30 
    3130enum  {
    3231    M_NEW_PLAYER                = 'nwpl',
    3332    M_PLAYER_QUIT               = 'plqt',
     
    5352};
    5453
    5554
    56 #define NAME "MediaPlayer"
    57 
    58 
    5955class BFilePanel;
    6056class SettingsWindow;
    6157
     
    118114
    119115extern MainApp* gMainApp;
    120116extern const char* kAppSig;
     117extern const char* PLAYER_NAME;
    121118
    122119#endif  // __MAIN_APP_H