int main(int argc, char *argv[]) { if (!fx_init()) { fprintf(stderr, "init the libfetion fail \n"); exit(0); } init_db(); #ifdef WIN32 #else //compatible old app's config file moveOldConfigFile(); #endif QApplication app(argc, argv); QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); #ifdef HAVE_LOG4QT_DEBUG_ENABLED /*FIXME: real log4qt configuration path */ Log4Qt::PropertyConfigurator::configure( app.applicationDirPath() + "/log4qt.properties"); #endif QTranslator translator_fetion; translator_fetion.load("fetion_utf8_CN", defaultResPath()); QTranslator translator_qt; translator_qt.load("qt_zh_CN", defaultResPath()); app.installTranslator(&translator_fetion); app.installTranslator(&translator_qt); app.setFont(Settings::instance().getCurrentFont()); setSkins(Settings::instance().SkinPath(), Settings::instance().SkinName()); FxMain *mainWin = new FxMain(); app.setQuitOnLastWindowClosed(false); int reslut = app.exec(); if (mainWin) { delete mainWin; } destoy_db(); //destroy the libfetion fx_terminate(); return reslut; }
/*! \class MainWindow mainwindow.h \brief Class fills graphical user interface with controls. */ MainWindow::MainWindow() : QWidget(0, Qt::FramelessWindowHint), m_embedded(false) { // create a widget we can access in CSS: QWidget#PatientCare QWidget* top = new QWidget(this); #if defined(Q_WS_HILDON) || defined(Q_WS_S60) || defined(Q_WS_QWS) || defined(Q_OS_WINCE) m_embedded = true; #endif if (QApplication::arguments().contains("-embedded")) m_embedded = true; if (QApplication::arguments().contains("-no-embedded")) m_embedded = false; m_embOffSwitch = QApplication::arguments().contains("-embOffSwitch"); ui.setupUi(top); connect(ui.switchNightMode, SIGNAL(toggled(bool)), this, SLOT(toggleNightMode(bool))); setWindowTitle("PatientCare (Demo)"); setWindowIcon(QIcon(":/qt-logo32x32")); setSkins(); ui.switchSystemOff->setChecked(true); ui.switchNightMode->setChecked(true); toggleNightMode(true); m_controller = new PatientCareController(&ui, this); if (!m_embedded) { updateDecoration(); top->setGeometry(153, 95, 636, 476); QtSvgToggleSwitch* offSwitch = new QtSvgToggleSwitch(this); offSwitch->setSkin("Beryl"); offSwitch->setChecked(true); offSwitch->setGeometry(795, 568, 50, 50); connect(offSwitch, SIGNAL(toggled(bool)), top, SLOT(setVisible(bool))); connect(offSwitch, SIGNAL(toggled(bool)), this, SLOT(quitDelay())); } else {