Logo Search packages:      
Sourcecode: transmission version File versions  Download package

TRWindow::TRWindow (  ) 

The Transmission Window! Yay!

Definition at line 26 of file TRWindow.cpp.

References UpdateList().

                   : BWindow(BRect(10, 40, 350, 110), "Transmission", B_TITLED_WINDOW,
                               B_ASYNCHRONOUS_CONTROLS , B_CURRENT_WORKSPACE)
{
      engine = NULL;
      Prefs prefs(TRANSMISSION_SETTINGS);
      
      BRect *rectFrame = new BRect();
      if (prefs.FindRect("window.frame", rectFrame) == B_OK) {
            MoveTo(rectFrame->LeftTop());
            ResizeTo(rectFrame->Width(), rectFrame->Height());
      } else {
            rectFrame->Set(10, 40, 350, 110);
      }
      Lock();
      
      BRect viewRect(0, 0, rectFrame->Width(), rectFrame->Height());
      
      BMenuBar *menubar = new BMenuBar(viewRect, "MenuBar");
      BMenu *menu = new BMenu("File");
      menu->AddItem(new BMenuItem("Open", new BMessage(TR_OPEN), 'O', B_COMMAND_KEY));
      menu->FindItem(TR_OPEN)->SetTarget(be_app_messenger); // send OPEN to the be_app.
      menu->AddSeparatorItem();
      menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q', B_COMMAND_KEY));
      menubar->AddItem(menu);
      
      menu = new BMenu("Torrent");
      menu->AddItem(new BMenuItem("Get Info", new BMessage(TR_INFO), 'I', B_COMMAND_KEY));
      menu->FindItem(TR_INFO)->SetEnabled(false);
      menu->AddSeparatorItem();
      menu->AddItem(new BMenuItem("Resume", new BMessage(TR_RESUME)));
      menu->AddItem(new BMenuItem("Pause", new BMessage(TR_PAUSE)));
      menu->AddItem(new BMenuItem("Remove", new BMessage(TR_REMOVE)));
      menubar->AddItem(menu);
      
      menu = new BMenu("Tools");
      menu->AddItem(new BMenuItem("Settings", new BMessage(TR_SETTINGS)));
      menu->FindItem(TR_SETTINGS)->SetTarget(be_app_messenger);
      menu->AddSeparatorItem();
      menu->AddItem(new BMenuItem("About Transmission", new BMessage(B_ABOUT_REQUESTED)));
      menu->FindItem(B_ABOUT_REQUESTED)->SetTarget(be_app_messenger);
      menubar->AddItem(menu);
      
      AddChild(menubar);
      SetKeyMenuBar(menubar);
      
      // TODO: Tool Bar? (Well after everything is working based on Menus)
      
      // Setup the transfers ListView
      viewRect.Set(2, menubar->Frame().bottom + 3, rectFrame->Width() - 2 - B_V_SCROLL_BAR_WIDTH, rectFrame->Height() - 2);
      transfers = new BListView(viewRect, "TorrentList", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL);
      transfers->SetSelectionMessage(new BMessage(TR_SELECT));
      AddChild(new BScrollView("TransferScroller", transfers, B_FOLLOW_ALL, 0, false, true));
      
      Unlock();
      delete rectFrame;
      
      // Bring up the Transmission Engine
      engine = tr_init();
      LoadSettings();
      
      UpdateList(-1, true);
      
      // Start the message loop without showing the window.
      Hide();
      Show();
}


Generated by  Doxygen 1.6.0   Back to index