* Fix regression in CodyCam from r38512, and do some refactoring too.
* Instead of passing a different message constant for each possible rate of capture, we pass a single message with a int32 'seconds' field. * switch to templatized layout builders, make use of AddMenuField and AddTextControl methods. * Changed semantics of VideoWindow::_BuildCaptureControls to only construct views, not add them, the window layout is now built in the VideoWindow constructor. * EnumeratedStringValueSetting now takes a function pointer to get its strings, instead of a const char**. * kUploadClients and kCaptureRates arrays are not NULL terminated anymore, there is a size constant associated with each one. * Style fixes git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38519 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+121
-185
@@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <GridLayout.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <GroupLayout.h>
|
|
||||||
#include <GroupLayoutBuilder.h>
|
|
||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
#include <MediaRoster.h>
|
#include <MediaRoster.h>
|
||||||
@@ -18,7 +16,6 @@
|
|||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
#include <SpaceLayoutItem.h>
|
|
||||||
#include <TabView.h>
|
#include <TabView.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <TimeSource.h>
|
#include <TimeSource.h>
|
||||||
@@ -46,9 +43,6 @@ const int32 kMenuHeight = 15;
|
|||||||
const int32 kButtonHeight = 15;
|
const int32 kButtonHeight = 15;
|
||||||
const int32 kSliderViewRectHeight = 40;
|
const int32 kSliderViewRectHeight = 40;
|
||||||
|
|
||||||
static void ErrorAlert(const char* message, status_t err, BWindow *window);
|
|
||||||
static status_t AddTranslationItems(BMenu* intoMenu, uint32 fromType);
|
|
||||||
|
|
||||||
#define CALL printf
|
#define CALL printf
|
||||||
#define ERROR printf
|
#define ERROR printf
|
||||||
#define FTPINFO printf
|
#define FTPINFO printf
|
||||||
@@ -57,7 +51,9 @@ static status_t AddTranslationItems(BMenu* intoMenu, uint32 fromType);
|
|||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
|
|
||||||
static void
|
namespace {
|
||||||
|
|
||||||
|
void
|
||||||
ErrorAlert(const char* message, status_t err, BWindow *window = NULL)
|
ErrorAlert(const char* message, status_t err, BWindow *window = NULL)
|
||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("", message, B_TRANSLATE("OK"));
|
BAlert *alert = new BAlert("", message, B_TRANSLATE("OK"));
|
||||||
@@ -121,11 +117,30 @@ AddTranslationItems(BMenu* intoMenu, uint32 fromType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// functions for EnumeratedStringValueSettings
|
||||||
|
|
||||||
|
const char* CaptureRateAt(int32 i)
|
||||||
|
{
|
||||||
|
return (i >= 0 && i < kCaptureRatesCount) ? kCaptureRates[i].name : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char* UploadClientAt(int32 i)
|
||||||
|
{
|
||||||
|
return (i >= 0 && i < kUploadClientsCount) ? kUploadClients[i] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}; // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
CodyCam::CodyCam()
|
CodyCam::CodyCam()
|
||||||
: BApplication("application/x-vnd.Haiku.CodyCam"),
|
:
|
||||||
|
BApplication("application/x-vnd.Haiku.CodyCam"),
|
||||||
fMediaRoster(NULL),
|
fMediaRoster(NULL),
|
||||||
fVideoConsumer(NULL),
|
fVideoConsumer(NULL),
|
||||||
fWindow(NULL),
|
fWindow(NULL),
|
||||||
@@ -133,24 +148,24 @@ CodyCam::CodyCam()
|
|||||||
fVideoControlWindow(NULL)
|
fVideoControlWindow(NULL)
|
||||||
{
|
{
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 15 seconds");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 15 seconds");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 30 seconds");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 30 seconds");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every minute");
|
kCaptureRates[index++].name = B_TRANSLATE("Every minute");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 5 minutes");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 5 minutes");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 10 minutes");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 10 minutes");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 15 minutes");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 15 minutes");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 30 minutes");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 30 minutes");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every hour");
|
kCaptureRates[index++].name = B_TRANSLATE("Every hour");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 2 hours");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 2 hours");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 4 hours");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 4 hours");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 8 hours");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 8 hours");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Every 24 hours");
|
kCaptureRates[index++].name = B_TRANSLATE("Every 24 hours");
|
||||||
kCaptureRate[index++] = B_TRANSLATE("Never");
|
kCaptureRates[index++].name = B_TRANSLATE("Never");
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
kUploadClient[index++] = B_TRANSLATE("FTP");
|
kUploadClients[index++] = B_TRANSLATE("FTP");
|
||||||
kUploadClient[index++] = B_TRANSLATE("SFTP");
|
kUploadClients[index++] = B_TRANSLATE("SFTP");
|
||||||
kUploadClient[index++] = B_TRANSLATE("Local");
|
kUploadClients[index++] = B_TRANSLATE("Local");
|
||||||
|
|
||||||
chdir("/boot/home");
|
chdir("/boot/home");
|
||||||
}
|
}
|
||||||
@@ -454,7 +469,6 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type,
|
|||||||
:
|
:
|
||||||
BWindow(frame, title, type, flags),
|
BWindow(frame, title, type, flags),
|
||||||
fPortPtr(consumerPort),
|
fPortPtr(consumerPort),
|
||||||
fView(NULL),
|
|
||||||
fVideoView(NULL)
|
fVideoView(NULL)
|
||||||
{
|
{
|
||||||
fFtpInfo.port = 0;
|
fFtpInfo.port = 0;
|
||||||
@@ -509,16 +523,21 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type,
|
|||||||
|
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
/* give it a gray background view */
|
|
||||||
fView = new BView(B_TRANSLATE("Background View"), B_WILL_DRAW);
|
|
||||||
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
|
|
||||||
/* add some controls */
|
/* add some controls */
|
||||||
_BuildCaptureControls(fView);
|
_BuildCaptureControls();
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||||
AddChild(menuBar);
|
.SetInsets(0, 0, 0, 0)
|
||||||
AddChild(fView);
|
.Add(menuBar)
|
||||||
|
.AddGroup(B_VERTICAL, kYBuffer)
|
||||||
|
.SetInsets(kXBuffer, kYBuffer, kXBuffer, kYBuffer)
|
||||||
|
.Add(fVideoView)
|
||||||
|
.AddGroup(B_HORIZONTAL, kXBuffer)
|
||||||
|
.SetInsets(0, 0, 0, 0)
|
||||||
|
.Add(fCaptureSetupBox)
|
||||||
|
.Add(fFtpSetupBox)
|
||||||
|
.End()
|
||||||
|
.Add(fStatusLine);
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
@@ -549,75 +568,24 @@ VideoWindow::MessageReceived(BMessage* message)
|
|||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case msg_filename:
|
case msg_filename:
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
strncpy(fFtpInfo.fileNameText, ((BTextControl*)control)->Text(), 63);
|
strncpy(fFtpInfo.fileNameText,
|
||||||
|
((BTextControl*)control)->Text(), 63);
|
||||||
FTPINFO("file is '%s'\n", fFtpInfo.fileNameText);
|
FTPINFO("file is '%s'\n", fFtpInfo.fileNameText);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case msg_rate_15s:
|
case msg_rate_changed: {
|
||||||
FTPINFO("fifteen seconds\n");
|
int32 seconds;
|
||||||
fFtpInfo.rate = (bigtime_t)(15 * 1000000);
|
message->FindInt32("seconds", &seconds);
|
||||||
break;
|
if (seconds == 0) {
|
||||||
|
FTPINFO("never\n");
|
||||||
case msg_rate_30s:
|
fFtpInfo.rate = (bigtime_t)(B_INFINITE_TIMEOUT);
|
||||||
FTPINFO("thirty seconds\n");
|
} else {
|
||||||
fFtpInfo.rate = (bigtime_t)(30 * 1000000);
|
FTPINFO("%ld seconds\n", (long)seconds);
|
||||||
break;
|
fFtpInfo.rate = (bigtime_t)(seconds * 1000000LL);
|
||||||
|
}
|
||||||
case msg_rate_1m:
|
|
||||||
FTPINFO("one minute\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(1 * 60 * 1000000);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_5m:
|
|
||||||
FTPINFO("five minute\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(5 * 60 * 1000000);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_10m:
|
|
||||||
FTPINFO("ten minute\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(10 * 60 * 1000000);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_15m:
|
|
||||||
FTPINFO("fifteen minute\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(15 * 60 * 1000000);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_30m:
|
|
||||||
FTPINFO("thirty minute\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(30 * 60 * 1000000);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_1h:
|
|
||||||
FTPINFO("one hour\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(60LL * 60LL * 1000000LL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_2h:
|
|
||||||
FTPINFO("two hour\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(2LL * 60LL * 60LL * 1000000LL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_4h:
|
|
||||||
FTPINFO("four hour\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(4LL * 60LL * 60LL * 1000000LL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_8h:
|
|
||||||
FTPINFO("eight hour\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(8LL * 60LL * 60LL * 1000000LL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_24h:
|
|
||||||
FTPINFO("24 hour\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(24LL * 60LL * 60LL * 1000000LL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case msg_rate_never:
|
|
||||||
FTPINFO("never\n");
|
|
||||||
fFtpInfo.rate = (bigtime_t)(B_INFINITE_TIMEOUT);
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case msg_translate:
|
case msg_translate:
|
||||||
message->FindInt32("be:type", (int32*)&(fFtpInfo.imageFormat));
|
message->FindInt32("be:type", (int32*)&(fFtpInfo.imageFormat));
|
||||||
@@ -632,28 +600,32 @@ VideoWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
case msg_server:
|
case msg_server:
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
strncpy(fFtpInfo.serverText, ((BTextControl*)control)->Text(), 64);
|
strncpy(fFtpInfo.serverText,
|
||||||
|
((BTextControl*)control)->Text(), 64);
|
||||||
FTPINFO("server = '%s'\n", fFtpInfo.serverText);
|
FTPINFO("server = '%s'\n", fFtpInfo.serverText);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case msg_login:
|
case msg_login:
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
strncpy(fFtpInfo.loginText, ((BTextControl*)control)->Text(), 64);
|
strncpy(fFtpInfo.loginText,
|
||||||
|
((BTextControl*)control)->Text(), 64);
|
||||||
FTPINFO("login = '%s'\n", fFtpInfo.loginText);
|
FTPINFO("login = '%s'\n", fFtpInfo.loginText);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case msg_password:
|
case msg_password:
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
strncpy(fFtpInfo.passwordText, ((BTextControl*)control)->Text(), 64);
|
strncpy(fFtpInfo.passwordText,
|
||||||
|
((BTextControl*)control)->Text(), 64);
|
||||||
FTPINFO("password = '%s'\n", fFtpInfo.passwordText);
|
FTPINFO("password = '%s'\n", fFtpInfo.passwordText);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case msg_directory:
|
case msg_directory:
|
||||||
if (control != NULL) {
|
if (control != NULL) {
|
||||||
strncpy(fFtpInfo.directoryText, ((BTextControl*)control)->Text(), 64);
|
strncpy(fFtpInfo.directoryText,
|
||||||
|
((BTextControl*)control)->Text(), 64);
|
||||||
FTPINFO("directory = '%s'\n", fFtpInfo.directoryText);
|
FTPINFO("directory = '%s'\n", fFtpInfo.directoryText);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -692,7 +664,7 @@ VideoWindow::StatusLine()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VideoWindow::_BuildCaptureControls(BView* theView)
|
VideoWindow::_BuildCaptureControls()
|
||||||
{
|
{
|
||||||
// a view to hold the video image
|
// a view to hold the video image
|
||||||
fVideoView = new BView("Video View", B_WILL_DRAW);
|
fVideoView = new BView("Video View", B_WILL_DRAW);
|
||||||
@@ -707,10 +679,12 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
controlsLayout->SetInsets(10, 15, 5, 5);
|
controlsLayout->SetInsets(10, 15, 5, 5);
|
||||||
fCaptureSetupBox->SetLayout(controlsLayout);
|
fCaptureSetupBox->SetLayout(controlsLayout);
|
||||||
|
|
||||||
|
// file name
|
||||||
fFileName = new BTextControl("File Name", B_TRANSLATE("File name:"),
|
fFileName = new BTextControl("File Name", B_TRANSLATE("File name:"),
|
||||||
fFilenameSetting->Value(), new BMessage(msg_filename));
|
fFilenameSetting->Value(), new BMessage(msg_filename));
|
||||||
fFileName->SetTarget(BMessenger(NULL, this));
|
fFileName->SetTarget(BMessenger(NULL, this));
|
||||||
|
|
||||||
|
// format menu
|
||||||
fImageFormatMenu = new BPopUpMenu(B_TRANSLATE("Image Format Menu"));
|
fImageFormatMenu = new BPopUpMenu(B_TRANSLATE("Image Format Menu"));
|
||||||
AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
|
AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
|
||||||
fImageFormatMenu->SetTargetForItems(this);
|
fImageFormatMenu->SetTargetForItems(this);
|
||||||
@@ -727,58 +701,33 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
fImageFormatSelector = new BMenuField("Format", B_TRANSLATE("Format:"),
|
fImageFormatSelector = new BMenuField("Format", B_TRANSLATE("Format:"),
|
||||||
fImageFormatMenu, NULL);
|
fImageFormatMenu, NULL);
|
||||||
|
|
||||||
|
// capture rate
|
||||||
fCaptureRateMenu = new BPopUpMenu(B_TRANSLATE("Capture Rate Menu"));
|
fCaptureRateMenu = new BPopUpMenu(B_TRANSLATE("Capture Rate Menu"));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[0],
|
for (int32 i = 0; i < kCaptureRatesCount; i++) {
|
||||||
new BMessage(msg_rate_15s)));
|
BMessage* itemMessage = new BMessage(msg_rate_changed);
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[1],
|
itemMessage->AddInt32("seconds", kCaptureRates[i].seconds);
|
||||||
new BMessage(msg_rate_30s)));
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRates[i].name,
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[2],
|
itemMessage));
|
||||||
new BMessage(msg_rate_1m)));
|
}
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[3],
|
|
||||||
new BMessage(msg_rate_5m)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[4],
|
|
||||||
new BMessage(msg_rate_10m)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[5],
|
|
||||||
new BMessage(msg_rate_15m)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[6],
|
|
||||||
new BMessage(msg_rate_30m)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[7],
|
|
||||||
new BMessage(msg_rate_1h)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[8],
|
|
||||||
new BMessage(msg_rate_2h)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[9],
|
|
||||||
new BMessage(msg_rate_4h)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[10],
|
|
||||||
new BMessage(msg_rate_8h)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[11],
|
|
||||||
new BMessage(msg_rate_24h)));
|
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[12],
|
|
||||||
new BMessage(msg_rate_never)));
|
|
||||||
fCaptureRateMenu->SetTargetForItems(this);
|
fCaptureRateMenu->SetTargetForItems(this);
|
||||||
fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true);
|
fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true);
|
||||||
fCaptureRateSelector = new BMenuField("Rate", B_TRANSLATE("Rate:"),
|
fCaptureRateSelector = new BMenuField("Rate", B_TRANSLATE("Rate:"),
|
||||||
fCaptureRateMenu, NULL);
|
fCaptureRateMenu, NULL);
|
||||||
|
|
||||||
controlsLayout->AddItem(fFileName->CreateLabelLayoutItem(), 0, 0);
|
BLayoutBuilder::Grid<>(controlsLayout)
|
||||||
controlsLayout->AddItem(fFileName->CreateTextViewLayoutItem(), 1, 0);
|
.AddTextControl(fFileName, 0, 0)
|
||||||
controlsLayout->AddItem(fImageFormatSelector->CreateLabelLayoutItem(), 0,
|
.AddMenuField(fImageFormatSelector, 0, 1)
|
||||||
1);
|
.AddMenuField(fCaptureRateSelector, 0, 2)
|
||||||
controlsLayout->AddItem(fImageFormatSelector->CreateMenuBarLayoutItem(), 1,
|
.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2, 1);
|
||||||
1);
|
|
||||||
controlsLayout->AddItem(fCaptureRateSelector->CreateLabelLayoutItem(), 0,
|
|
||||||
2);
|
|
||||||
controlsLayout->AddItem(fCaptureRateSelector->CreateMenuBarLayoutItem(), 1,
|
|
||||||
2);
|
|
||||||
controlsLayout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 3, 2);
|
|
||||||
|
|
||||||
// FTP setup box
|
// FTP setup box
|
||||||
fFtpSetupBox = new BBox(B_TRANSLATE("FTP Setup"), B_WILL_DRAW);
|
fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW);
|
||||||
|
|
||||||
fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" B_UTF8_ELLIPSIS));
|
fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" B_UTF8_ELLIPSIS));
|
||||||
for (int i = 0; kUploadClient[i]; i++) {
|
for (int i = 0; i < kUploadClientsCount; i++) {
|
||||||
BMessage *m = new BMessage(msg_upl_client);
|
BMessage *m = new BMessage(msg_upl_client);
|
||||||
m->AddInt32("client", i);
|
m->AddInt32("client", i);
|
||||||
fUploadClientMenu->AddItem(new BMenuItem(kUploadClient[i], m));
|
fUploadClientMenu->AddItem(new BMenuItem(kUploadClients[i], m));
|
||||||
}
|
}
|
||||||
fUploadClientMenu->SetTargetForItems(this);
|
fUploadClientMenu->SetTargetForItems(this);
|
||||||
fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true);
|
fUploadClientMenu->FindItem(fUploadClientSetting->Value())->SetMarked(true);
|
||||||
@@ -818,38 +767,16 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
fPassiveFtp->SetTarget(this);
|
fPassiveFtp->SetTarget(this);
|
||||||
fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
|
fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
|
||||||
|
|
||||||
ftpLayout->AddItem(fUploadClientSelector->CreateLabelLayoutItem(), 0, 0);
|
BLayoutBuilder::Grid<>(ftpLayout)
|
||||||
ftpLayout->AddItem(fUploadClientSelector->CreateMenuBarLayoutItem(), 1, 0);
|
.AddMenuField(fUploadClientSelector, 0, 0)
|
||||||
ftpLayout->AddItem(fServerName->CreateLabelLayoutItem(), 0, 1);
|
.AddTextControl(fServerName, 0, 1)
|
||||||
ftpLayout->AddItem(fServerName->CreateTextViewLayoutItem(), 1, 1);
|
.AddTextControl(fLoginId, 0, 2)
|
||||||
ftpLayout->AddItem(fLoginId->CreateLabelLayoutItem(), 0, 2);
|
.AddTextControl(fPassword, 0, 3)
|
||||||
ftpLayout->AddItem(fLoginId->CreateTextViewLayoutItem(), 1, 2);
|
.AddTextControl(fDirectory, 0, 4)
|
||||||
ftpLayout->AddItem(fPassword->CreateLabelLayoutItem(), 0, 3);
|
.Add(fPassiveFtp, 0, 5, 2, 1);
|
||||||
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", B_TRANSLATE("Waiting" B_UTF8_ELLIPSIS));
|
fStatusLine = new BStringView("Status Line",
|
||||||
|
B_TRANSLATE("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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -880,24 +807,32 @@ VideoWindow::_SetUpSettings(const char* filename, const char* dirname)
|
|||||||
fSettings = new Settings(filename, dirname);
|
fSettings = new Settings(filename, dirname);
|
||||||
|
|
||||||
fServerSetting = new StringValueSetting("Server", "ftp.my.server",
|
fServerSetting = new StringValueSetting("Server", "ftp.my.server",
|
||||||
B_TRANSLATE("server address expected"), "");
|
B_TRANSLATE("server address expected"));
|
||||||
|
|
||||||
fLoginSetting = new StringValueSetting("Login", "loginID",
|
fLoginSetting = new StringValueSetting("Login", "loginID",
|
||||||
B_TRANSLATE("login ID expected"), "");
|
B_TRANSLATE("login ID expected"));
|
||||||
|
|
||||||
fPasswordSetting = new StringValueSetting("Password",
|
fPasswordSetting = new StringValueSetting("Password",
|
||||||
B_TRANSLATE("password"), B_TRANSLATE("password expected"), "");
|
B_TRANSLATE("password"), B_TRANSLATE("password expected"));
|
||||||
|
|
||||||
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
||||||
B_TRANSLATE("destination directory expected"), "");
|
B_TRANSLATE("destination directory expected"));
|
||||||
|
|
||||||
fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1);
|
fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1);
|
||||||
|
|
||||||
fFilenameSetting = new StringValueSetting("StillImageFilename",
|
fFilenameSetting = new StringValueSetting("StillImageFilename",
|
||||||
"codycam.jpg", B_TRANSLATE("still image filename expected"), "");
|
"codycam.jpg", B_TRANSLATE("still image filename expected"));
|
||||||
|
|
||||||
fImageFormatSettings = new StringValueSetting("ImageFileFormat",
|
fImageFormatSettings = new StringValueSetting("ImageFileFormat",
|
||||||
B_TRANSLATE("JPEG image"), B_TRANSLATE("image file format expected"),
|
B_TRANSLATE("JPEG image"), B_TRANSLATE("image file format expected"));
|
||||||
"");
|
|
||||||
fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate",
|
fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate",
|
||||||
kCaptureRate[3], kCaptureRate, B_TRANSLATE("capture rate expected"),
|
kCaptureRates[3].name, &CaptureRateAt,
|
||||||
|
B_TRANSLATE("capture rate expected"),
|
||||||
"unrecognized capture rate specified");
|
"unrecognized capture rate specified");
|
||||||
|
|
||||||
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
||||||
B_TRANSLATE("FTP"), kUploadClient,
|
B_TRANSLATE("FTP"), &UploadClientAt,
|
||||||
B_TRANSLATE("upload client name expected"),
|
B_TRANSLATE("upload client name expected"),
|
||||||
B_TRANSLATE("unrecognized upload client specified"));
|
B_TRANSLATE("unrecognized upload client specified"));
|
||||||
|
|
||||||
@@ -950,8 +885,9 @@ VideoWindow::_QuitSettings()
|
|||||||
|
|
||||||
ControlWindow::ControlWindow(const BRect& frame, BView* controls,
|
ControlWindow::ControlWindow(const BRect& frame, BView* controls,
|
||||||
media_node node)
|
media_node node)
|
||||||
: BWindow(frame, B_TRANSLATE("Video settings"), B_TITLED_WINDOW,
|
:
|
||||||
B_ASYNCHRONOUS_CONTROLS)
|
BWindow(frame, B_TRANSLATE("Video settings"), B_TITLED_WINDOW,
|
||||||
|
B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
fView = controls;
|
fView = controls;
|
||||||
fNode = node;
|
fNode = node;
|
||||||
|
|||||||
+31
-34
@@ -25,19 +25,7 @@ class BMediaRoster;
|
|||||||
enum {
|
enum {
|
||||||
msg_filename = 'file',
|
msg_filename = 'file',
|
||||||
|
|
||||||
msg_rate_15s = 'r15s',
|
msg_rate_changed = 'rate',
|
||||||
msg_rate_30s = 'r30s',
|
|
||||||
msg_rate_1m = 'r1m ',
|
|
||||||
msg_rate_5m = 'r5m ',
|
|
||||||
msg_rate_10m = 'r10m',
|
|
||||||
msg_rate_15m = 'r15m',
|
|
||||||
msg_rate_30m = 'r30m',
|
|
||||||
msg_rate_1h = 'r1h ',
|
|
||||||
msg_rate_2h = 'r2h ',
|
|
||||||
msg_rate_4h = 'r4h ',
|
|
||||||
msg_rate_8h = 'r8h ',
|
|
||||||
msg_rate_24h = 'r24h',
|
|
||||||
msg_rate_never = 'nevr',
|
|
||||||
|
|
||||||
msg_translate = 'tran',
|
msg_translate = 'tran',
|
||||||
|
|
||||||
@@ -60,34 +48,44 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char* kCaptureRate[] = {
|
struct capture_rate {
|
||||||
// NOTE: These are translated once the app catalog is loaded.
|
const char* name;
|
||||||
"Every 15 seconds",
|
time_t seconds;
|
||||||
"Every 30 seconds",
|
|
||||||
"Every minute",
|
|
||||||
"Every 5 minutes",
|
|
||||||
"Every 10 minutes",
|
|
||||||
"Every 15 minutes",
|
|
||||||
"Every 30 minutes",
|
|
||||||
"Every hour",
|
|
||||||
"Every 2 hours",
|
|
||||||
"Every 4 hours",
|
|
||||||
"Every 8 hours",
|
|
||||||
"Every 24 hours",
|
|
||||||
"Never",
|
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const char* kUploadClient[] = {
|
// NOTE: These are translated once the app catalog is loaded.
|
||||||
|
capture_rate kCaptureRates[] = {
|
||||||
|
{"Every 15 seconds", 15 },
|
||||||
|
{"Every 30 seconds", 30 },
|
||||||
|
{"Every minute", 60 },
|
||||||
|
{"Every 5 minutes", 5 * 60 },
|
||||||
|
{"Every 10 minutes", 10 * 60 },
|
||||||
|
{"Every 15 minutes", 15 * 60 },
|
||||||
|
{"Every 30 minutes", 30 * 60 },
|
||||||
|
{"Every hour", 60 * 60 },
|
||||||
|
{"Every 2 hours", 2 * 60 * 60 },
|
||||||
|
{"Every 4 hours", 4 * 60 * 60 },
|
||||||
|
{"Every 8 hours", 8 * 60 * 60 },
|
||||||
|
{"Every 24 hours", 24 * 60 * 60 },
|
||||||
|
{"Never", 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int32 kCaptureRatesCount = sizeof(kCaptureRates) / sizeof(capture_rate);
|
||||||
|
|
||||||
|
|
||||||
|
const char* kUploadClients[] = {
|
||||||
// NOTE: These are translated once the app catalog is loaded.
|
// NOTE: These are translated once the app catalog is loaded.
|
||||||
"FTP",
|
"FTP",
|
||||||
"SFTP",
|
"SFTP",
|
||||||
"Local",
|
"Local"
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int32 kUploadClientsCount = sizeof(kUploadClients) / sizeof(char*);
|
||||||
|
|
||||||
|
|
||||||
class CodyCam : public BApplication {
|
class CodyCam : public BApplication {
|
||||||
public:
|
public:
|
||||||
CodyCam();
|
CodyCam();
|
||||||
@@ -129,7 +127,7 @@ public:
|
|||||||
BStringView* StatusLine();
|
BStringView* StatusLine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _BuildCaptureControls(BView* theView);
|
void _BuildCaptureControls();
|
||||||
|
|
||||||
void _SetUpSettings(const char* filename,
|
void _SetUpSettings(const char* filename,
|
||||||
const char* dirname);
|
const char* dirname);
|
||||||
@@ -140,7 +138,6 @@ private:
|
|||||||
media_node* fProducer;
|
media_node* fProducer;
|
||||||
port_id* fPortPtr;
|
port_id* fPortPtr;
|
||||||
|
|
||||||
BView* fView;
|
|
||||||
BView* fVideoView;
|
BView* fVideoView;
|
||||||
|
|
||||||
BTextControl* fFileName;
|
BTextControl* fFileName;
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
Settings* settings = NULL;
|
Settings* settings = NULL;
|
||||||
|
|
||||||
|
|
||||||
StringValueSetting::StringValueSetting(const char* name, const char* defaultValue,
|
StringValueSetting::StringValueSetting(const char* name,
|
||||||
const char* valueExpectedErrorString, const char* wrongValueErrorString)
|
const char* defaultValue, const char* valueExpectedErrorString,
|
||||||
: SettingsArgvDispatcher(name),
|
const char* wrongValueErrorString)
|
||||||
|
:
|
||||||
|
SettingsArgvDispatcher(name),
|
||||||
fDefaultValue(defaultValue),
|
fDefaultValue(defaultValue),
|
||||||
fValueExpectedErrorString(valueExpectedErrorString),
|
fValueExpectedErrorString(valueExpectedErrorString),
|
||||||
fWrongValueErrorString(wrongValueErrorString),
|
fWrongValueErrorString(wrongValueErrorString),
|
||||||
@@ -55,7 +57,7 @@ StringValueSetting::Value() const
|
|||||||
void
|
void
|
||||||
StringValueSetting::SaveSettingValue(Settings* settings)
|
StringValueSetting::SaveSettingValue(Settings* settings)
|
||||||
{
|
{
|
||||||
printf("-------StringValueSetting::SaveSettingValue %s %s\n", Name(), fValue);
|
printf("-----StringValueSetting::SaveSettingValue %s %s\n", Name(), fValue);
|
||||||
settings->Write("\"%s\"", fValue);
|
settings->Write("\"%s\"", fValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,11 +85,13 @@ StringValueSetting::Handle(const char *const *argv)
|
|||||||
|
|
||||||
|
|
||||||
EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name,
|
EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name,
|
||||||
const char* defaultValue, const char *const *values,
|
const char* defaultValue, StringEnumerator enumerator,
|
||||||
const char* valueExpectedErrorString,
|
const char* valueExpectedErrorString,
|
||||||
const char* wrongValueErrorString)
|
const char* wrongValueErrorString)
|
||||||
: StringValueSetting(name, defaultValue, valueExpectedErrorString, wrongValueErrorString),
|
:
|
||||||
fValues(values)
|
StringValueSetting(name, defaultValue, valueExpectedErrorString,
|
||||||
|
wrongValueErrorString),
|
||||||
|
fEnumerator(enumerator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,16 +101,7 @@ EnumeratedStringValueSetting::ValueChanged(const char* newValue)
|
|||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// must be one of the enumerated values
|
// must be one of the enumerated values
|
||||||
bool found = false;
|
ASSERT(_ValidateString(newValue));
|
||||||
for (int32 index = 0; ; index++) {
|
|
||||||
if (!fValues[index])
|
|
||||||
break;
|
|
||||||
if (strcmp(fValues[index], newValue) != 0)
|
|
||||||
continue;
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ASSERT(found);
|
|
||||||
#endif
|
#endif
|
||||||
StringValueSetting::ValueChanged(newValue);
|
StringValueSetting::ValueChanged(newValue);
|
||||||
}
|
}
|
||||||
@@ -118,18 +113,8 @@ EnumeratedStringValueSetting::Handle(const char *const *argv)
|
|||||||
if (!*++argv)
|
if (!*++argv)
|
||||||
return fValueExpectedErrorString;
|
return fValueExpectedErrorString;
|
||||||
|
|
||||||
printf("-----EnumeratedStringValueSetting::Handle %s %s\n", *(argv-1), *argv);
|
printf("---EnumeratedStringValueSetting::Handle %s %s\n", *(argv-1), *argv);
|
||||||
bool found = false;
|
if (!_ValidateString(*argv))
|
||||||
for (int32 index = 0; ; index++) {
|
|
||||||
if (!fValues[index])
|
|
||||||
break;
|
|
||||||
if (strcmp(fValues[index], *argv) != 0)
|
|
||||||
continue;
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
return fWrongValueErrorString;
|
return fWrongValueErrorString;
|
||||||
|
|
||||||
ValueChanged(*argv);
|
ValueChanged(*argv);
|
||||||
@@ -137,6 +122,20 @@ EnumeratedStringValueSetting::Handle(const char *const *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
EnumeratedStringValueSetting::_ValidateString(const char* string)
|
||||||
|
{
|
||||||
|
for (int32 i = 0;; i++) {
|
||||||
|
const char* enumString = fEnumerator(i);
|
||||||
|
if (!enumString)
|
||||||
|
return false;
|
||||||
|
if (strcmp(enumString, string) == 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+59
-49
@@ -9,80 +9,90 @@ void QuitSettings();
|
|||||||
class StringValueSetting : public SettingsArgvDispatcher {
|
class StringValueSetting : public SettingsArgvDispatcher {
|
||||||
// simple string setting
|
// simple string setting
|
||||||
public:
|
public:
|
||||||
StringValueSetting(const char* name, const char* defaultValue,
|
StringValueSetting(const char* name,
|
||||||
const char* valueExpectedErrorString,
|
const char* defaultValue,
|
||||||
const char* wrongValueErrorString);
|
const char* valueExpectedErrorString,
|
||||||
|
const char* wrongValueErrorString = "");
|
||||||
|
|
||||||
virtual ~StringValueSetting();
|
virtual ~StringValueSetting();
|
||||||
|
|
||||||
void ValueChanged(const char* newValue);
|
void ValueChanged(const char* newValue);
|
||||||
const char* Value() const;
|
const char* Value() const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings*);
|
virtual void SaveSettingValue(Settings*);
|
||||||
virtual bool NeedsSaving() const;
|
virtual bool NeedsSaving() const;
|
||||||
|
|
||||||
const char* fDefaultValue;
|
const char* fDefaultValue;
|
||||||
const char* fValueExpectedErrorString;
|
const char* fValueExpectedErrorString;
|
||||||
const char* fWrongValueErrorString;
|
const char* fWrongValueErrorString;
|
||||||
char* fValue;
|
char* fValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// string setting, values that do not match string enumeration
|
||||||
|
// are rejected
|
||||||
class EnumeratedStringValueSetting : public StringValueSetting {
|
class EnumeratedStringValueSetting : public StringValueSetting {
|
||||||
// string setting, values that do not match string enumeration
|
public:
|
||||||
// are rejected
|
// A pointer to a function returning a string for an index, or NULL
|
||||||
public:
|
// if the index is out of bounds.
|
||||||
EnumeratedStringValueSetting(const char* name, const char* defaultValue,
|
typedef const char* (*StringEnumerator)(int32);
|
||||||
const char *const *values, const char* valueExpectedErrorString,
|
|
||||||
const char* wrongValueErrorString);
|
|
||||||
|
|
||||||
void ValueChanged(const char* newValue);
|
EnumeratedStringValueSetting(const char* name,
|
||||||
virtual const char* Handle(const char *const *argv);
|
const char* defaultValue,
|
||||||
|
StringEnumerator enumerator,
|
||||||
|
const char* valueExpectedErrorString,
|
||||||
|
const char* wrongValueErrorString);
|
||||||
|
|
||||||
protected:
|
void ValueChanged(const char* newValue);
|
||||||
const char *const *fValues;
|
virtual const char* Handle(const char *const *argv);
|
||||||
char* fValue;
|
|
||||||
|
private:
|
||||||
|
bool _ValidateString(const char* string);
|
||||||
|
StringEnumerator fEnumerator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// simple int32 setting
|
||||||
class ScalarValueSetting : public SettingsArgvDispatcher {
|
class ScalarValueSetting : public SettingsArgvDispatcher {
|
||||||
// simple int32 setting
|
|
||||||
public:
|
public:
|
||||||
ScalarValueSetting(const char* name, int32 defaultValue,
|
ScalarValueSetting(const char* name,
|
||||||
const char* valueExpectedErrorString, const char* wrongValueErrorString,
|
int32 defaultValue,
|
||||||
int32 min = LONG_MIN, int32 max = LONG_MAX);
|
const char* valueExpectedErrorString,
|
||||||
virtual ~ScalarValueSetting();
|
const char* wrongValueErrorString,
|
||||||
|
int32 min = LONG_MIN, int32 max = LONG_MAX);
|
||||||
|
virtual ~ScalarValueSetting();
|
||||||
|
|
||||||
void ValueChanged(int32 newValue);
|
void ValueChanged(int32 newValue);
|
||||||
int32 Value() const;
|
int32 Value() const;
|
||||||
void GetValueAsString(char*) const;
|
void GetValueAsString(char*) const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings*);
|
virtual void SaveSettingValue(Settings*);
|
||||||
virtual bool NeedsSaving() const;
|
virtual bool NeedsSaving() const;
|
||||||
|
|
||||||
int32 fDefaultValue;
|
int32 fDefaultValue;
|
||||||
int32 fValue;
|
int32 fValue;
|
||||||
int32 fMax;
|
int32 fMax;
|
||||||
int32 fMin;
|
int32 fMin;
|
||||||
const char* fValueExpectedErrorString;
|
const char* fValueExpectedErrorString;
|
||||||
const char* fWrongValueErrorString;
|
const char* fWrongValueErrorString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BooleanValueSetting : public ScalarValueSetting {
|
class BooleanValueSetting : public ScalarValueSetting {
|
||||||
// on-off setting
|
public:
|
||||||
public:
|
BooleanValueSetting(const char* name,
|
||||||
BooleanValueSetting(const char* name, bool defaultValue);
|
bool defaultValue);
|
||||||
virtual ~BooleanValueSetting();
|
virtual ~BooleanValueSetting();
|
||||||
|
|
||||||
bool Value() const;
|
bool Value() const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings *);
|
virtual void SaveSettingValue(Settings *);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user