author | llornkcor <llornkcor> | 2002-10-17 02:04:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-17 02:04:40 (UTC) |
commit | 7176f02e8e8418020e0aa354795611620b564d81 (patch) (unidiff) | |
tree | 9f32debc92cd97809d5ca47ccbfd7f3b40d39c3a | |
parent | 368af870e525e853f44784e0fd402dca7337340a (diff) | |
download | opie-7176f02e8e8418020e0aa354795611620b564d81.zip opie-7176f02e8e8418020e0aa354795611620b564d81.tar.gz opie-7176f02e8e8418020e0aa354795611620b564d81.tar.bz2 |
widgets too big
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 172 |
1 files changed, 85 insertions, 87 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index bd0bb01..2b8ce7f 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -1,8 +1,8 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** formatter.cpp | 2 | ** formatter.cpp |
3 | ** | 3 | ** |
4 | ** Copyright: Thu Apr 11 11:01:13 2002 | 4 | ** Copyright: Thu Apr 11 11:01:13 2002 |
5 | ** by: L. J. Potter | 5 | ** by: L. J. Potter |
6 | ** | 6 | ** |
7 | ****************************************************************************/ | 7 | ****************************************************************************/ |
8 | 8 | ||
@@ -55,5 +55,5 @@ | |||
55 | /* | 55 | /* |
56 | Blah blah blah blah */ | 56 | Blah blah blah blah */ |
57 | FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl ) | 57 | FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl ) |
58 | : QMainWindow( parent, name, fl ) | 58 | : QMainWindow( parent, name, fl ) |
59 | // : QDialog( parent, name, modal, fl ) | 59 | // : QDialog( parent, name, modal, fl ) |
@@ -61,3 +61,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
61 | if ( !name ) | 61 | if ( !name ) |
62 | setName( "FormatterApp" ); | 62 | setName( "FormatterApp" ); |
63 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 63 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -73,8 +73,9 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
73 | tabLayout = new QGridLayout( tab ); | 73 | tabLayout = new QGridLayout( tab ); |
74 | tabLayout->setSpacing( 6); | 74 | tabLayout->setSpacing( 3); |
75 | tabLayout->setMargin( 11); | 75 | tabLayout->setMargin( 2); |
76 | 76 | ||
77 | storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); | 77 | storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); |
78 | storageComboBox->setMaximumWidth(220); | ||
78 | 79 | ||
79 | tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1 ); | 80 | tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 0 ); |
80 | 81 | ||
@@ -83,3 +84,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
83 | 84 | ||
84 | tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1 ); | 85 | tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 0 ); |
85 | 86 | ||
@@ -88,9 +89,10 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
88 | 89 | ||
89 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1 ); | 90 | tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 0 ); |
90 | 91 | ||
91 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); | 92 | fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); |
93 | fileSystemsCombo->setMaximumWidth(220); | ||
92 | 94 | ||
93 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1 ); | 95 | tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 0 ); |
94 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 96 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
95 | tabLayout->addItem( spacer, 2, 1 ); | 97 | tabLayout->addItem( spacer, 2, 0 ); |
96 | 98 | ||
@@ -98,5 +100,6 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
98 | formatPushButton->setText( tr( "Format" ) ); | 100 | formatPushButton->setText( tr( "Format" ) ); |
99 | 101 | formatPushButton->setMaximumWidth(170); | |
100 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1 ); | 102 | |
101 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 103 | tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 0 ); |
104 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | ||
102 | tabLayout->addItem( spacer_2, 5, 0 ); | 105 | tabLayout->addItem( spacer_2, 5, 0 ); |
@@ -106,4 +109,4 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
106 | tabLayout_2 = new QGridLayout( tab_2 ); | 109 | tabLayout_2 = new QGridLayout( tab_2 ); |
107 | tabLayout_2->setSpacing( 6); | 110 | tabLayout_2->setSpacing(3); |
108 | tabLayout_2->setMargin( 11); | 111 | tabLayout_2->setMargin(2); |
109 | 112 | ||
@@ -111,3 +114,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
111 | 114 | ||
112 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1 ); | 115 | tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 0 ); |
113 | 116 | ||
@@ -115,3 +118,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
115 | 118 | ||
116 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1 ); | 119 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 0 ); |
117 | 120 | ||
@@ -123,3 +126,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
123 | 126 | ||
124 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1 ); | 127 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 0 ); |
125 | 128 | ||
@@ -133,3 +136,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
133 | 136 | ||
134 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1 ); | 137 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 0 ); |
135 | 138 | ||
@@ -138,3 +141,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
138 | 141 | ||
139 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); | 142 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 0 ); |
140 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 143 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
@@ -145,3 +148,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
145 | 148 | ||
146 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); | 149 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 0 ); |
147 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 150 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
@@ -164,8 +167,3 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
164 | 167 | ||
165 | /* | 168 | FormatterApp::~FormatterApp() { |
166 | * Destroys the object and frees any allocated resources | ||
167 | frickin no duh?!? | ||
168 | */ | ||
169 | FormatterApp::~FormatterApp() | ||
170 | { | ||
171 | 169 | ||
@@ -328,3 +326,3 @@ void FormatterApp::fillCombos() { | |||
328 | } | 326 | } |
329 | parsetab("/etc/mtab"); | 327 | parsetab("/etc/mtab"); |
330 | // parsetab("/etc/fstab"); | 328 | // parsetab("/etc/fstab"); |
@@ -353,3 +351,3 @@ void FormatterApp::storageComboSelected(int index ) { | |||
353 | if( fsType == fileSystemsCombo->text(i)) | 351 | if( fsType == fileSystemsCombo->text(i)) |
354 | fileSystemsCombo->setCurrentItem(i); | 352 | fileSystemsCombo->setCurrentItem(i); |
355 | } | 353 | } |
@@ -393,3 +391,3 @@ void FormatterApp::deviceComboSelected(int index) { | |||
393 | 391 | ||
394 | TextLabel5->setText("Type: "+ nameS+" Formatted with "+ fsType + " \n" + totalS + usedS + avS); | 392 | TextLabel5->setText("Type: "+ nameS+"\nFormatted with "+ fsType + " \n" + totalS + usedS + avS); |
395 | // storageComboSelected(0); | 393 | // storageComboSelected(0); |
@@ -423,3 +421,3 @@ void FormatterApp::parsetab(const QString &fileName) { | |||
423 | & filesystemType.find("auto",0,TRUE) == -1) | 421 | & filesystemType.find("auto",0,TRUE) == -1) |
424 | fsList << filesystemType; | 422 | fsList << filesystemType; |
425 | deviceList << deviceName; | 423 | deviceList << deviceName; |
@@ -492,60 +490,60 @@ bool FormatterApp::doFsck() { | |||
492 | 490 | ||
493 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 491 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
494 | outDlg->showMaximized(); | 492 | outDlg->showMaximized(); |
495 | outDlg->show(); | 493 | outDlg->show(); |
496 | qApp->processEvents(); | 494 | qApp->processEvents(); |
497 | FILE *fp; | 495 | FILE *fp; |
498 | char line[130]; | 496 | char line[130]; |
499 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 497 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
500 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 498 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
501 | 499 | ||
502 | sleep(1); | 500 | sleep(1); |
503 | // qDebug("Command is "+umountS); | 501 | // qDebug("Command is "+umountS); |
504 | fp = popen( (const char *) umountS, "r"); | 502 | fp = popen( (const char *) umountS, "r"); |
505 | // qDebug("%d", fp); | 503 | // qDebug("%d", fp); |
506 | if ( !fp ) { | 504 | if ( !fp ) { |
507 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 505 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
508 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 506 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
509 | pclose(fp); | 507 | pclose(fp); |
510 | return false; | 508 | return false; |
511 | } else { | 509 | } else { |
512 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 510 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
513 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 511 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
514 | while ( fgets( line, sizeof line, fp)) { | 512 | while ( fgets( line, sizeof line, fp)) { |
515 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 513 | if( ((QString)line).find("busy",0,TRUE) != -1) { |
516 | qDebug("Could not find '" + umountS); | 514 | qDebug("Could not find '" + umountS); |
517 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 515 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
518 | pclose(fp); | 516 | pclose(fp); |
519 | return false; | 517 | return false; |
520 | } else { | 518 | } else { |
521 | QString lineStr = line; | 519 | QString lineStr = line; |
522 | lineStr=lineStr.left(lineStr.length()-1); | 520 | lineStr=lineStr.left(lineStr.length()-1); |
523 | outDlg->OutputEdit->append(lineStr); | 521 | outDlg->OutputEdit->append(lineStr); |
524 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 522 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
525 | } | 523 | } |
526 | } | 524 | } |
527 | } | 525 | } |
528 | pclose(fp); | 526 | pclose(fp); |
529 | ///////////////////////////////////// | 527 | ///////////////////////////////////// |
530 | fp = popen( (const char *) cmd, "r"); | 528 | fp = popen( (const char *) cmd, "r"); |
531 | while ( fgets( line, sizeof line, fp)) { | 529 | while ( fgets( line, sizeof line, fp)) { |
532 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 530 | if( ((QString)line).find("No such device",0,TRUE) != -1) { |
533 | qDebug("No such device '" + umountS); | 531 | qDebug("No such device '" + umountS); |
534 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 532 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
535 | pclose(fp); | 533 | pclose(fp); |
536 | // outDlg->OutputEdit->append("No such device"); | 534 | // outDlg->OutputEdit->append("No such device"); |
537 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 535 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
538 | return false; | 536 | return false; |
539 | } else { | 537 | } else { |
540 | QString lineStr = line; | 538 | QString lineStr = line; |
541 | lineStr=lineStr.left(lineStr.length()-1); | 539 | lineStr=lineStr.left(lineStr.length()-1); |
542 | outDlg->OutputEdit->append(lineStr); | 540 | outDlg->OutputEdit->append(lineStr); |
543 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 541 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
544 | } | 542 | } |
545 | } | 543 | } |
546 | outDlg->OutputEdit->append(tr("You can now close the output window.")); | 544 | outDlg->OutputEdit->append(tr("You can now close the output window.")); |
547 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 545 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
548 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 546 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
549 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 547 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
550 | pclose(fp); | 548 | pclose(fp); |
551 | 549 | ||