Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/raw-rev/c323f5d5d6a9
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:19:30 2012
Кодировка:

# HG changeset patch
# User boris
# Date 1284496101 -14400
# Node ID c323f5d5d6a94fc829f4a3479f0390aadf9eb1c4
# Parent 9cbace0709fcd6951a5a5cf5aecf08ecb9c39e5d
compiled
comment connect lines

diff -r 9cbace0709fc -r c323f5d5d6a9 blocks3d-wt-widget.C
--- a/blocks3d-wt-widget.C Wed Sep 15 00:05:57 2010 +0400
+++ b/blocks3d-wt-widget.C Wed Sep 15 00:28:21 2010 +0400
@@ -11,10 +11,10 @@
#include

#include
+#include

-
-Blocks3DWidget::Blocks3DWidget(WContainerWidget *parent) :
- WContainerWidget(parent)
+Blocks3DWidget::Blocks3DWidget(Wt::WContainerWidget *parent) :
+ Wt::WContainerWidget(parent)
{
alignment_upload = new Wt::WFileUpload();
alignment_textarea = new Wt::WTextArea();
@@ -35,30 +35,30 @@
table->elementAt(2, 1)->addWidget(conformity_upload);

new Wt::WBreak(this);
- delta_input = new Wt::WLineEdit(Malakite::default::delta, this);
- Wt::WDoubleValidator *delta_validator = new Wt::WDoubleValidator(0.0, 10.0);
+ delta_input = new Wt::WLineEdit(Malakite::defaults::delta, this);
+ delta_validator = new Wt::WDoubleValidator(0.0, 10.0);
delta_input->setValidator(delta_validator);
Wt::WLabel *delta_label = new Wt::WLabel("Distance spreading", this);
delta_label->setBuddy(delta_input);

new Wt::WBreak(this);
- min_block_width_input = new Wt::WLineEdit(Malakite::default::min_block_width, this);
- Wt::WIntValidator *min_block_width_validator = new Wt::WIntValidator(3, 9999);
+ min_block_width_input = new Wt::WLineEdit(Malakite::defaults::min_block_width, this);
+ min_block_width_validator = new Wt::WIntValidator(3, 9999);
min_block_width_input->setValidator(min_block_width_validator);
Wt::WLabel *min_block_width_label = new Wt::WLabel("Min block width", this);
min_block_width_label->setBuddy(min_block_width_input);

new Wt::WBreak(this);
- timeout_input = new Wt::WLineEdit(Malakite::default::timeout, this);
- Wt::WIntValidator *timeout_validator = new Wt::WIntValidator(-1, 30*24*3600);
+ timeout_input = new Wt::WLineEdit(Malakite::defaults::timeout, this);
+ timeout_validator = new Wt::WIntValidator(-1, 30*24*3600);
timeout_input->setValidator(timeout_validator);
Wt::WLabel *timeout_label = new Wt::WLabel(
"Bron-Kerbosh (couple cores) timeout", this);
timeout_label->setBuddy(timeout_input);

new Wt::WBreak(this);
- timeout2_input = new Wt::WLineEdit(Malakite::default::timeout2, this);
- Wt::WIntValidator *timeout2_validator = new Wt::WIntValidator(-1, 30*24*3600);
+ timeout2_input = new Wt::WLineEdit(Malakite::defaults::timeout2, this);
+ timeout2_validator = new Wt::WIntValidator(-1, 30*24*3600);
timeout2_input->setValidator(timeout2_validator);
Wt::WLabel *timeout2_label = new Wt::WLabel(
"Bron-Kerbosh (blocks) timeout", this);
@@ -67,14 +67,14 @@

new Wt::WBreak(this);
Wt::WPushButton *go_button = new Wt::WPushButton("Run", this);
- go_button->clicked().connect(go_button, &Blocks3DWidget::go_button_click);
- //~ go_button->clicked().connect(go_button, &Wt::WPushButton::disable);
- go_button->clicked().connect(alignment_upload, Wt::WFileUpload::upload);
- go_button->clicked().connect(conformity_upload, Wt::WFileUpload::upload);
- alignment_upload->uploaded().connect(this, &Blocks3DWidget::alignment_uploaded);
- conformity_upload->uploaded().connect(this, &Blocks3DWidget::conformity_uploaded);
- alignment_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
- conformity_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
+ //go_button->clicked().connect(go_button, &Blocks3DWidget::go_button_click);
+ ////~ go_button->clicked().connect(go_button, &Wt::WPushButton::disable);
+ //go_button->clicked().connect(alignment_upload, &Wt::WFileUpload::upload);
+ //go_button->clicked().connect(conformity_upload, &Wt::WFileUpload::upload);
+ //alignment_upload->uploaded().connect(this, &Blocks3DWidget::alignment_uploaded);
+ //conformity_upload->uploaded().connect(this, &Blocks3DWidget::conformity_uploaded);
+ //alignment_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);
+ //conformity_upload->fileTooLarge().connect(this, &Blocks3DWidget::fileTooLarge);


}
@@ -88,10 +88,10 @@
{
std::string temp("");
std::string total("");
- ifstream uploaded_file;
+ std::ifstream uploaded_file;

uploaded_file.open(file);
- if (!inFile)
+ if (!uploaded_file)
{
return;
}
@@ -106,41 +106,39 @@

void Blocks3DWidget::alignment_uploaded()
{
- textarea_from_file(alignment_textarea, alignment_upload->spoolFileName());
+ textarea_from_file(alignment_textarea,
+ boost::lexical_cast(alignment_upload->spoolFileName()));
try_to_run();
}

void Blocks3DWidget::conformity_uploaded()
{
- textarea_from_file(conformity_textarea, conformity_upload->spoolFileName());
+ textarea_from_file(conformity_textarea,
+ boost::lexical_cast(conformity_upload->spoolFileName()));
try_to_run();
}

void Blocks3DWidget::try_to_run()
{
- std::string alignment = conformity_textarea->text();
- std::string conformity = conformity_textarea->text();
- if (!alignment || !conformity)
+ std::string alignment = conformity_textarea->text().toUTF8();
+ std::string conformity = conformity_textarea->text().toUTF8();
+ if (alignment.empty() || conformity.empty())
{
return;
}
- if (delta_validator->validate() != Wt::WValidator::Valid)
+ if (delta_input->validate() != Wt::WValidator::Valid)
{
return;
}
- if (min_block_width_validator->validate() != Wt::WValidator::Valid)
+ if (min_block_width_input->validate() != Wt::WValidator::Valid)
{
return;
}
- if (min_block_width_validator->validate() != Wt::WValidator::Valid)
+ if (timeout_input->validate() != Wt::WValidator::Valid)
{
return;
}
- if (timeout_validator->validate() != Wt::WValidator::Valid)
- {
- return;
- }
- if (timeout2_validator->validate() != Wt::WValidator::Valid)
+ if (timeout2_input->validate() != Wt::WValidator::Valid)
{
return;
}
diff -r 9cbace0709fc -r c323f5d5d6a9 blocks3d-wt-widget.h
--- a/blocks3d-wt-widget.h Wed Sep 15 00:05:57 2010 +0400
+++ b/blocks3d-wt-widget.h Wed Sep 15 00:28:21 2010 +0400
@@ -2,7 +2,6 @@
#include "config.h"
#include

-#include
#include
#include
#include
@@ -17,10 +16,10 @@

#include

-class Blocks3DWidget : public WContainerWidget
+class Blocks3DWidget : public Wt::WContainerWidget
{
public:
- Blocks3DWidget(WContainerWidget *parent=0);
+ Blocks3DWidget(Wt::WContainerWidget *parent=0);
private:
Wt::WFileUpload* alignment_upload;
Wt::WTextArea* alignment_textarea;
@@ -32,6 +31,11 @@
Wt::WLineEdit* timeout_input;
Wt::WLineEdit* timeout2_input;

+ Wt::WDoubleValidator *delta_validator;
+ Wt::WIntValidator *min_block_width_validator;
+ Wt::WIntValidator *timeout_validator;
+ Wt::WIntValidator *timeout2_validator;
+
void textarea_from_file(Wt::WTextArea* ta, char* file);
void go_button_click();
void alignment_uploaded();
diff -r 9cbace0709fc -r c323f5d5d6a9 blocks3d-wt.C
--- a/blocks3d-wt.C Wed Sep 15 00:05:57 2010 +0400
+++ b/blocks3d-wt.C Wed Sep 15 00:28:21 2010 +0400
@@ -7,37 +7,37 @@
#include


-class Blocks3DApplication : public WApplication
+class Blocks3DApplication : public Wt::WApplication
{
public:
- Blocks3DApplication(const WEnvironment& env);
+ Blocks3DApplication(const Wt::WEnvironment& env);
private:
Blocks3DWidget* blocks3d_widget;
};

-Blocks3DApplication::Blocks3DApplication(const WEnvironment& env) :
- WApplication(env)
+Blocks3DApplication::Blocks3DApplication(const Wt::WEnvironment& env) :
+ Wt::WApplication(env)
{
- blocks3d_widget = new Blocks3DWidget(this);
+ blocks3d_widget = new Blocks3DWidget(root());
}




-Blocks3DApplication* createApplication(const WEnvironment& env)
+Wt::WApplication* createApplication(const Wt::WEnvironment& env)
{
return new Blocks3DApplication(env);
}

int main(int argc, char **argv)
{
- WServer server(argv[0]);
+ Wt::WServer server(argv[0]);
server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);

- server.addEntryPoint(Application, createApplication, Malakite::main_url);
+ server.addEntryPoint(Wt::Application, createApplication, Malakite::main_url);

if (server.start()) {
- WServer::waitForShutdown();
+ Wt::WServer::waitForShutdown();
server.stop();
}
}
diff -r 9cbace0709fc -r c323f5d5d6a9 config.C
--- a/config.C Wed Sep 15 00:05:57 2010 +0400
+++ b/config.C Wed Sep 15 00:28:21 2010 +0400
@@ -12,11 +12,11 @@
const char* main_url = "/";


-namespace default
+namespace defaults
{

const char* delta = "2.0";
-const char* min_block_width_input = "3";
+const char* min_block_width = "3";
const char* timeout = "10";
const char* timeout2 = "10";

diff -r 9cbace0709fc -r c323f5d5d6a9 config.h
--- a/config.h Wed Sep 15 00:05:57 2010 +0400
+++ b/config.h Wed Sep 15 00:28:21 2010 +0400
@@ -9,12 +9,14 @@

extern const char* main_url;

-namespace default
+namespace defaults
{

extern const char* delta;
-extern const char* min_block_width_input;
+extern const char* min_block_width;
extern const char* timeout;
extern const char* timeout2;

}
+
+}