- Timestamp:
- Aug 9, 2009, 1:45:19 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/globals.h
r50 r54 31 31 // Version info 32 32 #include "version.h" 33 // OS detection33 // OS and ARCH detection 34 34 #include "os.h" 35 35 … … 58 58 59 59 // Maximum available number of cities 60 #define MAX_NUM_CITIES 2060 #define MAX_NUM_CITIES 30 61 61 // This value means infinity :-) 62 62 #ifndef INFINITY -
trunk/src/mainwindow.cpp
r52 r54 30 30 loadLanguage(); 31 31 setupUi(this); 32 #ifndef Q_OS_WINCE 33 QStatusBar *statusbar = new QStatusBar(this); 34 statusbar->setObjectName("statusbar"); 35 setStatusBar(statusbar); 36 #endif // Q_OS_WINCE 32 37 initDocStyleSheet(); 33 38 solutionText->document()->setDefaultFont(settings->value("Output/Font",QFont(DEF_FONT_FAMILY,DEF_FONT_SIZE)).value<QFont>()); … … 39 44 toolBar->setIconSize(QSize(s / 10,s / 10)); 40 45 #endif 41 #ifndef Q _OS_WINCE46 #ifndef QT_NO_PRINTER 42 47 printer = new QPrinter(QPrinter::HighResolution); 43 #endif // Q _OS_WINCE48 #endif // QT_NO_PRINTER 44 49 groupSettingsLanguageList = new QActionGroup(this); 45 50 actionSettingsLanguageEnglish->setData("en"); … … 58 63 connect(actionHelpAboutQt,SIGNAL(triggered()),qApp,SLOT(aboutQt())); 59 64 connect(actionHelpAbout,SIGNAL(triggered()),this,SLOT(actionHelpAboutTriggered())); 60 #ifndef Q_OS_WINCE 65 #ifndef QT_NO_PRINTER 66 menuFile->insertAction(actionFileExit,actionFilePrintPreview); 67 menuFile->insertAction(actionFileExit,actionFilePrint); 68 menuFile->insertSeparator(actionFileExit); 69 toolBar->insertAction(actionSettingsPreferences,actionFilePrint); 61 70 connect(actionFilePrintPreview,SIGNAL(triggered()),this,SLOT(actionFilePrintPreviewTriggered())); 62 71 connect(actionFilePrint,SIGNAL(triggered()),this,SLOT(actionFilePrintTriggered())); 63 #endif // Q _OS_WINCE72 #endif // QT_NO_PRINTER 64 73 connect(buttonSolve,SIGNAL(clicked()),this,SLOT(buttonSolveClicked())); 65 74 connect(buttonRandom,SIGNAL(clicked()),this,SLOT(buttonRandomClicked())); … … 106 115 if (!enable) 107 116 output.clear(); 108 #ifndef Q _OS_WINCE117 #ifndef QT_NO_PRINTER 109 118 actionFilePrint->setEnabled(enable); 110 119 actionFilePrintPreview->setEnabled(enable); 111 #endif // Q _OS_WINCE120 #endif // QT_NO_PRINTER 112 121 } 113 122 … … 206 215 if (!maybeSave()) 207 216 return; 217 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 208 218 tspmodel->clear(); 209 219 taskView->resizeColumnsToContents(); … … 214 224 solutionText->clear(); 215 225 enableSolutionActions(false); 226 QApplication::restoreOverrideCursor(); 216 227 } 217 228 … … 349 360 } 350 361 351 #ifndef Q _OS_WINCE362 #ifndef QT_NO_PRINTER 352 363 void MainWindow::printPreview(QPrinter *printer) 353 364 { … … 372 383 if (pd.exec() != QDialog::Accepted) 373 384 return; 385 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 374 386 solutionText->document()->print(printer); 375 } 376 #endif // Q_OS_WINCE 387 QApplication::restoreOverrideCursor(); 388 } 389 #endif // QT_NO_PRINTER 377 390 378 391 void MainWindow::buttonRandomClicked() 379 392 { 393 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 380 394 tspmodel->randomize(); 381 395 setWindowModified(true); 382 396 taskView->resizeColumnsToContents(); 383 397 taskView->resizeRowsToContents(); 398 QApplication::restoreOverrideCursor(); 384 399 } 385 400 -
trunk/src/mainwindow.h
r52 r54 26 26 27 27 #include "globals.h" 28 #ifdef Q_OS_WINCE 29 #include "ui_mainwindow.ce.h" 30 #else 31 #include "ui_mainwindow.h" 32 #endif // Q_OS_WINCE 28 #include "ui_mainwindow.h" 33 29 #include "settingsdialog.h" 34 30 #include "tspsolver.h" … … 54 50 void actionHelpAboutTriggered(); 55 51 void dataChanged(); 56 #ifndef Q _OS_WINCE52 #ifndef QT_NO_PRINTER 57 53 void printPreview(QPrinter *); 58 54 void actionFilePrintPreviewTriggered(); 59 55 void actionFilePrintTriggered(); 60 #endif // Q _OS_WINCE56 #endif // QT_NO_PRINTER 61 57 void buttonSolveClicked(); 62 58 void buttonRandomClicked(); … … 67 63 private: 68 64 QSettings *settings; 69 #ifndef Q _OS_WINCE65 #ifndef QT_NO_PRINTER 70 66 QPrinter *printer; 71 #endif // Q _OS_WINCE67 #endif // QT_NO_PRINTER 72 68 CTSPModel *tspmodel; 73 69 QString fileName; -
trunk/src/tspsolver.cpp
r50 r54 39 39 double min = INFINITY; 40 40 for (int k = 0; k < nCities; k++) 41 if (((k != exc)) && (min > matrix [nRow][k]))42 min = matrix [nRow][k];41 if (((k != exc)) && (min > matrix.at(nRow).at(k))) 42 min = matrix.at(nRow).at(k); 43 43 return min == INFINITY ? 0 : min; 44 44 } … … 48 48 double min = INFINITY; 49 49 for (int k = 0; k < nCities; k++) 50 if ((k != exr) && (min > matrix [k][nCol]))51 min = matrix [k][nCol];50 if ((k != exr) && (min > matrix.at(k).at(nCol))) 51 min = matrix.at(k).at(nCol); 52 52 return min == INFINITY ? 0 : min; 53 53 } … … 98 98 for (int c = 0; c < nCities; c++) 99 99 // if ((matrix[r][c] == 0) && !forbidden.values(r).contains(c)) { 100 if (matrix [r][c]== 0) {100 if (matrix.at(r).at(c) == 0) { 101 101 sum = findMinInRow(r,matrix,c) + findMinInCol(c,matrix,r); 102 102 if (sum > h) {
Note: See TracChangeset
for help on using the changeset viewer.