Example #1
0
bool ImageFileOpt::LoadQssFile(const QString &pathQSS, QApplication *qApplication)
{
    //加载CSS样式表文件并应用相应样式
    QFile qssFile(pathQSS);
    if(qssFile.exists())
    {
        qssFile.open(QFile::ReadOnly);
        if(qssFile.isOpen())
        {
            QString qss = QLatin1String(qssFile.readAll());
            qApplication->setStyleSheet(qss);
            qssFile.close();
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        QMessageBox::warning(NULL,"Qss文件错误",pathQSS+"找不到!");
        return false;
    }
}
Example #2
0
Login::Login(QWidget *parent) :
    QWidget(parent)
{
    setFixedSize(400,300);
    //setWindowFlags(Qt::FramelessWindowHint);
    setWindowFlags(Qt::FramelessWindowHint|Qt::Tool);
    setWindowTitle("Smart L");
    setWindowIcon(QIcon(":/logo/logo"));
    Resource_init();

    /*
    setStyleSheet("QToolButton {color:white;background-color: rgb(23, 197, 104);} \
                  QToolButton::hover{color:white;background-color: rgb(23, 209, 1);}; \
                ");*/
    Qrcode_Layout_init(); //二维码登录
    Login_layout_init();
    Bottom_menu_init();
    translation();
    Visable_qrocde = false;
    QString qss;
    QFile qssFile(":/qss/login");
    qssFile.open(QFile::ReadOnly);
    if(qssFile.isOpen())
    {
        qDebug() << "---\n";
        qss = QLatin1String(qssFile.readAll());
  //      qDebug() << qss;
        this->setStyleSheet(qss);
        qssFile.close();
    }
}
Example #3
0
void GlobalConfigWidget::writeSettings()
{
   Settings::setValue( Settings::CommonUseSatellite, mpUseSatellite->isChecked() );
   Settings::setValue( Settings::GlobalSatellitePort, mpSatellitePort->value() );
   Settings::setValue( Settings::CommonUseGlobalStyleSheetFile, mpUseGlobalStyleSheetFile->isChecked() );
   Settings::setValue( Settings::GlobalStyleSheetFile, mGlobalStyleSheetFileName );
   Settings::setValue( Settings::CommonStyleSheetFile, mApplicationStyleSheetFileName );
   Settings::setValue( Settings::GlobalClipboardMode, mpClipboardSelection->currentIndex() );
   Settings::setValue( Settings::GlobalAnimateViews, mpAnimateViews->isChecked() );
   Settings::setValue( Settings::GlobalNormalizeCase, mpNormalizeCase->isChecked() );
   Settings::setValue( Settings::GlobalNormalizeSpaces, mpNormalizeSpaces->isChecked() );
   Settings::setValue( Settings::GlobalDoubleClickInterval, mpDoubleClickInterval->value() );

   QApplication::setDoubleClickInterval( mpDoubleClickInterval->value() );

   QFile qssFile( mpUseGlobalStyleSheetFile->isChecked() ?
                     mGlobalStyleSheetFileName :
                     mApplicationStyleSheetFileName );
   if( qssFile.exists() && qssFile.open( QIODevice::ReadOnly ) )
   {
      qApp->setStyleSheet( qssFile.readAll() );
      qssFile.close();
   }
   else
   {
      qApp->setStyleSheet( QString() );
   }
}
//    qDebug() << "grabTimes:" << m_timerCount;
//    if (m_timerCount == 10) {
//        m_getFocusTimer->stop();
//    } else {
//        this->grabKeyboard();
//        m_timerCount++;
//    }
//}
void ShutdownManager::initUI()
{
    setObjectName("ShutdownManager");
    resize(qApp->desktop()->screenGeometry().size());

    m_content = new MainFrame(this);

    m_Layout = new QHBoxLayout;
    m_Layout->setMargin(0);
    m_Layout->setSpacing(0);
    m_Layout->addStretch();
    m_Layout->addWidget(m_content);
    m_Layout->addStretch();

    // hide user switch btn when only 1 user avaliable
    UserWidget *users = new UserWidget;
    if (users->count() < 2) {
        m_content->hideBtns(QStringList() << "SwitchUser");
    }
    users->deleteLater();

    QFile qssFile(":/skin/main.qss");
    QString qss;
    qssFile.open(QFile::ReadOnly);
    if (qssFile.isOpen()) {
        qss = QLatin1String(qssFile.readAll());
        this->setStyleSheet(qss);
        qssFile.close();
    }

    setLayout(m_Layout);
}
SeanPptProgressWdg::SeanPptProgressWdg(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	QFile qssFile(":/qss/setting.qss");
	QString qss;
	qssFile.open(QFile::ReadOnly);
	if(qssFile.isOpen())
	{  
		qss = QString(qssFile.readAll());
		this->setStyleSheet(qss);
		qssFile.close();
	}

	index = 1;
	QPixmap pixmap(QString(":/setting/setting/00900"));
	ui.imageLabel->setPixmap(pixmap);
	ui.imageLabel->setScaledContents(true);

	timer = new QTimer(this);
	timer->setInterval(100);
	connect(timer, SIGNAL(timeout()), this,SLOT(updatePixmap()));
 	timer->start();
}
Example #6
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
//    resize(1198,674);

    //引用样式文件
    QString qss;
    QFile qssFile(":/qss/widget.qss");
    qssFile.open(QFile::ReadOnly);
    if(qssFile.isOpen())
    {
        qss = QLatin1String(qssFile.readAll());
        qApp->setStyleSheet(qss);
        qssFile.close();
    }
    //初始化页面菜单导航栏样式
//    ui->groupBox->setStyleSheet("QPushButton{background-color:black;color:#95a0aa}");
    ui->welcomeBtn->setStyleSheet("QPushButton#welcomeBtn{background-color:red; color:white}");
    ui->mapBoardSkd->setCurrentWidget(this->welWidget);
    ui->controlBoardSkd->hide();

    //添加中央监控显示页面Widget
    this->mapWidget = new Map;
    ui->mapBoardSkd->addWidget(mapWidget);
    this->welWidget = new WelcomePage;
    ui->mapBoardSkd->addWidget(welWidget);
    this->carMapWidget = new CarMap;
    ui->mapBoardSkd->addWidget(carMapWidget);
    //

    //添加右侧控制面板widget
    this->carcontrollBoard = new CarControllBoard;
    ui->controlBoardSkd->addWidget(carcontrollBoard);
    this->lightcontrollBoard = new LightControllBoard;
    ui->controlBoardSkd->addWidget(lightcontrollBoard);


    //连接菜单导航点击切换界面槽函数
    connect(ui->welcomeBtn,SIGNAL(clicked(bool)),
            this,SLOT(on_welcomeBtn_clicked()));
    connect(ui->mainBtn,SIGNAL(clicked(bool)),
            this,SLOT(on_mainBtn_clicked()));
    connect(ui->carMapBtn,SIGNAL(clicked(bool)),
            this,SLOT(on_carMapBtn_clicked()));
    connect(ui->aboutBtn,SIGNAL(clicked(bool)),
            this,SLOT(on_aboutBtn_clicked()));
    connect(ui->helpBtn,SIGNAL(clicked(bool)),
            this,SLOT(on_helpBtn_clicked()));



}
Example #7
0
/**
 *@brief Set the style sheet of main dialog.
 */
