Changeset 45 in tspsg-svn


Ignore:
Timestamp:
Aug 2, 2009, 1:50:14 AM (15 years ago)
Author:
laleppa
Message:

+ Wait Cursor (a.k.a Hourglass) while application starts.
+ Open file, passed as command-line argument.

  • Renamed all resources to have lowercase names.
  • Application couldn't be built on Qt < 4.5, because it has no QTextDocumentWriter class. Made a workaround.
Location:
trunk
Files:
2 deleted
5 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/resources/tspsg.qrc

    r42 r45  
    11<RCC>
    22    <qresource prefix="/images" >
    3         <file>About.bmp</file>
    4         <file>Icon.png</file>
    5         <file>Settings.png</file>
    6         <file>Task.bmp</file>
     3        <file>about.bmp</file>
     4        <file>icon.png</file>
    75        <file>icons/button_cancel.png</file>
    86        <file>icons/button_ok.png</file>
  • trunk/resources/tspsg.rc

    r42 r45  
    1515
    1616// Main Icon
    17 IDI_APPICON     ICON    "Icon.ico"
     17IDI_APPICON     ICON    "icon.ico"
    1818
    1919// Version Info
     
    3939        BLOCK "000004b0"
    4040        BEGIN
    41             VALUE "Comments", BUILD_STATUS
     41//            VALUE "Comments", BUILD_STATUS
    4242            VALUE "CompanyName", "..::Lёppsville::.. Homes"
    4343            VALUE "FileDescription", "TSPSG: TSP Solver and Generator"
  • trunk/src/main.cpp

    r42 r45  
    2727                #pragma message("WARNING: You are using Qt version < 4.5. Application will not support some non-critical features.")
    2828        #elif (defined(__GNUC__) || defined(__MINGW32__))
    29                 #warning "WARNING: You are using Qt version < 4.5. Application will not support some non-critical features."
     29                #warning WARNING: You are using Qt version < 4.5. Application will not support some non-critical features.
     30        #else
     31                #error You are using Qt version < 4.5. Application will not support some non-critical features. To continue, please, comment line 31 at main.cpp.
    3032        #endif
    3133#endif
     
    3436{
    3537QApplication app(argc, argv);
     38        app.setOverrideCursor(QCursor(Qt::WaitCursor));
    3639        QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
    3740        QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8"));
    3841        QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
    39         app.setOrganizationName("..::Lёppsville::..");
    40         app.setOrganizationDomain("www.leppsville.com");
     42        app.setOrganizationName("..::Lёppsville::.. Homes");
     43        app.setOrganizationDomain("l-homes.org");
    4144        app.setApplicationName("TSPSG");
    4245MainWindow mainwindow;
    4346        mainwindow.show();
     47        app.restoreOverrideCursor();
    4448        return app.exec();
    4549}
  • trunk/src/mainwindow.cpp

    r42 r45  
    1         /*
     1/*
    22 *  TSPSG: TSP Solver and Generator
    33 *  Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
     
    8787        connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged()));
    8888        connect(tspmodel,SIGNAL(layoutChanged()),this,SLOT(dataChanged()));
     89        if (QCoreApplication::arguments().count() > 1) {
     90                tspmodel->loadTask(QCoreApplication::arguments().at(1));
     91                setWindowModified(false);
     92        }
    8993#ifdef Q_OS_WINCE
    9094        taskView->resizeColumnsToContents();
     
    229233        sd.setAcceptMode(QFileDialog::AcceptSave);
    230234QStringList filters(trUtf8("HTML Files") + " (*.html *.htm)");
     235#if QT_VERSION >= 0x040500
    231236        filters.append(trUtf8("OpenDocument Files") + " (*.odt)");
     237#endif // QT_VERSION >= 0x040500
    232238        filters.append(trUtf8("All Files") + " (*)");
    233239        sd.setNameFilters(filters);
     
    239245                return;
    240246        selectedFile = files.first();
     247#if QT_VERSION >= 0x040500
    241248QTextDocumentWriter dw(selectedFile);
    242249        if (!(selectedFile.endsWith(".htm",Qt::CaseInsensitive) || selectedFile.endsWith(".html",Qt::CaseInsensitive) || selectedFile.endsWith(".odt",Qt::CaseInsensitive) || selectedFile.endsWith(".txt",Qt::CaseInsensitive)))
    243250                dw.setFormat("plaintext");
    244251        dw.write(solutionText->document());
     252#else
     253        // Qt < 4.5 has no QTextDocumentWriter class
     254QFile file(selectedFile);
     255        if (!file.open(QFile::WriteOnly))
     256                return;
     257QTextStream ts(&file);
     258        ts.setCodec(QTextCodec::codecForName("UTF-8"));
     259        ts << solutionText->document()->toHtml("UTF-8");
     260#endif // QT_VERSION >= 0x040500
    245261}
    246262
     
    388404        // TODO: Normal about window :-)
    389405QString about = QString::fromUtf8("TSPSG - TSP Solver and Generator\n");
    390         about += QString::fromUtf8("    Version: "BUILD_VERSION" ("BUILD_STATUS")\n");
     406        about += QString::fromUtf8("    Version: "BUILD_VERSION"\n");
    391407        about += QString::fromUtf8("    Copyright (C) 2007-%1 Lёppa <contacts[at]oleksii[dot]name>\n").arg(QDate::currentDate().toString("yyyy"));
    392408        about += QString::fromUtf8("Target OS: %1\n").arg(OS);
  • trunk/src/version.h

    • Property svn:keywords set to Id URL
    r42 r45  
    2727#define BUILD_VERSION_MAJOR 0
    2828#define BUILD_VERSION_MINOR 1
    29 #define BUILD_RELEASE 1
    30 // Will stick this to revision
    31 #define BUILD_NUMBER 42
    32 #define BUILD_STATUS "alpha 1"
     29#define BUILD_RELEASE 2
     30// This will only change on releases and will be the same as revision number
     31#define BUILD_NUMBER 65535
     32// Release number meanings:
     33//   1  --  3: alpha 1 to 3
     34//   4  --  7: beta 1 to 4
     35//   8  -- 10: rc 1 to 3
     36//   11 --...: release 1 to ...
     37#if BUILD_NUMBER == 65535
     38        #define BUILD_STATUS (dev build)
     39#elif BUILD_RELEASE < 4
     40        #define BUILD_STATUS (alpha)
     41#elif BUILD_RELEASE < 8
     42        #define BUILD_STATUS (beta)
     43#elif BUILD_RELEASE < 11
     44        #define BUILD_STATUS (rc)
     45#endif // BUILD_NUMBER == 65535
    3346
    3447// "Converting" number to string
     
    3649#define QUOTE(x) QUOTE_X(x)
    3750
    38 #define BUILD_VERSION QUOTE(BUILD_VERSION_MAJOR.BUILD_VERSION_MINOR.BUILD_RELEASE)
     51#ifndef BUILD_STATUS
     52        #define BUILD_VERSION QUOTE(BUILD_VERSION_MAJOR.BUILD_VERSION_MINOR.BUILD_RELEASE)
     53#else
     54        #define BUILD_VERSION QUOTE(BUILD_VERSION_MAJOR.BUILD_VERSION_MINOR.BUILD_RELEASE BUILD_STATUS)
     55#endif
    3956
    4057#endif // VERSION_H
Note: See TracChangeset for help on using the changeset viewer.