[haiku-commits] haiku: hrev50853 - src/apps/codycam

  • From: humdingerb@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 10 Jan 2017 16:26:15 +0100 (CET)

hrev50853 adds 1 changeset to branch 'master'
old head: 5e1e245be8acfb1473cfdb91b3952bcaf5c2391e
new head: a325242d7fc7445971c844afd013df375ad64e7f
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=a325242d7fc7+%5E5e1e245be8ac

----------------------------------------------------------------------------

a325242d7fc7: Fix CodyCam layout
  
  Fixes #13174.
  
  * Add the layout to a BView and add that to the BBox.
  * Make the window correctly resize (horizontally only).

                                        [ Humdinger <humdingerb@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50853
Commit:      a325242d7fc7445971c844afd013df375ad64e7f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a325242d7fc7
Author:      Humdinger <humdingerb@xxxxxxxxx>
Date:        Tue Jan 10 15:22:13 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/13174

----------------------------------------------------------------------------

1 file changed, 27 insertions(+), 11 deletions(-)
src/apps/codycam/CodyCam.cpp | 38 +++++++++++++++++++++++++++-----------

----------------------------------------------------------------------------

diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp
index b42263a..7759669 100644
--- a/src/apps/codycam/CodyCam.cpp
+++ b/src/apps/codycam/CodyCam.cpp
@@ -126,7 +126,8 @@ CodyCam::ReadyToRun()
 {
        fWindow = new VideoWindow(
                (const char*) B_TRANSLATE_SYSTEM_NAME("CodyCam"), 
B_TITLED_WINDOW,
-               B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, &fPort);
+               B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
+               | B_AUTO_UPDATE_SIZE_LIMITS, &fPort);
 
        if (_SetUpNodes() != B_OK)
                fWindow->ToggleMenuOnOff();
@@ -223,8 +224,8 @@ CodyCam::_SetUpNodes()
        INFO("CodyCam acquiring VideoInput node\n");
        status = fMediaRoster->GetVideoInput(&fProducerNode);
        if (status != B_OK) {
-               fWindow->ErrorAlert(B_TRANSLATE("Cannot find a video source. 
You need "
-                       "a webcam to use CodyCam."), status);
+               fWindow->ErrorAlert(B_TRANSLATE("Cannot find a video source.\n"
+                       "You need a webcam to use CodyCam."), status);
                return status;
        }
 
@@ -608,12 +609,16 @@ VideoWindow::_BuildCaptureControls()
        fErrorView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 
        // Capture controls
+       BGridLayout *controlsLayout = new BGridLayout(B_USE_DEFAULT_SPACING,
+               B_USE_SMALL_SPACING);
+       controlsLayout->SetInsets(B_USE_SMALL_SPACING);
+
+       BView* controlView = new BView("Controls", B_SUPPORTS_LAYOUT, NULL);
+       controlView->SetLayout(controlsLayout);
+
        fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW);
        fCaptureSetupBox->SetLabel(B_TRANSLATE("Capture controls"));
-
-       BGridLayout *controlsLayout = new BGridLayout(B_USE_DEFAULT_SPACING, 0);
-       controlsLayout->SetInsets(10, 15, 5, 5);
-       fCaptureSetupBox->SetLayout(controlsLayout);
+       fCaptureSetupBox->AddChild(controlView);
 
        // file name
        fFileName = new BTextControl("File Name", B_TRANSLATE("File name:"),
@@ -657,8 +662,20 @@ VideoWindow::_BuildCaptureControls()
                .Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2, 1);
 
        // FTP setup box
+       BGridLayout* ftpLayout = new BGridLayout(B_USE_DEFAULT_SPACING,
+               B_USE_SMALL_SPACING);
+       ftpLayout->SetInsets(B_USE_SMALL_SPACING);
+
+       BView* outputView = new BView("Output", B_SUPPORTS_LAYOUT, NULL);
+       outputView->SetLayout(ftpLayout);
+
        fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW);
        fFtpSetupBox->SetLabel(B_TRANSLATE("Output"));
+       fFtpSetupBox->AddChild(outputView);
+       float minWidth = be_plain_font->StringWidth(
+               "The server label plus ftp.reasonably.com");
+       fFtpSetupBox->SetExplicitMinSize(BSize(minWidth, B_SIZE_UNSET));
+       fFtpSetupBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
 
        fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" 
B_UTF8_ELLIPSIS));
        for (int i = 0; i < kUploadClientsCount; i++) {
@@ -669,15 +686,12 @@ VideoWindow::_BuildCaptureControls()
 
        fUploadClientMenu->SetTargetForItems(this);
        
fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true);
+
        fUploadClientSelector = new BMenuField("UploadClient", NULL,
                fUploadClientMenu);
 
        fUploadClientSelector->SetLabel(B_TRANSLATE("Type:"));
 
-       BGridLayout *ftpLayout = new BGridLayout(B_USE_DEFAULT_SPACING, 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);
@@ -701,6 +715,7 @@ VideoWindow::_BuildCaptureControls()
                new BMessage(msg_passiveftp));
        fPassiveFtp->SetTarget(this);
        fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
+       fPassiveFtp->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
 
        BLayoutBuilder::Grid<>(ftpLayout)
                .AddMenuField(fUploadClientSelector, 0, 0)
@@ -712,6 +727,7 @@ VideoWindow::_BuildCaptureControls()
 
        fStatusLine = new BStringView("Status Line",
                B_TRANSLATE("Waiting" B_UTF8_ELLIPSIS));
+       fStatusLine->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev50853 - src/apps/codycam - humdingerb