void QDialogUI::set_stylesheet()
{
    QString qss;
    QFile qssFile(":/qss/theme/default.qss");
    qssFile.open(QFile::ReadOnly);
    if(qssFile.isOpen())
    {
        qss = QLatin1String(qssFile.readAll());
        this->setStyleSheet(qss);
        qssFile.close();
    }
}
 //load qss file to change native UI of the application
static void loadQssFile(QApplication &app, const QString &qssFileName){
    QFile qssFile(qssFileName);
    QString qssContent("");

    if(qssFile.open(QFile::ReadOnly)){
        QTextStream iStream(&qssFile);
        qssContent = iStream.readAll();
        qssFile.close();
    }

    app.setStyleSheet(qssContent);
}
//set stylesheet for main window
void set_StyleSheet()
{
    QString qss;
    QFile qssFile(":/qss/StyleSheet.css");
    qssFile.open(QFile::ReadOnly);

    if (qssFile.isOpen())
    {
       qss = QLatin1String(qssFile.readAll());
       qApp->setStyleSheet(qss);
       qssFile.close();
     }
}
Example #10
0
void MainPage::LoadQSS()
{
    QString filePath = LAppParam::GetDefaultQssPath();
    filePath += "MainPage.qss";
    QFile qssFile(filePath);   
    qssFile.open(QFile::ReadOnly);  

    if(qssFile.isOpen())  
    {  
        QString qss = qssFile.readAll();
        qssFile.close();  

        this->setStyleSheet(qss);
    }  
}
Example #11
0
File: appui.cpp Project: twokk/kk
/**
* 初始化样式
* @stypeFile 样式文件
*/
void AppUi::setupStyleSheet(QString styleFile)
{
    QString qss;
    QFile qssFile(styleFile);
    qssFile.open(QFile::ReadOnly);
    if(qssFile.isOpen())
    {
        qss = QLatin1String(qssFile.readAll());
        qApp->setStyleSheet(qss);
        qssFile.close();
    }

    QPalette palette;
    palette.setBrush(QPalette::Background, QBrush(QPixmap(APP_DOCK_BAR_BACKGROUND_IMAGE)));
    this->setPalette(palette);
}
Example #12
0
void Player::setSkin(const QString& skin_name)
{
    QDir dir = QDir(Settings::path);
    dir.cd("skins");
#ifdef Q_OS_WIN
    dir.cd(skin_name);
#else
    if (!dir.cd(skin_name))
        dir = QDir(QDir::homePath() + "/.lplayer/skins/" + skin_name);
#endif
    // Load skin.qml
    if (chdir(dir.absolutePath().toUtf8().constData()))
    {
        QMessageBox::warning(this, "Error", tr("Failed to read skin!"));
        exit(EXIT_FAILURE);
    }
    QFile qssFile("skin.qss");
    if (!qssFile.open(QFile::ReadOnly | QFile::Text))
    {
        QMessageBox::warning(this, "Error", tr("Failed to read skin!"));
        exit(EXIT_FAILURE);
    }
    QString qss = QString::fromUtf8(qssFile.readAll());
    qssFile.close();
    setStyleSheet(qss);

    // Set fixed sizes
    QFile sizeFile("fixed_sizes");
    if (sizeFile.open(QFile::ReadOnly | QFile::Text))
    {
        QByteArray data = sizeFile.readAll().simplified().replace(" ", "");
        sizeFile.close();
        QStringList sizeInfos = QString::fromUtf8(data).split(';', QString::SkipEmptyParts);
        foreach (QString item, sizeInfos) {
            QStringList properties = item.split(',');
            QWidget *widget = findChild<QWidget*>(properties[0]);
            if (widget)
            {
                int w = properties[1].toInt(), h = properties[2].toInt();
                if (w)
                    widget->setFixedWidth(w);
                if (h)
                    widget->setFixedHeight(h);
                widget->setFocusPolicy(Qt::NoFocus);
            }
        }
CommentDialog::CommentDialog(QString MI_ID, QString User_ID, QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	this->mediaID = MI_ID;
	this->userID = User_ID;

	this->ui.TextEdit_commentText->setFocus();

	QString qss_commentDialog;
	QFile qssFile(":/qss/qss_commentDialog.qss");
	qssFile.open(QFile::ReadOnly);

	if(qssFile.isOpen())
	{
		qss_commentDialog = QLatin1String(qssFile.readAll());
		this->setStyleSheet(qss_commentDialog);
		qssFile.close();
	}
}
Example #14
0
Music_Frame::Music_Frame(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Music_Frame)
{
    ui->setupUi(this);
    QString qss;
    QFile qssFile(":/qss/music_frame");
    qssFile.open(QFile::ReadOnly);
    if(qssFile.isOpen())
    {
   //     qDebug() << "---\n";
        qss = QLatin1String(qssFile.readAll());
  //      qDebug() << qss;
        this->setStyleSheet(qss);
        qssFile.close();
    }
    PaihangBang_Init();
    translations();
    connect(ui->return_Btn,SIGNAL(clicked()),this,SIGNAL(signal_return()));
}
Example #15
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    readWindowSettings();
    setWindowTitle(tr("Sbrowser"));
    //createTrayIcon();

    // Таймер запоминания состояния
    writeWindowSettingsTimer = new QTimer(this);
    connect(writeWindowSettingsTimer, SIGNAL(timeout()), this, SLOT(writeWindowSettings()));
    writeWindowSettingsTimer->start(30 * 1000);

    sbrowserWidget = new SbrowserWidget(this);
    setCentralWidget(sbrowserWidget);

    // Прочитаем и установим стили
    QFile qssFile(":/qss/qss/sbrowserWidget.qss");
    qssFile.open(QFile::ReadOnly);
    styleSheet = QLatin1String(qssFile.readAll());
    setStyleSheet(styleSheet);
}
Example #16
0
Form::Form(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Form)
{
    ui->setupUi(this);
    i=0;
    setWindowFlags(Qt::FramelessWindowHint|Qt::Tool);
    QMovie *movie = new QMovie(":/red69-2.gif");
     ui->label->setMovie(movie);
     ui->label_2->installEventFilter(this);
     ui->label_3->installEventFilter(this);
     movie->start();
     //QImage image;
     //image.load(":/10.jpeg");
     //QImage result = image.scaled(85, 85, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
     //ui->label_4->setPixmap(QPixmap::fromImage(result));
     ui->label_4->setStyleSheet("border-radius:15px;background-color:green;border-image:url(':/11.jpg')");
     ui->label_5->setOpenExternalLinks(true);

     ui->label_5->installEventFilter(this);
     animation=new QPropertyAnimation(ui->label_4, "geometry");
     animation->setDuration(400);
     animation->setStartValue(QRect(30, 170, 85, 85));
     animation->setEndValue(QRect(150, 170, 85, 85));

     QString qss;
       QFile qssFile(":/myqss/login.qss");
       qssFile.open(QFile::ReadOnly);
       qDebug()<<"sdfasd";
       if(qssFile.isOpen())
       {

         qss = QLatin1String(qssFile.readAll());
         this->setStyleSheet(qss);
         qssFile.close();
         qDebug()<<"成功引入qss";
       }

}
Example #17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    strIconApp(":/AppIcon/Resources/AppIcon_ArchitectureBuilding_96px.ico"),
    strIconConnectCardReader(":/ToolbarIcons/Resources/connect_72px.ico"),
    strIconDisconnectCardReader(":/ToolbarIcons/Resources/disconnect_72px.ico"),
    strIconOwnerCard(":/ToolbarIcons/Resources/users_72px.ico"),
    strIconManagerCard(":/ToolbarIcons/Resources/administrator_72px.ico"),
    strIconFunctionCard(":/ToolbarIcons/Resources/FuncCard_72px.ico"),
    strIconRemoteOperation(":/ToolbarIcons/Resources/remote_72px.ico"),
    strIconStatisticalAnalysis(":/ToolbarIcons/Resources/Statistics_72px.ico"),
    strIconElevatorManage(":/ToolbarIcons/Resources/Management_72px.ico"),
    strIconSystemSetting(":/ToolbarIcons/Resources/setting_72px.ico"),
    strIconHelpSupport(":/ToolbarIcons/Resources/Help_72px.ico"),
    strIconExitApp(":/ToolbarIcons/Resources/exit_72px.ico"),
    strPathQssFile(":/CSS/StyleSheet.qss"),
    clrBKApp(QColor(100,200,200)),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    pMainWnd=this;

    //读取ini配置文件
    setIniFile=new QSettings("AppSetting.ini",QSettings::IniFormat);
    setIniFile->setIniCodec(QTextCodec::codecForName("GB2312"));
    //setIniFile->setValue("/SystemSetting/Company", "北京凯瑞通电子技术有限公司");
    setIniFile->beginGroup("SystemSetting");
    QString strCompanyName=setIniFile->value("Company").toString();
    setIniFile->endGroup();

    //加载CSS样式表文件并应用相应样式
    QFile qssFile(strPathQssFile);
    if(qssFile.exists())
    {
        qssFile.open(QFile::ReadOnly);
        if(qssFile.isOpen())
        {
            QString qss = QLatin1String(qssFile.readAll());
            qApp->setStyleSheet(qss);
            qssFile.close();
        }
    }
    else
    {
        QMessageBox::warning(NULL,"Qss文件错误",strPathQssFile+"找不到!");
        return;
    }

    //限制窗口大小
    this->setMaximumSize(1500,1000);

    //设置应用程序背景色
    QPalette *paletteApp=new QPalette();
    paletteApp->setColor(QPalette::Background,clrBKApp);
    this->setPalette(*paletteApp);
    delete paletteApp;

    //设置应用程序图标
    this->setWindowIcon(QIcon(strIconApp));

    //隐藏标题栏
    this->setWindowFlags(Qt::FramelessWindowHint);
    //主窗体菜单栏初始化
    ui->menuBar->hide();
    //主窗体状态栏初始化
    strUsrName = "abc";
    strUsrLevel = "系统管理员";
    QString strLabelUsrInfo = "用户名:"+strUsrName+" 用户级别:"+strUsrLevel;
    QLabel *labelCompanyName=new QLabel;
    labelCompanyName->setText(strLabelUsrInfo);
    statusBar()->addWidget(labelCompanyName);
    //主窗体工具栏初始化
    InitToolBar();
    //主窗体Tabs初始化
    InitTabs();
    //主窗体信息窗口初始化
    InitVBoxInfos();
    //主窗体框架初始化
    layoutHBoxMain=new QHBoxLayout(ui->centralWidget);
    layoutHBoxMain->addLayout(layoutVBoxTabs);
    layoutHBoxMain->addWidget(grpboxInfos);
    TabWidgetDisplay(0);

    //获取MainWindows的句柄
    hMainWnd=(HWND)this->winId();
    //启动指定序号设备插拔监视
    ch375rw.SetDeviceNotify();

    //检查读卡器是否连接上
    bool isConnected;
    if(!ch375rw.OpenDevice())
    {
        isConnected=false;       
    }
    else
    {
        isConnected=true;
        ch375rw.Beep(1);
    }
    isConnected=true;
    ConnectedCardReader(isConnected);
}
Example #18
0
/*! \fn main
 *
 * \brief program entry point
 *
 * Set some static Qt parameters for using QSettings,
 * instantiate a MainWidget window and a BaseEngine object.
 *
 * \sa MainWidget, BaseEngine
 */
