File: main.cpp

package info (click to toggle)
qcad 1.3.3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,504 kB
  • ctags: 2,449
  • sloc: cpp: 29,400; makefile: 49; sh: 15
file content (108 lines) | stat: -rw-r--r-- 2,229 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/****************************************************************************
** main.cpp 19980824 A. Mustun RibbonSoft
**
** Copyright (C) 1998 RibbonSoft, Andreas Mustun.  All rights reserved.
**
*****************************************************************************/


#include <qapplication.h>
#include <qdatetime.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qpixmap.h>
#include <qplatinumstyle.h>
#include <qtimer.h>
#include <qwindowsstyle.h>

#include "rappwin.h"
#include "rconfig.h"
#include "rfonts.h"
#include "rconfig.h"
#include "rlog.h"

int 
main(int argc, char** argv) {

  int ret;

  QApplication app(argc, argv);

  // Read INI/CXL-File:
  //
  QFileInfo prgInfo(argv[0]);
  QDir prgDir(prgInfo.dirPath(true));
  RCONFIG->setPrgDir(prgDir);        // CWD is program directory
  RCONFIG->createConfigFile(false);  // Create config file ~/.qcad/qcad.conf if there's none
  RCONFIG->readConfigFile();         // Read config file
  RCONFIG->createLanguageList();     // Compile the list of available languages (for Options dialog)
  RCONFIG->readCxlFile();            // Read language file

  RAppWin* appWin = RAppWin::getRAppWin();

  // Set Application style:
  //
  QApplication::setStyle( new QWindowsStyle() );
  //QApplication::setStyle( new QPlatinumStyle() );
  app.setMainWidget(appWin);

  // Show application window:
  //
  appWin->show();
  appWin->resizeChildren();
 
  // Show Intro:
  //
#ifndef DEF_LESS_DIALOGS
  appWin->showIntro();
  QTimer::singleShot(1500, appWin, SLOT(closeIntro()));
#endif

  // Read Fonts:
  //
  RFonts::getRFonts();

#ifdef DEF_DEMO
  QDate today = QDate::currentDate();
  QDate expiryDate;
  
  expiryDate.setYMD(DEF_EXPIRY_DATE);
  
  if(today>=expiryDate) {
    QMessageBox::warning(appWin, DEF_APPNAME, DEF_EXPIRED_MESSAGE);
  }
  else {
    char msg[255];
    sprintf(msg, "%s %d %s", RMES(420), today.daysTo(expiryDate), RMES(421));
    QMessageBox::warning(appWin, DEF_APPNAME, msg);
  }
#endif

  // Load file if given:
  //
  if(argc>1) {
    for(int i=1; i<argc; ++i) {
      appWin->fileOpen(argv[i]);
    }
  }
  
  // Execute application:
  //
  ret=app.exec();

  RCONFIG->createConfigFile(true);

  return ret;

}


// EOF