Changeset 17 in tspsg-svn for trunk/src


Ignore:
Timestamp:
Jun 15, 2009, 5:10:25 PM (15 years ago)
Author:
laleppa
Message:

+ Windows CE (WM6, actually, but should work on other versions) support:

  • added optimized for wince forms (recommended minimal resolution is 240x320);
  • removed unsupported under wince features from menus (e.g., printing);
  • added preprocessor directives to remove code for unsupported under wince features.
  • Fixed wrong encoding in some files to UTF-8.
  • Updated copyright and e-mail.
Location:
trunk
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 *.vcproj*
         1*.idb
        22*.ncb
         3*.pdb
        34*.sln
        45*.suo
        5 *.idb
        6 *.pdb
        7 ui_*
         6*.vcproj*
         7Makefile*
         8Win32
         9Windows Mobile*
         10debug
        811moc_*
        912qrc_*
        10 tspsg
        11 Makefile*
        12 debug
        1313release
         14ui_*
  • trunk/src/main.cpp

    r9 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    4646        return app.exec();
    4747}
    48 
  • trunk/src/mainwindow.cpp

    r15 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    2323
    2424#include <QtGui>
     25#ifndef Q_OS_WINCE
     26        #include <QPrintDialog>
     27#endif // Q_OS_WINCE
    2528#include "mainwindow.h"
    2629
     
    3235        setupUi(this);
    3336        connect(actionSettingsSettings,SIGNAL(triggered()),this,SLOT(ChangeSettings()));
     37#ifndef Q_OS_WINCE
     38        connect(actionFilePrintSetup,SIGNAL(triggered()),this,SLOT(PrintSetup()));
     39#endif // Q_OS_WINCE
    3440        connect(buttonSolve,SIGNAL(clicked()),this,SLOT(Solve()));
    3541        connect(buttonRandom,SIGNAL(clicked()),this,SLOT(Random()));
    3642        connect(spinCities,SIGNAL(valueChanged(int)),this,SLOT(CitiesNumberChanged(int)));
     43QRect rect = geometry();
     44#ifdef Q_OS_WINCE
     45        // HACK: Fix for all tabWidget elements becoming "unclickable" if making it central widget.
     46        rect.setSize(QApplication::desktop()->availableGeometry().size());
     47        rect.setHeight(rect.height() - (QApplication::desktop()->screenGeometry().height() - QApplication::desktop()->availableGeometry().height()));
     48        tabWidget->resize(rect.width(),rect.height() - toolBar->size().height());
     49#else
    3750        // Centering MainWindow
    3851        // TODO: Loading of saved window state
    39 QRect rect = geometry();
    40         rect.moveCenter(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).center());
     52        rect.moveCenter(QApplication::desktop()->availableGeometry().center());
     53#endif // Q_OS_WINCE
    4154        setGeometry(rect);
    4255        qsrand(QDateTime().currentDateTime().toTime_t());
     
    6376        }
    6477}
     78
     79#ifndef Q_OS_WINCE
     80void MainWindow::PrintSetup()
     81{
     82QPrintDialog pd;
     83        pd.exec();
     84}
     85#endif // Q_OS_WINCE
    6586
    6687void MainWindow::Random()
     
    93114        // tabWidget->setCurrentIndex(1);
    94115}
    95 
  • trunk/src/mainwindow.h

    r15 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    2626
    2727#include <QMainWindow>
    28 #include "ui_mainwindow.h"
     28#ifdef Q_OS_WINCE
     29        #include "ui_mainwindow.ce.h"
     30#else
     31        #include "ui_mainwindow.h"
     32#endif // Q_OS_WINCE
    2933#include "settingsdialog.h"
    3034#include "tspsolver.h"
     
    3842private slots:
    3943        void ChangeSettings();
     44#ifndef Q_OS_WINCE
     45        void PrintSetup();
     46#endif // Q_OS_WINCE
    4047        void Solve();
    4148        void Random();
     
    4855
    4956#endif // MAINWINDOW_H
    50 
  • trunk/src/settingsdialog.cpp

    r10 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    2424#include <QMessageBox>
    2525#include <QStatusTipEvent>
     26#include <QFontDialog>
    2627#include "settingsdialog.h"
    2728
     
    3334        connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
    3435        connect(spinRandMin,SIGNAL(valueChanged(int)),this,SLOT(spinRandMinValueChanged(int)));
     36        connect(buttonFont,SIGNAL(clicked()),this,SLOT(buttonFontClicked()));
    3537//      setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
    3638        setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
    3739        layout()->setSizeConstraint(layout()->SetFixedSize);
     40#ifndef Q_OS_WINCE
    3841        // Setting initial text of dialog hint label to own status tip
    3942        // text.
     
    4346        labelHint->setMaximumHeight(labelHint->height());
    4447        labelHint->setMinimumHeight(labelHint->height());
     48#endif // Q_OS_WINCE
    4549}
    4650
     51#ifndef Q_OS_WINCE
    4752bool SettingsDialog::event(QEvent *ev)
    4853{
     
    6065                return QDialog::event(ev);
    6166}
     67#endif // Q_OS_WINCE
    6268
     69void SettingsDialog::buttonFontClicked()
     70{
     71        // TODO: Pass current font to dialog and save selected.
     72QFontDialog fd;
     73        fd.exec();
     74}
  • trunk/src/settingsdialog.h

    r12 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    2626
    2727#include <QDialog>
    28 #include "ui_settingsdialog.h"
     28#ifdef Q_OS_WINCE
     29        #include "ui_settingsdialog.ce.h"
     30#else
     31        #include "ui_settingsdialog.h"
     32#endif // Q_OS_WINCE
    2933
    3034class SettingsDialog: public QDialog, public Ui::SettingsDialog
     
    3539
    3640private:
     41#ifndef WINCE
    3742        bool event(QEvent *);
     43#endif
    3844
    3945private slots:
    4046        void spinRandMinValueChanged(int val) { spinRandMax->setMinimum(val + 1); }
     47        void buttonFontClicked();
    4148};
    4249
    4350#endif // SETTINGSDIALOG_H
    44 
  • trunk/src/tspmodel.cpp

    r16 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    4545}
    4646
    47 QVariant CTSPModel::headerData(int section, Qt::Orientation, int role) const
     47QVariant CTSPModel::headerData(int section, Qt::Orientation orientation, int role) const
    4848{
    4949        if (role == Qt::DisplayRole)
    50                 return trUtf8("Город %1").arg(section + 1);
     50                if (orientation == Qt::Vertical)
     51                        return trUtf8("Город %1").arg(section + 1);
     52                else
     53                        return trUtf8("%1").arg(section + 1);
    5154        return QVariant();
    5255}
     
    143146        emit dataChanged(index(0,0),index(nCities - 1,nCities - 1));
    144147}
    145 
  • trunk/src/tspmodel.h

    r15 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 Lёppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    6060
    6161#endif // TSPMODEL_H
    62 
  • trunk/src/tspsolver.cpp

    r15 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    5858        return step;
    5959}
    60 
  • trunk/src/tspsolver.h

    r15 r17  
    11/*
    22 *  TSPSG - TSP Solver and Generator
    3  *  Copyright (C) 2007 L¸ppa <lacontacts[at]gmail[dot]com>
     3 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
    44 *
    55 *  $Id$
     
    5353
    5454#endif // TSPSOLVER_H
    55 
Note: See TracChangeset for help on using the changeset viewer.