void VideoWindow::_BuildCaptureControls() { // a view to hold the video image fVideoView = new BView("Video View", B_WILL_DRAW); fVideoView->SetExplicitMinSize(BSize(VIDEO_SIZE_X, VIDEO_SIZE_Y)); fVideoView->SetExplicitMaxSize(BSize(VIDEO_SIZE_X, VIDEO_SIZE_Y)); // Capture controls fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW); fCaptureSetupBox->SetLabel(B_TRANSLATE("Capture controls")); BGridLayout *controlsLayout = new BGridLayout(kXBuffer, 0); controlsLayout->SetInsets(10, 15, 5, 5); fCaptureSetupBox->SetLayout(controlsLayout); // file name fFileName = new BTextControl("File Name", B_TRANSLATE("File name:"), fFilenameSetting->Value(), new BMessage(msg_filename)); fFileName->SetTarget(BMessenger(NULL, this)); // format menu fImageFormatMenu = new BPopUpMenu(B_TRANSLATE("Image Format Menu")); AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP); fImageFormatMenu->SetTargetForItems(this); if (fImageFormatSettings->Value() && fImageFormatMenu->FindItem(fImageFormatSettings->Value()) != NULL) { fImageFormatMenu->FindItem( fImageFormatSettings->Value())->SetMarked(true); } else if (fImageFormatMenu->FindItem("JPEG image") != NULL) fImageFormatMenu->FindItem("JPEG image")->SetMarked(true); else fImageFormatMenu->ItemAt(0)->SetMarked(true); fImageFormatSelector = new BMenuField("Format", B_TRANSLATE("Format:"), fImageFormatMenu); // capture rate fCaptureRateMenu = new BPopUpMenu(B_TRANSLATE("Capture Rate Menu")); for (int32 i = 0; i < kCaptureRatesCount; i++) { BMessage* itemMessage = new BMessage(msg_rate_changed); itemMessage->AddInt32("seconds", kCaptureRates[i].seconds); fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRates[i].name, itemMessage)); } fCaptureRateMenu->SetTargetForItems(this); fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true); fCaptureRateSelector = new BMenuField("Rate", B_TRANSLATE("Rate:"), fCaptureRateMenu); BLayoutBuilder::Grid<>(controlsLayout) .AddTextControl(fFileName, 0, 0) .AddMenuField(fImageFormatSelector, 0, 1) .AddMenuField(fCaptureRateSelector, 0, 2) .Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2, 1); // FTP setup box fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW); fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" B_UTF8_ELLIPSIS)); for (int i = 0; i < kUploadClientsCount; i++) { BMessage *m = new BMessage(msg_upl_client); m->AddInt32("client", i); fUploadClientMenu->AddItem(new BMenuItem(kUploadClients[i], m)); } fUploadClientMenu->SetTargetForItems(this); fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true); fUploadClientSelector = new BMenuField("UploadClient", NULL, fUploadClientMenu); fFtpSetupBox->SetLabel(B_TRANSLATE("Output")); // this doesn't work with the layout manager // fFtpSetupBox->SetLabel(fUploadClientSelector); fUploadClientSelector->SetLabel(B_TRANSLATE("Type:")); BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0); ftpLayout->SetInsets(10, 15, 5, 5); fFtpSetupBox->SetLayout(ftpLayout); fServerName = new BTextControl("Server", B_TRANSLATE("Server:"), fServerSetting->Value(), new BMessage(msg_server)); fServerName->SetTarget(this); fLoginId = new BTextControl("Login", B_TRANSLATE("Login:"******"Password", B_TRANSLATE("Password:"******"Directory", B_TRANSLATE("Directory:"), fDirectorySetting->Value(), new BMessage(msg_directory)); fDirectory->SetTarget(this); fPassiveFtp = new BCheckBox("Passive FTP", B_TRANSLATE("Passive FTP"), new BMessage(msg_passiveftp)); fPassiveFtp->SetTarget(this); fPassiveFtp->SetValue(fPassiveFtpSetting->Value()); BLayoutBuilder::Grid<>(ftpLayout) .AddMenuField(fUploadClientSelector, 0, 0) .AddTextControl(fServerName, 0, 1) .AddTextControl(fLoginId, 0, 2) .AddTextControl(fPassword, 0, 3) .AddTextControl(fDirectory, 0, 4) .Add(fPassiveFtp, 0, 5, 2, 1); fStatusLine = new BStringView("Status Line", B_TRANSLATE("Waiting" B_UTF8_ELLIPSIS)); }
void VideoWindow::_BuildCaptureControls(BView* theView) { // a view to hold the video image fVideoView = new BView("Video View", B_WILL_DRAW); fVideoView->SetExplicitMinSize(BSize(VIDEO_SIZE_X, VIDEO_SIZE_Y)); fVideoView->SetExplicitMaxSize(BSize(VIDEO_SIZE_X, VIDEO_SIZE_Y)); // Capture controls fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW); fCaptureSetupBox->SetLabel("Capture controls"); BGridLayout *controlsLayout = new BGridLayout(kXBuffer, 0); controlsLayout->SetInsets(10, 15, 5, 5); fCaptureSetupBox->SetLayout(controlsLayout); fFileName = new BTextControl("File Name", "File name:", fFilenameSetting->Value(), new BMessage(msg_filename)); fFileName->SetTarget(BMessenger(NULL, this)); fImageFormatMenu = new BPopUpMenu("Image Format Menu"); AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP); fImageFormatMenu->SetTargetForItems(this); if (fImageFormatSettings->Value() && fImageFormatMenu->FindItem(fImageFormatSettings->Value()) != NULL) { fImageFormatMenu->FindItem( fImageFormatSettings->Value())->SetMarked(true); } else if (fImageFormatMenu->FindItem("JPEG image") != NULL) fImageFormatMenu->FindItem("JPEG image")->SetMarked(true); else fImageFormatMenu->ItemAt(0)->SetMarked(true); fImageFormatSelector = new BMenuField("Format", "Format:", fImageFormatMenu, NULL); fCaptureRateMenu = new BPopUpMenu("Capture Rate Menu"); fCaptureRateMenu->AddItem(new BMenuItem("Every 15 seconds", new BMessage(msg_rate_15s))); fCaptureRateMenu->AddItem(new BMenuItem("Every 30 seconds", new BMessage(msg_rate_30s))); fCaptureRateMenu->AddItem(new BMenuItem("Every minute", new BMessage(msg_rate_1m))); fCaptureRateMenu->AddItem(new BMenuItem("Every 5 minutes", new BMessage(msg_rate_5m))); fCaptureRateMenu->AddItem(new BMenuItem("Every 10 minutes", new BMessage(msg_rate_10m))); fCaptureRateMenu->AddItem(new BMenuItem("Every 15 minutes", new BMessage(msg_rate_15m))); fCaptureRateMenu->AddItem(new BMenuItem("Every 30 minutes", new BMessage(msg_rate_30m))); fCaptureRateMenu->AddItem(new BMenuItem("Every hour", new BMessage(msg_rate_1h))); fCaptureRateMenu->AddItem(new BMenuItem("Every 2 hours", new BMessage(msg_rate_2h))); fCaptureRateMenu->AddItem(new BMenuItem("Every 4 hours", new BMessage(msg_rate_4h))); fCaptureRateMenu->AddItem(new BMenuItem("Every 8 hours", new BMessage(msg_rate_8h))); fCaptureRateMenu->AddItem(new BMenuItem("Every 24 hours", new BMessage(msg_rate_24h))); fCaptureRateMenu->AddItem(new BMenuItem("Never", new BMessage(msg_rate_never))); fCaptureRateMenu->SetTargetForItems(this); fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true); fCaptureRateSelector = new BMenuField("Rate", "Rate:", fCaptureRateMenu, NULL); controlsLayout->AddItem(fFileName->CreateLabelLayoutItem(), 0, 0); controlsLayout->AddItem(fFileName->CreateTextViewLayoutItem(), 1, 0); controlsLayout->AddItem(fImageFormatSelector->CreateLabelLayoutItem(), 0, 1); controlsLayout->AddItem(fImageFormatSelector->CreateMenuBarLayoutItem(), 1, 1); controlsLayout->AddItem(fCaptureRateSelector->CreateLabelLayoutItem(), 0, 2); controlsLayout->AddItem(fCaptureRateSelector->CreateMenuBarLayoutItem(), 1, 2); controlsLayout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 3, 2); // FTP setup box fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW); fUploadClientMenu = new BPopUpMenu("Send to" B_UTF8_ELLIPSIS); for (int i = 0; kUploadClient[i]; i++) { BMessage *m = new BMessage(msg_upl_client); m->AddInt32("client", i); fUploadClientMenu->AddItem(new BMenuItem(kUploadClient[i], m)); } fUploadClientMenu->SetTargetForItems(this); fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true); fUploadClientSelector = new BMenuField("UploadClient", NULL, fUploadClientMenu, NULL); fFtpSetupBox->SetLabel("Output"); // this doesn't work with the layout manager // fFtpSetupBox->SetLabel(fUploadClientSelector); fUploadClientSelector->SetLabel("Type:"); BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0); ftpLayout->SetInsets(10, 15, 5, 5); fFtpSetupBox->SetLayout(ftpLayout); fServerName = new BTextControl("Server", "Server:", fServerSetting->Value(), new BMessage(msg_server)); fServerName->SetTarget(this); fLoginId = new BTextControl("Login", "Login:"******"Password", "Password:"******"Directory", "Directory:", fDirectorySetting->Value(), new BMessage(msg_directory)); fDirectory->SetTarget(this); fPassiveFtp = new BCheckBox("Passive FTP", "Passive FTP", new BMessage(msg_passiveftp)); fPassiveFtp->SetTarget(this); fPassiveFtp->SetValue(fPassiveFtpSetting->Value()); ftpLayout->AddItem(fUploadClientSelector->CreateLabelLayoutItem(), 0, 0); ftpLayout->AddItem(fUploadClientSelector->CreateMenuBarLayoutItem(), 1, 0); ftpLayout->AddItem(fServerName->CreateLabelLayoutItem(), 0, 1); ftpLayout->AddItem(fServerName->CreateTextViewLayoutItem(), 1, 1); ftpLayout->AddItem(fLoginId->CreateLabelLayoutItem(), 0, 2); ftpLayout->AddItem(fLoginId->CreateTextViewLayoutItem(), 1, 2); ftpLayout->AddItem(fPassword->CreateLabelLayoutItem(), 0, 3); ftpLayout->AddItem(fPassword->CreateTextViewLayoutItem(), 1, 3); ftpLayout->AddItem(fDirectory->CreateLabelLayoutItem(), 0, 4); ftpLayout->AddItem(fDirectory->CreateTextViewLayoutItem(), 1, 4); ftpLayout->AddView(fPassiveFtp, 0, 5, 2); fStatusLine = new BStringView("Status Line", "Waiting" B_UTF8_ELLIPSIS); BGroupLayout *groupLayout = new BGroupLayout(B_VERTICAL); groupLayout->SetInsets(kXBuffer, kYBuffer, kXBuffer, kYBuffer); theView->SetLayout(groupLayout); theView->AddChild(BSpaceLayoutItem::CreateVerticalStrut(kYBuffer)); theView->AddChild(BGroupLayoutBuilder(B_HORIZONTAL) .Add(BSpaceLayoutItem::CreateHorizontalStrut(0.0)) .Add(fVideoView) .Add(BSpaceLayoutItem::CreateHorizontalStrut(0.0)) ); theView->AddChild(BSpaceLayoutItem::CreateVerticalStrut(kYBuffer)); theView->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, kXBuffer) .Add(fCaptureSetupBox) .Add(fFtpSetupBox) ); theView->AddChild(BSpaceLayoutItem::CreateVerticalStrut(kYBuffer)); theView->AddChild(fStatusLine); }