Ticket #7271: tv.diff

File tv.diff, 5.7 KB (added by humdinger, 9 years ago)

Improved about window etc.

  • src/apps/tv/MainWin.cpp

     
    2222 * OTHER DEALINGS IN THE SOFTWARE.
    2323 */
    2424
    25 #include "MainWin.h"
    26 #include "MainApp.h"
    2725#include "Controller.h"
    28 #include "config.h"
    2926#include "DeviceRoster.h"
     27#include "MainApp.h"
     28#include "MainWin.h"
    3029
    3130#include <stdio.h>
    3231#include <string.h>
    3332
    34 #include <Application.h>
    3533#include <Alert.h>
     34#include <Application.h>
     35#include <Catalog.h>
     36#include <Font.h>
    3637#include <Menu.h>
    3738#include <MenuBar.h>
    3839#include <MenuItem.h>
     
    4041#include <PopUpMenu.h>
    4142#include <Screen.h>
    4243#include <String.h>
     44#include <TextView.h>
    4345#include <View.h>
    4446
    4547
    4648#undef B_TRANSLATE_CONTEXT
    4749#define B_TRANSLATE_CONTEXT "MainWin"
    4850
    49 static const char* fLocalizedName = B_TRANSLATE_MARK("TV");
    50 static const char* fLocalizedRevision = B_TRANSLATE_MARK("unknown");
    51 static const char* fLocalizedInfo1 = B_TRANSLATE_MARK("DVB - Digital Video Broadcasting TV");
    5251
    5352enum
    5453{
     
    8584
    8685
    8786MainWin::MainWin(BRect frame_rect)
    88  :  BWindow(frame_rect, NAME, B_TITLED_WINDOW,
     87 :  BWindow(frame_rect, B_TRANSLATE("TV"), B_TITLED_WINDOW,
    8988    B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */)
    9089 ,  fController(new Controller)
    9190 ,  fIsFullscreen(false)
     
    162161void
    163162MainWin::CreateMenu()
    164163{
    165     fFileMenu = new BMenu(NAME);
     164    fFileMenu = new BMenu(B_TRANSLATE("TV"));
    166165    fChannelMenu = new BMenu(B_TRANSLATE("Channel"));
    167166    fInterfaceMenu = new BMenu(B_TRANSLATE("Interface"));
    168167    fSettingsMenu = new BMenu(B_TRANSLATE("Settings"));
     
    174173    fMenuBar->AddItem(fSettingsMenu);
    175174    fMenuBar->AddItem(fDebugMenu);
    176175
    177     BString aboutStr = B_TRANSLATE_COMMENT("About %1"B_UTF8_ELLIPSIS,
    178         "Parameter %1 is the name of the application.");
    179     aboutStr.ReplaceFirst("%1", fLocalizedName);
    180     fFileMenu->AddItem(new BMenuItem(aboutStr.String(),
     176    fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("About TV"B_UTF8_ELLIPSIS),
    181177        new BMessage(M_FILE_ABOUT)));
    182178    fFileMenu->AddSeparatorItem();
    183179    fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
     
    565561        new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY));
    566562    item->SetMarked(fKeepAspectRatio);
    567563    menu->AddSeparatorItem();
    568     BString aboutStr = B_TRANSLATE_COMMENT("About %1"B_UTF8_ELLIPSIS,
    569         "Parameter %1 is the name of the application.");
    570     aboutStr.ReplaceFirst("%1", fLocalizedName);
    571     menu->AddItem(new BMenuItem(aboutStr.String(),
     564    menu->AddItem(new BMenuItem(B_TRANSLATE("About TV"B_UTF8_ELLIPSIS),
    572565        new BMessage(M_FILE_ABOUT)));
    573566    menu->AddSeparatorItem();
    574567    menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
     
    704697MainWin::UpdateWindowTitle()
    705698{
    706699    char buf[100];
    707     sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", NAME, fSourceWidth,
     700    sprintf(buf, "%s - %d x %d, %.3f:%.3f => %.0f x %.0f", B_TRANSLATE("TV"), fSourceWidth,
    708701        fSourceHeight, fWidthScale, fHeightScale,
    709702        fVideoView->Bounds().Width() + 1, fVideoView->Bounds().Height() + 1);
    710703    SetTitle(buf);
     
    12281221            break;
    12291222
    12301223        case M_FILE_ABOUT:
    1231             {
    1232                 BString alertStr = fLocalizedName;
    1233                 alertStr << "\n\n";
    1234                 alertStr << fLocalizedInfo1;
    1235                 #if TIME_BOMB_ACTIVE
    1236                     alertStr << "\n\n";
    1237                     alertStr << INFO2;
    1238                 #endif
    1239                 alertStr << "\n\nCopyright ";
    1240                 alertStr << COPYRIGHT;
    1241                 alertStr << B_TRANSLATE("\nVersion ");
    1242                 alertStr << VERSION;
    1243                 alertStr << B_TRANSLATE("\nRevision ");
    1244                 if (strcmp(REVISION, "unknown") == 0)
    1245                     alertStr << fLocalizedRevision;
    1246                 else
    1247                     alertStr << REVISION;
    1248                 alertStr << B_TRANSLATE("\nBuild ");
    1249                 alertStr << BUILD;
     1224        {
     1225            BString appName = B_TRANSLATE("TV");
     1226            int nameLength = appName.CountChars();
     1227            BAlert* alert = new BAlert(B_TRANSLATE("About"),
     1228                appName.Append(B_TRANSLATE("\n\nDVB - Digital Video "
     1229                    "Broadcasting TV\n\nwritten by Marcus Overhagen\n"
     1230                    "Copyright 2005-2007\n")),
     1231                B_TRANSLATE("OK"));
     1232            BTextView* view = alert->TextView();
     1233            BFont font;
     1234       
     1235            view->SetStylable(true);
     1236       
     1237            view->GetFont(&font);
     1238            font.SetSize(18);
     1239            font.SetFace(B_BOLD_FACE);
     1240            view->SetFontAndColor(0, nameLength, &font);
     1241       
     1242            alert->Go();
    12501243           
    1251                 BAlert *alert;
    1252                 alert = new BAlert("about", alertStr.String(), B_TRANSLATE("OK"));
    1253                 if (fAlwaysOnTop) {
    1254                     ToggleAlwaysOnTop();
    1255                     alert->Go();
    1256                     ToggleAlwaysOnTop();
    1257                 } else
    1258                     alert->Go();
    1259             }
    12601244            break;
    1261 
     1245        }
    12621246        case M_FILE_QUIT:
    12631247//          be_app->PostMessage(B_QUIT_REQUESTED);
    12641248            PostMessage(B_QUIT_REQUESTED);
  • src/apps/tv/config.h

     
    2828#include <InterfaceDefs.h>
    2929#include <time.h>
    3030
    31 #define NAME        "TV"
    32 #define REVISION    "unknown"
    33 #define VERSION     "1.1"
    34 #define BUILD       __DATE__ " "__TIME__
    35 #define COPYRIGHT   B_UTF8_COPYRIGHT" Marcus Overhagen 2005-2007"
    36 #define INFO1       "DVB - Digital Video Broadcasting TV"
    37 #define APP_SIG     "application/x-vnd.Haiku."NAME
    3831
    3932#endif
  • src/apps/tv/MainApp.cpp

     
    2222 * OTHER DEALINGS IN THE SOFTWARE.
    2323 */
    2424
    25 #include <Path.h>
    2625#include <Entry.h>
    2726#include <Alert.h>
    28 #include <unistd.h>
     27#include <InterfaceDefs.h>
     28#include <Path.h>
     29
    2930#include <stdio.h>
    3031#include <time.h>
     32#include <unistd.h>
    3133
    3234#include "MainApp.h"
    33 #include "config.h"
     35// #include "config.h"
    3436#include "DeviceRoster.h"
    3537
    3638#undef B_TRANSLATE_CONTEXT
     
    4345
    4446MainApp::MainApp()
    4547 :
    46  BApplication(APP_SIG)
     48 BApplication("application/x-vnd.Haiku.TV")
    4749{
    4850    InitPrefs();
    4951