* fix probable memory leaks, not in the image but anyway...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27850 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
* Started: 4/27/2004
|
* Started: 4/27/2004
|
||||||
* Version: 0.1
|
* Version: 0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
@@ -17,59 +17,61 @@
|
|||||||
|
|
||||||
|
|
||||||
PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
||||||
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
|
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
|
||||||
|
webDirFilePanel(NULL),
|
||||||
|
logFilePanel(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
frame = Bounds();
|
frame = Bounds();
|
||||||
|
|
||||||
prefView = new PoorManView(frame, STR_WIN_NAME_PREF);
|
prefView = new PoorManView(frame, STR_WIN_NAME_PREF);
|
||||||
//prefView->SetViewColor(216,216,216,255);
|
//prefView->SetViewColor(216,216,216,255);
|
||||||
prefView->SetViewColor(BACKGROUND_COLOR);
|
prefView->SetViewColor(BACKGROUND_COLOR);
|
||||||
AddChild(prefView);
|
AddChild(prefView);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Button View
|
// Button View
|
||||||
BRect buttonRect;
|
BRect buttonRect;
|
||||||
buttonRect = Bounds();
|
buttonRect = Bounds();
|
||||||
buttonRect.top = buttonRect.bottom - 30;
|
buttonRect.top = buttonRect.bottom - 30;
|
||||||
|
|
||||||
buttonView = new PoorManView(buttonRect, "Button View");
|
buttonView = new PoorManView(buttonRect, "Button View");
|
||||||
buttonView->SetViewColor(BACKGROUND_COLOR);
|
buttonView->SetViewColor(BACKGROUND_COLOR);
|
||||||
prefView->AddChild(buttonView);
|
prefView->AddChild(buttonView);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
float buttonTop = 0.0f;
|
float buttonTop = 0.0f;
|
||||||
float buttonWidth = 52.0f;
|
float buttonWidth = 52.0f;
|
||||||
float buttonHeight = 26.0f;
|
float buttonHeight = 26.0f;
|
||||||
float buttonLeft = 265.0f;
|
float buttonLeft = 265.0f;
|
||||||
|
|
||||||
BRect button1;
|
BRect button1;
|
||||||
button1 = buttonView->Bounds();
|
button1 = buttonView->Bounds();
|
||||||
button1.Set(buttonLeft, buttonTop, buttonLeft + buttonWidth, buttonTop + buttonHeight);
|
button1.Set(buttonLeft, buttonTop, buttonLeft + buttonWidth, buttonTop + buttonHeight);
|
||||||
cancelButton = new BButton(button1, "Cancel Button", "Cancel", new BMessage(MSG_PREF_BTN_CANCEL));
|
cancelButton = new BButton(button1, "Cancel Button", "Cancel", new BMessage(MSG_PREF_BTN_CANCEL));
|
||||||
|
|
||||||
buttonLeft = 325.0f;
|
buttonLeft = 325.0f;
|
||||||
BRect button2;
|
BRect button2;
|
||||||
button2 = buttonView->Bounds();
|
button2 = buttonView->Bounds();
|
||||||
button2.Set(buttonLeft, buttonTop, buttonLeft + buttonWidth, buttonTop + buttonHeight);
|
button2.Set(buttonLeft, buttonTop, buttonLeft + buttonWidth, buttonTop + buttonHeight);
|
||||||
doneButton = new BButton(button2, "Done Button", "Done", new BMessage(MSG_PREF_BTN_DONE));
|
doneButton = new BButton(button2, "Done Button", "Done", new BMessage(MSG_PREF_BTN_DONE));
|
||||||
|
|
||||||
|
buttonView->AddChild(cancelButton);
|
||||||
|
buttonView->AddChild(doneButton);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
buttonView->AddChild(cancelButton);
|
|
||||||
buttonView->AddChild(doneButton);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create tabs
|
// Create tabs
|
||||||
BRect r;
|
BRect r;
|
||||||
r = Bounds();
|
r = Bounds();
|
||||||
//r.InsetBy(5, 5);
|
//r.InsetBy(5, 5);
|
||||||
r.top += 8.0;
|
r.top += 8.0;
|
||||||
r.bottom -= 38.0;
|
r.bottom -= 38.0;
|
||||||
|
|
||||||
prefTabView = new BTabView(r, "Pref Tab View");
|
prefTabView = new BTabView(r, "Pref Tab View");
|
||||||
prefTabView->SetViewColor(BACKGROUND_COLOR);
|
prefTabView->SetViewColor(BACKGROUND_COLOR);
|
||||||
|
|
||||||
r = prefTabView->Bounds();
|
r = prefTabView->Bounds();
|
||||||
r.InsetBy(5, 5);
|
r.InsetBy(5, 5);
|
||||||
r.bottom -= prefTabView->TabHeight();
|
r.bottom -= prefTabView->TabHeight();
|
||||||
@@ -79,63 +81,61 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
|||||||
siteView = new PoorManSiteView(r, "Site View");
|
siteView = new PoorManSiteView(r, "Site View");
|
||||||
prefTabView->AddTab(siteView, siteTab);
|
prefTabView->AddTab(siteView, siteTab);
|
||||||
siteTab->SetLabel(STR_TAB_SITE);
|
siteTab->SetLabel(STR_TAB_SITE);
|
||||||
|
|
||||||
// Logging Tab
|
// Logging Tab
|
||||||
loggingTab = new BTab();
|
loggingTab = new BTab();
|
||||||
loggingView = new PoorManLoggingView(r, "Logging View");
|
loggingView = new PoorManLoggingView(r, "Logging View");
|
||||||
prefTabView->AddTab(loggingView, loggingTab);
|
prefTabView->AddTab(loggingView, loggingTab);
|
||||||
loggingTab->SetLabel(STR_TAB_LOGGING);
|
loggingTab->SetLabel(STR_TAB_LOGGING);
|
||||||
|
|
||||||
// Advanced Tab
|
// Advanced Tab
|
||||||
advancedTab = new BTab();
|
advancedTab = new BTab();
|
||||||
advancedView = new PoorManAdvancedView(r, "Advanced View");
|
advancedView = new PoorManAdvancedView(r, "Advanced View");
|
||||||
prefTabView->AddTab(advancedView, advancedTab);
|
prefTabView->AddTab(advancedView, advancedTab);
|
||||||
advancedTab->SetLabel(STR_TAB_ADVANCED);
|
advancedTab->SetLabel(STR_TAB_ADVANCED);
|
||||||
|
|
||||||
prefView->AddChild(prefTabView);
|
prefView->AddChild(prefTabView);
|
||||||
|
|
||||||
// FilePanels
|
// FilePanels
|
||||||
BWindow * change_title;
|
BWindow * change_title;
|
||||||
|
|
||||||
webDirFilePanel = new BFilePanel(
|
BMessenger messenger(this);
|
||||||
B_OPEN_PANEL,
|
BMessage message(MSG_FILE_PANEL_SELECT_WEB_DIR);
|
||||||
new BMessenger(this),
|
webDirFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger, NULL,
|
||||||
NULL,
|
B_DIRECTORY_NODE, false, &message);
|
||||||
B_DIRECTORY_NODE,
|
|
||||||
false,
|
|
||||||
new BMessage(MSG_FILE_PANEL_SELECT_WEB_DIR)
|
|
||||||
);
|
|
||||||
webDirFilePanel->SetPanelDirectory(new BDirectory("/boot/home/public_html"));
|
webDirFilePanel->SetPanelDirectory(new BDirectory("/boot/home/public_html"));
|
||||||
webDirFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
webDirFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
change_title = webDirFilePanel->Window();
|
change_title = webDirFilePanel->Window();
|
||||||
change_title->SetTitle(STR_FILEPANEL_SELECT_WEB_DIR);
|
change_title->SetTitle(STR_FILEPANEL_SELECT_WEB_DIR);
|
||||||
|
|
||||||
|
message.what = MSG_FILE_PANEL_CREATE_LOG_FILE;
|
||||||
logFilePanel = new BFilePanel(
|
logFilePanel = new BFilePanel(B_SAVE_PANEL, &messenger, NULL,
|
||||||
B_SAVE_PANEL,
|
B_FILE_NODE, false, &message);
|
||||||
new BMessenger(this),
|
|
||||||
NULL,
|
|
||||||
B_FILE_NODE,
|
|
||||||
false,
|
|
||||||
new BMessage(MSG_FILE_PANEL_CREATE_LOG_FILE)
|
|
||||||
);
|
|
||||||
logFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Create");
|
logFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Create");
|
||||||
change_title = logFilePanel->Window();
|
change_title = logFilePanel->Window();
|
||||||
change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE);
|
change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE);
|
||||||
|
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
|
PoorManPreferencesWindow::~PoorManPreferencesWindow()
|
||||||
|
{
|
||||||
|
delete logFilePanel;
|
||||||
|
delete webDirFilePanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case MSG_PREF_BTN_DONE:
|
case MSG_PREF_BTN_DONE:
|
||||||
PoorManWindow * win;
|
PoorManWindow * win;
|
||||||
win = ((PoorManApplication *)be_app)->GetPoorManWindow();
|
win = ((PoorManApplication *)be_app)->GetPoorManWindow();
|
||||||
|
|
||||||
std::cout << "Pref Window: sendDir CheckBox: " << siteView->SendDirValue() << std::endl;
|
std::cout << "Pref Window: sendDir CheckBox: " << siteView->SendDirValue() << std::endl;
|
||||||
win->SetDirListFlag(siteView->SendDirValue());
|
win->SetDirListFlag(siteView->SendDirValue());
|
||||||
std::cout << "Pref Window: indexFileName TextControl: " << siteView->IndexFileName() << std::endl;
|
std::cout << "Pref Window: indexFileName TextControl: " << siteView->IndexFileName() << std::endl;
|
||||||
@@ -150,10 +150,10 @@ PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
|||||||
win->SetLogFileFlag(loggingView->LogFileValue());
|
win->SetLogFileFlag(loggingView->LogFileValue());
|
||||||
std::cout << "Pref Window: logFileName: " << loggingView->LogFileName() << std::endl;
|
std::cout << "Pref Window: logFileName: " << loggingView->LogFileName() << std::endl;
|
||||||
win->SetLogPath(loggingView->LogFileName());
|
win->SetLogPath(loggingView->LogFileName());
|
||||||
|
|
||||||
std::cout << "Pref Window: MaxConnections Slider: " << advancedView->MaxSimultaneousConnections() << std::endl;
|
std::cout << "Pref Window: MaxConnections Slider: " << advancedView->MaxSimultaneousConnections() << std::endl;
|
||||||
win->SetMaxConnections(advancedView->MaxSimultaneousConnections());
|
win->SetMaxConnections(advancedView->MaxSimultaneousConnections());
|
||||||
|
|
||||||
|
|
||||||
if (Lock())
|
if (Lock())
|
||||||
Quit();
|
Quit();
|
||||||
@@ -183,7 +183,7 @@ PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
case MSG_PREF_ADV_SLD_MAX_CONNECTION:
|
case MSG_PREF_ADV_SLD_MAX_CONNECTION:
|
||||||
max_connections = advancedView->MaxSimultaneousConnections();
|
max_connections = advancedView->MaxSimultaneousConnections();
|
||||||
std::cout << "Max Connections: " << max_connections << std::endl;
|
std::cout << "Max Connections: " << max_connections << std::endl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -192,15 +192,15 @@ PoorManPreferencesWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PoorManPreferencesWindow::SelectWebDir(BMessage * message)
|
PoorManPreferencesWindow::SelectWebDir(BMessage * message)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
const char * name;
|
const char * name;
|
||||||
BPath path;
|
BPath path;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
|
|
||||||
err = message->FindRef("refs", &ref) != B_OK;
|
err = message->FindRef("refs", &ref) != B_OK;
|
||||||
//if (err = message->FindRef("directory", &ref) != B_OK)
|
//if (err = message->FindRef("directory", &ref) != B_OK)
|
||||||
//return err;
|
//return err;
|
||||||
@@ -211,20 +211,20 @@ PoorManPreferencesWindow::SelectWebDir(BMessage * message)
|
|||||||
//if (err = entry.SetTo(&ref) != B_OK)
|
//if (err = entry.SetTo(&ref) != B_OK)
|
||||||
// ;//return err;
|
// ;//return err;
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
|
|
||||||
std::cout << "DIR: " << path.Path() << std::endl;
|
std::cout << "DIR: " << path.Path() << std::endl;
|
||||||
siteView->SetWebDir(path.Path());
|
siteView->SetWebDir(path.Path());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PoorManPreferencesWindow::CreateLogFile(BMessage * message)
|
PoorManPreferencesWindow::CreateLogFile(BMessage * message)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
const char * name;
|
const char * name;
|
||||||
BPath path;
|
BPath path;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
|
|
||||||
err = message->FindRef("directory", &ref) != B_OK;
|
err = message->FindRef("directory", &ref) != B_OK;
|
||||||
//if (err = message->FindRef("directory", &ref) != B_OK)
|
//if (err = message->FindRef("directory", &ref) != B_OK)
|
||||||
//return err;
|
//return err;
|
||||||
@@ -237,12 +237,12 @@ PoorManPreferencesWindow::CreateLogFile(BMessage * message)
|
|||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
path.Append(name);
|
path.Append(name);
|
||||||
std::cout << "Log File: " << path.Path() << std::endl;
|
std::cout << "Log File: " << path.Path() << std::endl;
|
||||||
|
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
{
|
{
|
||||||
loggingView->SetLogFileName(path.Path());
|
loggingView->SetLogFileName(path.Path());
|
||||||
loggingView->SetLogFileValue(true);
|
loggingView->SetLogFileValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark the checkbox
|
// mark the checkbox
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Started: 4/27/2004
|
* Started: 4/27/2004
|
||||||
* Version: 0.1
|
* Version: 0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef POOR_MAN_PREFERENCES_WINDOW_H
|
#ifndef POOR_MAN_PREFERENCES_WINDOW_H
|
||||||
#define POOR_MAN_PREFERENCES_WINDOW_H
|
#define POOR_MAN_PREFERENCES_WINDOW_H
|
||||||
@@ -30,7 +30,7 @@ private:
|
|||||||
|
|
||||||
PoorManView * prefView;
|
PoorManView * prefView;
|
||||||
PoorManView * buttonView;
|
PoorManView * buttonView;
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// Tabs
|
// Tabs
|
||||||
BTabView * prefTabView;
|
BTabView * prefTabView;
|
||||||
@@ -41,20 +41,20 @@ private:
|
|||||||
PoorManSiteView * siteView;
|
PoorManSiteView * siteView;
|
||||||
PoorManLoggingView * loggingView;
|
PoorManLoggingView * loggingView;
|
||||||
PoorManAdvancedView * advancedView;
|
PoorManAdvancedView * advancedView;
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// Buttons
|
// Buttons
|
||||||
BButton * cancelButton;
|
BButton * cancelButton;
|
||||||
BButton * doneButton;
|
BButton * doneButton;
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// FilePanels
|
// FilePanels
|
||||||
BFilePanel * webDirFilePanel;
|
BFilePanel * webDirFilePanel;
|
||||||
BFilePanel * logFilePanel;
|
BFilePanel * logFilePanel;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
// temporary preference variables used to save and
|
// temporary preference variables used to save and
|
||||||
// set the application to
|
// set the application to
|
||||||
// site tab
|
// site tab
|
||||||
char web_directory[B_FILE_NAME_LENGTH];
|
char web_directory[B_FILE_NAME_LENGTH];
|
||||||
@@ -68,8 +68,10 @@ private:
|
|||||||
int32 max_connections;
|
int32 max_connections;
|
||||||
public:
|
public:
|
||||||
PoorManPreferencesWindow(BRect frame, char * name);
|
PoorManPreferencesWindow(BRect frame, char * name);
|
||||||
|
~PoorManPreferencesWindow();
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage * message);
|
virtual void MessageReceived(BMessage * message);
|
||||||
|
|
||||||
void ShowWebDirFilePanel() { if (!webDirFilePanel->IsShowing()) webDirFilePanel->Show(); }
|
void ShowWebDirFilePanel() { if (!webDirFilePanel->IsShowing()) webDirFilePanel->Show(); }
|
||||||
void SelectWebDir(BMessage * message);
|
void SelectWebDir(BMessage * message);
|
||||||
void CreateLogFile(BMessage * message);
|
void CreateLogFile(BMessage * message);
|
||||||
|
|||||||
Reference in New Issue
Block a user