Changeset 53 in projects for punch-card/punch-card-editor/src/app/mainwindow.cc
- Timestamp:
- Dec 24, 2009, 4:17:54 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
punch-card/punch-card-editor/src/app/mainwindow.cc
r52 r53 8 8 #include <QtDebug> 9 9 #include <QListView> 10 #include <QUndoView> 10 11 #include <QDockWidget> 11 12 #include <QHBoxLayout> … … 44 45 createStatusBar(); 45 46 createDockWindows(); 47 createDevices(); 46 48 47 49 // Titel einrichten und so 48 50 connect(this, SIGNAL(fileOpened(bool)), this, SLOT(window_update_on_file_state(bool))); 51 connect(this, SIGNAL(fileOpened(bool)), this, SLOT(actions_update_on_file_state(bool))); 49 52 // und jetzt: 50 53 … … 62 65 } 63 66 64 void MainWindow::window_update_on_file_state(bool opened) {65 // * Window Title setzen66 // * contentsChanged-Signal broadcasten67 if(opened) {68 // titel setzen69 setWindowFilePath(QFileInfo(file).filePath());70 setWindowTitle(tr("%1[*] - %2").arg(71 file.fileName().isEmpty() ? tr("New Card Deck") : file.fileName()72 ).arg(tr("Punch Card Editor")));73 // Modified-Stern ([*]) verbinden74 connect(deck, SIGNAL(modified(bool)), this, SLOT(setWindowModified(bool)));75 76 // Broadcasting von "Edited" verbinden77 connect(deck, SIGNAL(contentsChanged(DeckIndex, DeckIndex)), this, SIGNAL(contentsChanged(DeckIndex,DeckIndex)));78 } else {79 setWindowTitle(tr("Punch Card Editor"));80 // passiert folgendes nicht sowieso automatisch?81 disconnect(this, SLOT(setWindowModified(bool)));82 // urhm, den broadcaster... nicht die slots freisetzen, waere bloed.83 }84 }85 67 86 68 bool MainWindow::maybeSave() { … … 100 82 return true; // discard the file 101 83 } 102 }103 104 void MainWindow::newWindow() {105 // einfacher gehts nicht:106 new MainWindow();107 84 } 108 85 … … 147 124 148 125 void MainWindow::newFile() { 126 // KISS: Simply open a new window. Don't touch current window. 127 MainWindow* window = new MainWindow(); 128 window->show(); 129 // This would open a new file in current window. 130 /* 149 131 if(maybeSave()) { 150 132 // alte Datei schliessen. … … 154 136 deck = new Deck(); 155 137 notifyFileOpened(); 156 } 138 }*/ 157 139 } 158 140 … … 220 202 void MainWindow::closeFile() { 221 203 if(maybeSave()) { 204 // Fenster schliessen. Deck schliesst damit automatisch. 205 222 206 // Deck schliessen und fertig. 223 closeDeck();207 // closeDeck(); 224 208 } 225 209 } … … 240 224 241 225 void MainWindow::help() { 242 226 qDebug("Display some help viewer..."); 243 227 } 244 228 … … 341 325 } 342 326 327 void MainWindow::createStatusBar() { 328 this->statusBar()->showMessage(tr("Welcome to the Punch Card Editor"), 1000); 329 } 330 331 void MainWindow::createDevices() { 332 QList<QString> driver_names = Device::DriverFactory::availableDrivers(); 333 qDebug() << "Driver names: " << driver_names; 334 for(int i = 0; i < driver_names.count(); i++) { 335 Device::Dock* dock = new Device::Dock(driver_names[i], this); 336 this->addDockWidget(Qt::TopDockWidgetArea, dock); 337 dock->setVisible(false); 338 device_docks.append(dock); 339 devices_menu->addAction( dock->toggleViewAction() ); 340 } 341 } 342 343 343 344 344 void MainWindow::createDockWindows() {
Note: See TracChangeset
for help on using the changeset viewer.