-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 88a474d..bb46dd7 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -27,2 +27,5 @@ | |||
27 | #include <qfileinfo.h> | 27 | #include <qfileinfo.h> |
28 | #include <qlabel.h> | ||
29 | #include <qlayout.h> | ||
30 | #include <qlineedit.h> | ||
28 | #include <qiconset.h> | 31 | #include <qiconset.h> |
@@ -31,2 +34,3 @@ | |||
31 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | ||
32 | #include <qstatusbar.h> | 36 | #include <qstatusbar.h> |
@@ -89,4 +93,4 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
89 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); | 93 | uploadButton->setIconSet( Resource::loadIconSet( "up" ) ); |
90 | //uploadButton->setEnabled( false ); | 94 | uploadButton->setEnabled( false ); |
91 | uploadButton->setEnabled( true ); | 95 | //uploadButton->setEnabled( true ); // DEBUGGING |
92 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); | 96 | connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) ); |
@@ -378,2 +382,34 @@ void WellenreiterMainWindow::uploadSession() | |||
378 | { | 382 | { |
383 | QLineEdit* from; | ||
384 | QLineEdit* location; | ||
385 | QLineEdit* comments; | ||
386 | QPushButton* accept; | ||
387 | QPushButton* reject; | ||
388 | |||
389 | QDialog* d = new QDialog( 0, "session upload", true ); | ||
390 | d->setCaption( tr( "Upload Session" ) ); | ||
391 | QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); | ||
392 | g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); | ||
393 | g->addWidget( from = new QLineEdit( d ), 0, 1 ); | ||
394 | g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); | ||
395 | g->addWidget( location = new QLineEdit( d ), 1, 1 ); | ||
396 | g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); | ||
397 | g->addWidget( comments = new QLineEdit( d ), 2, 1 ); | ||
398 | g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); | ||
399 | g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); | ||
400 | accept->setDefault( true ); | ||
401 | accept->setAutoDefault( true ); | ||
402 | from->setText( "WL II User" ); | ||
403 | location->setText( "WL II Location" ); | ||
404 | comments->setText( "No Comments." ); | ||
405 | connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); | ||
406 | connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); | ||
407 | int result = d->exec(); | ||
408 | |||
409 | if ( !result ) | ||
410 | { | ||
411 | qDebug( "Session upload cancelled :(" ); | ||
412 | return; | ||
413 | } | ||
414 | |||
379 | qDebug( "Starting upload..." ); | 415 | qDebug( "Starting upload..." ); |
@@ -390,3 +426,3 @@ void WellenreiterMainWindow::uploadSession() | |||
390 | { | 426 | { |
391 | qDebug( "no file to upload!" ); | 427 | QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile doesn't exist</p>") ); |
392 | return; | 428 | return; |
@@ -397,3 +433,3 @@ void WellenreiterMainWindow::uploadSession() | |||
397 | { | 433 | { |
398 | qDebug( "can't open file!" ); | 434 | QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile</p>") ); |
399 | return; | 435 | return; |
@@ -437,3 +473,3 @@ void WellenreiterMainWindow::uploadSession() | |||
437 | "\r\n" | 473 | "\r\n" |
438 | "Anonymous Wellenreiter II User\r\n" | 474 | "%1\r\n" |
439 | "-----------------------------97267758015830030481215568065\r\n" | 475 | "-----------------------------97267758015830030481215568065\r\n" |
@@ -441,3 +477,3 @@ void WellenreiterMainWindow::uploadSession() | |||
441 | "\r\n" | 477 | "\r\n" |
442 | "Anonymous Wellenreiter II Location\r\n" | 478 | "%2\r\n" |
443 | "-----------------------------97267758015830030481215568065\r\n" | 479 | "-----------------------------97267758015830030481215568065\r\n" |
@@ -445,3 +481,3 @@ void WellenreiterMainWindow::uploadSession() | |||
445 | "\r\n" | 481 | "\r\n" |
446 | "Anonymous Wellenreiter II Comments\r\n" | 482 | "%3\r\n" |
447 | "-----------------------------97267758015830030481215568065\r\n" | 483 | "-----------------------------97267758015830030481215568065\r\n" |
@@ -454,2 +490,6 @@ void WellenreiterMainWindow::uploadSession() | |||
454 | 490 | ||
491 | content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() ); | ||
492 | content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() ); | ||
493 | content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() ); | ||
494 | |||
455 | header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); | 495 | header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); |
@@ -491,5 +531,7 @@ void WellenreiterMainWindow::uploadSession() | |||
491 | if ( ok ) | 531 | if ( ok ) |
492 | QMessageBox::information ( 0, tr( "Success" ), QString ( "<p>%1</p>" ). arg( tr( "Capture Dump was uploaded to %1" )).arg ( CAP_hostname )); | 532 | QMessageBox::information( 0, tr( "Success" ), |
533 | QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); | ||
493 | else | 534 | else |
494 | QMessageBox::warning ( 0, tr( "Error" ), QString ( "<p>%1</p>" ). arg ( tr( "Connection to %1 failed." )). arg ( CAP_hostname )); | 535 | QMessageBox::warning( 0, tr( "Error" ), |
536 | QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); | ||
495 | } | 537 | } |