int main(int argc, char ** argv)
{
    QString locale = QLocale::system().name();
    // QApplication::setStyle(new XiVOCTIStyle());
    QCoreApplication::setOrganizationName("XIVO");
    QCoreApplication::setOrganizationDomain("xivo.fr");
    QCoreApplication::setApplicationName("XIVO_Client");
    PowerAwareApplication app(argc, argv);
    if(app.isRunning()) {
        qDebug() << "application is already running";
        // do not create a new application, just activate the currently running one
        QString msg;
        if(argc > 1) {
            // send message if there is an argument.
            // see http://people.w3.org/~dom/archives/2005/09/integrating-a-new-uris-scheme-handler-to-gnome-and-firefox/
            // to learn how to handle "tel:0123456" uri scheme
            msg.append(argv[1]);
            bool sentmsg = app.sendMessage(msg);
            qDebug() << "sent message" << msg << sentmsg;
        }
        return 0;
    }
    QSettings *settings = new QSettings(QSettings::IniFormat,
                                        QSettings::UserScope,
                                        QCoreApplication::organizationName(),
                                        QCoreApplication::applicationName());
    qDebug() << "style" << app.style() << settings->fileName();

    QString profile = "default-user";
    if(argc > 1) {
        QString arg1(argv[1]);

        if((!arg1.startsWith("tel:", Qt::CaseInsensitive)) &&
           (!arg1.startsWith("callto:", Qt::CaseInsensitive))) {
            profile = arg1;
        }
    }
    settings->setValue("profile/lastused", profile);

    QString qsskind = settings->value("display/qss", "none").toString();

    QFile qssFile(QString(":/common/%1.qss").arg(qsskind));
    if(qssFile.open(QIODevice::ReadOnly)) {
        app.setStyleSheet(qssFile.readAll());
    }

    app.setWindowIcon(QIcon(":/images/xivo-login.png"));

    QString forcelocale = settings->value("engine-" + profile + "/forcelocale", "").toString();
    if(forcelocale.length())
        locale = forcelocale;

    QTranslator *translator;
    QStringList translationFiles = \
        (QStringList() << ":/xivoclient_%1"
                       << ":/baselib/baselib_%1"
                       << QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_%1" );

    int i;
    for(i=0;i<translationFiles.size();++i) {
        translator = new QTranslator;
        translator->load(translationFiles.at(i).arg(locale));
        app.installTranslator(translator);
    }

    QString info_osname;
    QString info_endianness = QSysInfo::ByteOrder ? "LE" : "BE";

#if defined(Q_WS_X11)
    info_osname = QString("X11-%1-%2").arg(info_endianness).arg(app.applicationPid());
#elif defined(Q_WS_WIN)
    info_osname = QString("WIN-%1-0x%2-%3").arg(info_endianness).arg(QSysInfo::WindowsVersion, 2, 16, QChar('0')).arg(app.applicationPid());
#elif defined(Q_WS_MAC)
    info_osname = QString("MAC-%1-0x%2-%3").arg(info_endianness).arg(QSysInfo::MacintoshVersion, 2, 16, QChar('0')).arg(app.applicationPid());
#else
    info_osname = QString("unknown-%1-%2").arg(info_endianness).arg(app.applicationPid());
#endif
    qDebug() << "main() osname=" << info_osname << "locale=" << locale;
    
    BaseEngine *engine = new BaseEngine(settings, info_osname);

    MainWidget window;
    app.setActivationWindow(&window);

    app.setQuitOnLastWindowClosed(false);
    app.setProperty("stopper", "lastwindow");
    
    QObject::connect(&app, SIGNAL(standBy()),
                     engine, SLOT(stop()));
    QObject::connect(&app, SIGNAL(resume()),
                     engine, SLOT(start()));
    QObject::connect(&app, SIGNAL(powerEvent(const QString &)),
                     engine, SLOT(powerEvent(const QString &)));
    QObject::connect(&app, SIGNAL(messageReceived(const QString &)),
                     engine, SLOT(handleOtherInstanceMessage(const QString &)));
    
    return app.exec();
}
Example #19
0
// argc has to be a reference, or QCoreApplication will segfault
ExecObjects init_xivoclient(int & argc, char **argv)
{
    ExecObjects ret;
    QCoreApplication::setOrganizationName("XIVO");
    QCoreApplication::setOrganizationDomain("xivo.fr");
    QCoreApplication::setApplicationName("XIVO_Client");
    PowerAwareApplication *app = new PowerAwareApplication(argc, argv);

    FileOpenEventHandler* fileOpenHandler = new FileOpenEventHandler(app, app);
    app->installEventFilter(fileOpenHandler);

    QSettings * settings = new QSettings(QSettings::IniFormat,
                                         QSettings::UserScope,
                                         QCoreApplication::organizationName(),
                                         QCoreApplication::applicationName());
    qDebug() << "Reading configuration file" << settings->fileName();

    QString profile = "default-user";
    QString msg = "";
    for (int i = 1; i < argc; i ++) {
        QString arg_str(argv[i]);
        if (arg_str.length() == 0 || arg_str.contains(str_socket_arg_prefix)) {
            continue;
        }
        if(! PhoneNumber::isURI(arg_str)) {
            profile = arg_str;
        } else {
            msg = PhoneNumber::extract(arg_str);
        }
    }

    qDebug() << "Selected profile: " << profile;

    if (! msg.isEmpty()) {
        // send message if there is an argument.
        // see http://people.w3.org/~dom/archives/2005/09/integrating-a-new-uris-scheme-handler-to-gnome-and-firefox/
        // to learn how to handle "tel:0123456" uri scheme
        app->sendMessage(msg);
        // warning : this sends the message only to the first instance, if ever there are >1 instances running
    }

    app->setWindowIcon(QIcon(":/images/xivo-login.png"));

    QString info_osname;
    QString info_endianness = QSysInfo::ByteOrder ? "LE" : "BE";

#if defined(Q_WS_X11)
    info_osname = QString("X11-%1-%2")
        .arg(info_endianness)
        .arg(app->applicationPid());
#elif defined(Q_WS_WIN)
    info_osname = QString("WIN-%1-0x%2-%3")
        .arg(info_endianness)
        .arg(QSysInfo::WindowsVersion, 2, 16, QChar('0'))
        .arg(app->applicationPid());
#elif defined(Q_WS_MAC)
    info_osname = QString("MAC-%1-0x%2-%3")
        .arg(info_endianness)
        .arg(QSysInfo::MacintoshVersion, 2, 16, QChar('0'))
        .arg(app->applicationPid());
#else
    info_osname = QString("unknown-%1-%2")
        .arg(info_endianness)
        .arg(app->applicationPid());
#endif

    bool shallbeunique = settings->value("display/unique").toBool();
    if (shallbeunique && app->isRunning()) {
        qDebug() << Q_FUNC_INFO << "unique mode : application is already running : exiting";
        // do not create a new application, just activate the currently running one
        ret.initOK = false;
        return ret;
    }

    settings->setValue("profile/lastused", profile);

    b_engine = new BaseEngine(settings, info_osname);

    QString qsskind = b_engine->getConfig("qss").toString();

    QFile qssFile(QString(":/%1.qss").arg(qsskind));
    if(qssFile.open(QIODevice::ReadOnly)) {
        app->setStyleSheet(qssFile.readAll());
    }
    assembler = new Assembler();
    if (! assembler) {
        qDebug() << Q_FUNC_INFO << "Failed to instantiate the Assembler";
        return ret;
    }
    MainWindow *main_window = assembler->mainWindow();
    main_window->initialize();

    bool activate_on_tel = b_engine->getConfig("activate_on_tel").toBool();
    app->setActivationWindow(main_window, activate_on_tel);
    fileOpenHandler->setActivationWindow(activate_on_tel);

    app->setQuitOnLastWindowClosed(false);
    app->setProperty("stopper", "lastwindow");

    QObject::connect(app, SIGNAL(standBy()),
                     b_engine, SLOT(stop()));
    QObject::connect(app, SIGNAL(resume()),
                     b_engine, SLOT(start()));
    QObject::connect(app, SIGNAL(powerEvent(const QString &)),
                     b_engine, SLOT(powerEvent(const QString &)));
    QObject::connect(app, SIGNAL(messageReceived(const QString &)),
                     b_engine, SLOT(handleOtherInstanceMessage(const QString &)));
    QObject::connect(fileOpenHandler, SIGNAL(dialNumber(QString)),
                     b_engine, SLOT(handleOtherInstanceMessage(const QString &)));

    ret.app = app;
    ret.win = main_window;
    ret.baseengine = b_engine;
    ret.initOK = true;

#ifdef FUNCTESTS
    QString socket = "/tmp/xc-default.sock";
    for (int i = 1; i < argc; i ++) {
        QString arg_str(argv[i]);
        if (arg_str.contains(str_socket_arg_prefix)) {
            socket = arg_str.replace(str_socket_arg_prefix, "");
        }
    }
    qDebug() << "Selected RC socket: " << socket;

    ret.rc = new RemoteControl(ret, socket);
#endif

    return ret;
}