Changeset caef58b531 in tspsg for src
- Timestamp:
- Oct 20, 2009, 9:38:01 PM (15 years ago)
- Branches:
- 0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
- Children:
- 85ad815b0b
- Parents:
- bc1b8837b6
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
rbc1b8837b6 rcaef58b531 24 24 #include "mainwindow.h" 25 25 26 /*! 27 * \brief Class constructor. 28 * \param parent Main Window parent widget. 29 * 30 * Initializes Main Window and creates its layout based on target OS. 31 * Loads TSPSG settings and opens a task file if it was specified as a commandline parameter. 32 */ 26 33 MainWindow::MainWindow(QWidget *parent) 27 34 : QMainWindow(parent) … … 484 491 output.append("<p>" + trUtf8("<b>WARNING!!!</b><br>This result is a record, but it may not be optimal.<br>Iterations need to be continued to check whether this result is optimal or get an optimal one.") + "</p>"); 485 492 } 493 output.append("<p></p>"); 486 494 solutionText->setHtml(output.join("")); 487 495 solutionText->setDocumentTitle(trUtf8("Solution of Variant #%1 task").arg(spinVariant->value())); 496 497 // Scrolling to the end of text. 498 QTextCursor cursor(solutionText->textCursor()); 499 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor); 500 solutionText->setTextCursor(cursor); 501 488 502 enableSolutionActions(); 489 503 tabWidget->setCurrentIndex(1); … … 493 507 void MainWindow::actionHelpAboutTriggered() 494 508 { 495 //TODO: Normal about window :-)509 //! \todo TODO: Normal about window :-) 496 510 QString about = QString::fromUtf8("TSPSG: TSP Solver and Generator\n"); 497 511 about += QString::fromUtf8(" Version: "BUILD_VERSION"\n"); … … 569 583 } 570 584 585 /*! 586 * \brief Handles Main Window close event. 587 * \param event Close event. 588 * 589 * Checks whether or not a current task was saved and asks for saving if not. 590 * Saves TSPSG settings. 591 */ 571 592 void MainWindow::closeEvent(QCloseEvent *event) 572 593 { -
src/mainwindow.h
rbc1b8837b6 rcaef58b531 1 /* 2 * TSPSG: TSP Solver and Generator 3 * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 1 /*! 2 * \class MainWindow 3 * \brief Class for handling Main Window UI and logic. 4 * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 4 5 * 5 6 * $Id$ 6 7 * $URL$ 8 * 9 * <b>TSPSG: TSP Solver and Generator</b> 7 10 * 8 11 * This file is part of TSPSG. … … 54 57 void dataChanged(const QModelIndex &, const QModelIndex &); 55 58 #ifndef QT_NO_PRINTER 56 void printPreview(QPrinter * );59 void printPreview(QPrinter *printer); 57 60 void actionFilePrintPreviewTriggered(); 58 61 void actionFilePrintTriggered(); -
src/settingsdialog.cpp
rbc1b8837b6 rcaef58b531 24 24 #include "settingsdialog.h" 25 25 26 /*! 27 * \brief Class constructor. 28 * \param parent Settings Dialog parent widget. 29 * 30 * Initializes Settings Dialog and creates its layout based on target OS. 31 */ 26 32 SettingsDialog::SettingsDialog(QWidget *parent) 27 33 : QDialog(parent), newFont(false), newColor(false) … … 218 224 } 219 225 226 /*! 227 * \brief Indicates whether or not the font color has been changed. 228 */ 220 229 bool SettingsDialog::colorChanged() const 221 230 { … … 223 232 } 224 233 234 /*! 235 * \brief Indicates whether or not the font properties have been changed. 236 */ 225 237 bool SettingsDialog::fontChanged() const 226 238 { 227 239 return newFont; 240 } 241 242 void SettingsDialog::spinRandMinValueChanged(int val) { 243 spinRandMax->setMinimum(val); 228 244 } 229 245 -
src/settingsdialog.h
rbc1b8837b6 rcaef58b531 1 /* 2 * TSPSG: TSP Solver and Generator 3 * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 1 /*! 2 * \class SettingsDialog 3 * \brief Class for handling Settings Dialog UI and logic. 4 * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 4 5 * 5 6 * $Id$ 6 7 * $URL$ 8 * 9 * <b>TSPSG: TSP Solver and Generator</b> 7 10 * 8 11 * This file is part of TSPSG. … … 29 32 #include "ui_settingsdialog.h" 30 33 31 class SettingsDialog: public QDialog, publicUi::SettingsDialog34 class SettingsDialog: public QDialog, Ui::SettingsDialog 32 35 { 33 36 Q_OBJECT … … 36 39 bool colorChanged() const; 37 40 bool fontChanged() const; 38 39 #ifndef Q_OS_WINCE40 QCheckBox *cbSaveState;41 QLabel *imgIcon;42 QLabel *labelHint;43 QFrame *lineVertical;44 #endif // Q_OS_WINCE45 41 46 42 private: … … 52 48 #ifndef Q_OS_WINCE 53 49 bool event(QEvent *); 54 #endif 50 51 QCheckBox *cbSaveState; 52 QLabel *imgIcon; 53 QLabel *labelHint; 54 QFrame *lineVertical; 55 #endif // Q_OS_WINCE 55 56 56 57 private slots: … … 58 59 void buttonColorClicked(); 59 60 void buttonFontClicked(); 60 void spinRandMinValueChanged(int val) { spinRandMax->setMinimum(val); }61 void spinRandMinValueChanged(int); 61 62 }; 62 63 -
src/tspmodel.h
rbc1b8837b6 rcaef58b531 1 /* 2 * TSPSG: TSP Solver and Generator 3 * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 1 /*! 2 * \class CTSPModel 3 * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 4 * \brief This class implements table model for manipulating a task. 4 5 * 5 6 * $Id$ 6 7 * $URL$ 8 * 9 * <b>TSPSG: TSP Solver and Generator</b> 7 10 * 8 11 * This file is part of TSPSG. -
src/tspsolver.cpp
rbc1b8837b6 rcaef58b531 24 24 #include "tspsolver.h" 25 25 26 //! Class constructor 26 27 CTSPSolver::CTSPSolver() 27 28 : nCities(0) … … 125 126 } 126 127 127 // TODO: Comment the algorithm 128 /*! 129 * \brief Solves the given task. 130 * \param numCities Number of cities in the task. 131 * \param task The matrix of city-to-city travel costs. 132 * \param parent The parent widget for displaying messages and dialogs. 133 * 134 * \todo TODO: Comment the algorithm. 135 */ 128 136 sStep *CTSPSolver::solve(int numCities, tMatrix task, QWidget *parent) 129 137 { … … 226 234 } 227 235 236 /*! 237 * \brief Returns the sorted optimal path, starting from City 1. 238 */ 228 239 QString CTSPSolver::getSortedPath() const 229 240 { … … 242 253 } 243 254 255 /*! 256 * \brief Returns CTSPSolver's version ID. 257 * 258 * Current version ID is <b>\$Id$</b>. 259 */ 244 260 QString CTSPSolver::getVersionId() 245 261 { … … 247 263 } 248 264 265 /*! 266 * \brief Returns whether or not the solution is definitely optimal. 267 * 268 * The solution may need some further interations to determine whether it is optimal. 269 * In such cases this function returns \p false. 270 */ 249 271 bool CTSPSolver::isOptimal() const 250 272 { -
src/tspsolver.h
rbc1b8837b6 rcaef58b531 1 /* 2 * TSPSG: TSP Solver and Generator 3 * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 1 /*! 2 * \class CTSPSolver 3 * \author Copyright © 2007-2009 Lёppa <contacts[at]oleksii[dot]name> 4 * \brief This class solves Travelling Salesman Problem task. 4 5 * 5 6 * $Id$ 6 7 * $URL$ 8 * 9 * <b>TSPSG: TSP Solver and Generator</b> 7 10 * 8 11 * This file is part of TSPSG. … … 20 23 * You should have received a copy of the GNU General Public License 21 24 * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. 25 * 26 * \todo TODO: Deletion of solution tree on destroy and cleanup. 22 27 */ 23 28 … … 29 34 #include "tspmodel.h" 30 35 36 //! A matrix of city-to-city travel costs. 31 37 typedef QList<QList<double> > tMatrix; 32 38 33 // This structure represents one step of solving 34 // The tree of such elements will represent the solving process 39 /*! 40 * \brief This structure represents one step of solving. 41 * 42 * A tree of such elements will represent the solving process. 43 */ 44 //! \todo TODO: List alternative candidates. 35 45 struct sStep { 36 tMatrix matrix; // Steps's matrix 37 double price; // Price of travel to this step 38 struct {int nRow; int nCol;} candidate; // Candiadate for branching in current matrix 39 bool alts; // This matrix has alternative candidates 40 sStep *plNode, *prNode; // Pointers to left and right branch steps 41 sStep() { price = candidate.nRow = candidate.nCol = -1; alts = false; plNode = prNode = NULL; } // Default values 46 tMatrix matrix; //!< This step's matrix 47 double price; //!< The price of travel to this step 48 struct { 49 int nRow; //!< A zero-based row number of the candidate 50 int nCol; //!< A zero-based column number of the candidate 51 } candidate; //!< A candiadate for branching in the current matrix 52 bool alts; //!< Indicates whether or not matrix has alternative candidates 53 sStep *plNode; //!< Pointer to the left branch step 54 sStep *prNode; //!< Pointer to the right branch step 55 56 //! Assigns default values 57 sStep() { 58 price = candidate.nRow = candidate.nCol = -1; 59 alts = false; 60 plNode = prNode = NULL; 61 } 42 62 }; 43 63 44 // TSP Solver class45 64 class CTSPSolver 46 65 {
Note: See TracChangeset
for help on using the changeset viewer.