Changeset 52 in tspsg-svn
- Timestamp:
- Aug 4, 2009, 6:18:14 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/resources/tspsg.qrc
r50 r52 1 1 <RCC> 2 2 <qresource prefix="/images" > 3 <file>about.bmp</file> 4 <file>icon.png</file> 3 <file>Icon.png</file> 5 4 <file>icons/back.png</file> 6 5 <file>icons/button_cancel.png</file> … … 9 8 <file>icons/contents.png</file> 10 9 <file>icons/contexthelp.png</file> 10 <file>icons/document_preview.png</file> 11 11 <file>icons/exit.png</file> 12 12 <file>icons/filenew.png</file> -
trunk/src/mainwindow.cpp
r51 r52 40 40 #endif 41 41 #ifndef Q_OS_WINCE 42 printer = new QPrinter( );42 printer = new QPrinter(QPrinter::HighResolution); 43 43 #endif // Q_OS_WINCE 44 44 groupSettingsLanguageList = new QActionGroup(this); … … 59 59 connect(actionHelpAbout,SIGNAL(triggered()),this,SLOT(actionHelpAboutTriggered())); 60 60 #ifndef Q_OS_WINCE 61 connect(actionFilePrintSetup,SIGNAL(triggered()),this,SLOT(actionFilePrintSetupTriggered())); 61 connect(actionFilePrintPreview,SIGNAL(triggered()),this,SLOT(actionFilePrintPreviewTriggered())); 62 connect(actionFilePrint,SIGNAL(triggered()),this,SLOT(actionFilePrintTriggered())); 62 63 #endif // Q_OS_WINCE 63 64 connect(buttonSolve,SIGNAL(clicked()),this,SLOT(buttonSolveClicked())); … … 84 85 qsrand(QDateTime().currentDateTime().toTime_t()); 85 86 tspmodel = new CTSPModel(); 87 taskView->setModel(tspmodel); 86 88 connect(tspmodel,SIGNAL(numCitiesChanged(int)),this,SLOT(numCitiesChanged(int))); 87 89 connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged())); … … 92 94 setFileName(); 93 95 spinCities->setValue(settings->value("NumCities",DEF_NUM_CITIES).toInt()); 94 tspmodel->setNumCities(spinCities->value()); 95 } 96 taskView->setModel(tspmodel); 96 spinCitiesValueChanged(spinCities->value()); 97 } 97 98 setWindowModified(false); 98 taskView->resizeColumnsToContents();99 taskView->resizeRowsToContents();100 99 } 101 100 … … 107 106 if (!enable) 108 107 output.clear(); 108 #ifndef Q_OS_WINCE 109 actionFilePrint->setEnabled(enable); 110 actionFilePrintPreview->setEnabled(enable); 111 #endif // Q_OS_WINCE 109 112 } 110 113 … … 117 120 lang = settings->value("Language",QLocale::system().name()).toString(); 118 121 } 119 static QTranslator *qtTranslator; 122 static QTranslator *qtTranslator; // Qt library translator 120 123 if (qtTranslator) { 121 124 qApp->removeTranslator(qtTranslator); … … 124 127 } 125 128 qtTranslator = new QTranslator(); 126 static QTranslator *translator; 129 static QTranslator *translator; // Application translator 127 130 if (translator) { 128 131 qApp->removeTranslator(translator); … … 139 142 qApp->installTranslator(qtTranslator); 140 143 else { 144 // Qt library translation unavailable 141 145 delete qtTranslator; 142 146 qtTranslator = NULL; … … 147 151 else { 148 152 if (!ad) 149 QMessageBox(QMessageBox::Warning,trUtf8("Language change"),trUtf8("Unable to load translation language."),QMessageBox::Ok,this).exec();153 QMessageBox(QMessageBox::Warning,trUtf8("Language Change"),trUtf8("Unable to load translation language."),QMessageBox::Ok,this).exec(); 150 154 delete translator; 151 155 translator = NULL; … … 346 350 347 351 #ifndef Q_OS_WINCE 348 void MainWindow::actionFilePrintSetupTriggered() 352 void MainWindow::printPreview(QPrinter *printer) 353 { 354 solutionText->print(printer); 355 } 356 357 void MainWindow::actionFilePrintPreviewTriggered() 358 { 359 QPrintPreviewDialog ppd(printer, this); 360 connect(&ppd,SIGNAL(paintRequested(QPrinter *)),SLOT(printPreview(QPrinter *))); 361 ppd.exec(); 362 } 363 364 void MainWindow::actionFilePrintTriggered() 349 365 { 350 366 QPrintDialog pd(printer,this); … … 354 370 pd.setOption(QAbstractPrintDialog::PrintPageRange,false); 355 371 #endif 356 pd.exec(); 372 if (pd.exec() != QDialog::Accepted) 373 return; 374 solutionText->document()->print(printer); 357 375 } 358 376 #endif // Q_OS_WINCE -
trunk/src/mainwindow.h
r50 r52 55 55 void dataChanged(); 56 56 #ifndef Q_OS_WINCE 57 void actionFilePrintSetupTriggered(); 57 void printPreview(QPrinter *); 58 void actionFilePrintPreviewTriggered(); 59 void actionFilePrintTriggered(); 58 60 #endif // Q_OS_WINCE 59 61 void buttonSolveClicked(); -
trunk/ui/mainwindow.ce.ui
r51 r52 18 18 </property> 19 19 <property name="windowIcon"> 20 <iconset resource="../resources/tspsg.qrc">20 <iconset> 21 21 <normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset> 22 22 </property> -
trunk/ui/mainwindow.ui
r50 r52 15 15 </property> 16 16 <property name="windowIcon"> 17 <iconset resource="../resources/tspsg.qrc">17 <iconset> 18 18 <normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset> 19 19 </property> … … 297 297 <addaction name="menuFileSaveAs"/> 298 298 <addaction name="separator"/> 299 <addaction name="actionFilePrint Setup"/>299 <addaction name="actionFilePrintPreview"/> 300 300 <addaction name="actionFilePrint"/> 301 301 <addaction name="separator"/> … … 362 362 <addaction name="actionFileExit"/> 363 363 </widget> 364 <action name="actionFilePrint Setup">364 <action name="actionFilePrintPreview"> 365 365 <property name="enabled"> 366 366 <bool>false</bool> … … 368 368 <property name="icon"> 369 369 <iconset resource="../resources/tspsg.qrc"> 370 <normaloff>:/images/icons/fileprint.png</normaloff>:/images/icons/fileprint.png</iconset> 371 </property> 372 <property name="text"> 373 <string>P&rint Setup...</string> 374 </property> 375 <property name="statusTip"> 376 <string>Setup printing</string> 370 <normaloff>:/images/icons/document_preview.png</normaloff>:/images/icons/document_preview.png</iconset> 371 </property> 372 <property name="text"> 373 <string>P&rint Preview...</string> 374 </property> 375 <property name="iconText"> 376 <string>Print Preview...</string> 377 </property> 378 <property name="toolTip"> 379 <string>Preview solution results</string> 380 </property> 381 <property name="statusTip"> 382 <string>Preview current solution results before printing</string> 377 383 </property> 378 384 </action> … … 388 394 <string>&Print...</string> 389 395 </property> 390 <property name="statusTip"> 391 <string>Print solution results</string> 396 <property name="iconText"> 397 <string>Print...</string> 398 </property> 399 <property name="toolTip"> 400 <string>Print solution</string> 401 </property> 402 <property name="statusTip"> 403 <string>Print current solution results</string> 392 404 </property> 393 405 <property name="shortcut">
Note: See TracChangeset
for help on using the changeset viewer.