File: main.cpp

package info (click to toggle)
xdrawchem 1.0-0.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,820 kB
  • ctags: 2,389
  • sloc: cpp: 17,801; makefile: 263; ansic: 168
file content (54 lines) | stat: -rw-r--r-- 1,485 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
/****************************************************************************
** $Id: qt/examples/application/main.cpp   2.2.4   edited 2000-08-31 $
**
** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
**
** This file is part of an example program for Qt.  This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/

#include <qapplication.h>
#include <qnetwork.h>
#include <qstring.h>
#include <qfile.h>
//#include <stdlib.h>
//#include <time.h>
#include <qtranslator.h>
#include <qtextcodec.h>

#include "application.h"
#include "clipboard.h"
#include "defs.h"

QString RingDir;

int main( int argc, char ** argv ) {
  int ae;
#ifdef UNIX
  QString dname(RINGHOME);
  if (dname.right(1) != QString("/"))
    dname.append(QString("/"));
#else
  QString dname("ring\\");
#endif
  RingDir = dname;
  QApplication a( argc, argv );
  qInitNetworkProtocols();

  // translation file for application strings
  QTranslator myapp( 0 );
  myapp.load( QString( "xdrawchem_" ) + QTextCodec::locale(), RingDir );
  a.installTranslator( &myapp );

  Clipboard *cb = new Clipboard;
  ApplicationWindow * mw = new ApplicationWindow(cb);
  mw->setCaption( QString(XDC_VERSION) + QString(" - ") + 
		  mw->tr("untitled") );
  if (argc > 1)
    mw->load(QString(argv[1]));
  mw->show();
  a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
  ae = a.exec();
  return ae;
}