Ejemplo n.º 1
0
int main( int argc, char ** argv )
{
    PCSingleApplication a(argc, argv);
    if ( !a.isPrimaryProcess() ){ return 0; }

    QTranslator translator;
    QLocale mylocale;
    QString langCode = mylocale.name();
    if ( ! QFile::exists( "/usr/local/share/pcbsd/i18n/Warden_" + langCode + ".qm" ) )
      langCode.truncate(langCode.indexOf("_"));
    translator.load( QString("Warden_") + langCode, "/usr/local/share/pcbsd/i18n/" );
    a.installTranslator( &translator );
    qDebug() << "Locale:" << langCode;
    QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") ); //Force Utf-8 compliance

    dialogWarden *w = new dialogWarden();
    w->programInit();
    w->show();
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), w, SLOT(slotSingleInstance()) );
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    return a.exec();
}
Ejemplo n.º 2
0
//#define DEBUG 0
int main(int argc, char ** argv)
{
    qDebug() << "Starting lumina-wm...";
    LTHEME::LoadCustomEnvSettings();
    LSingleApplication a(argc, argv, "lumina-wm");
    if(!a.isPrimaryProcess()){ return 0; } //Inputs forwarded on to the primary already
    LuminaThemeEngine themes(&a);
    
    //Setup the special settings prefix location
    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
    //Setup the global structures
    LWM::SYSTEM = new LXCB();
    if(argc>1 && QString::fromLocal8Bit(argv[1])=="testwin"){
      //Simple override to test out the window class
      qDebug() << "Starting window test...";
      QLabel dlg(0, Qt::Window | Qt::BypassWindowManagerHint); //this test should be ignored by the current WM
      dlg.setText("Sample Window");
      dlg.setWindowTitle("Test");
      dlg.setGeometry(100,100,200,100);
      dlg.setStyleSheet("background: rgba(255,255,255,100); color: black;");
      dlg.show();
      qDebug() << " - Loading window frame...";
      LWindow win(dlg.winId()); //have it wrap around the dialog
      qDebug() << " - Show frame...";
      win.windowChanged(LWM::Show);
      qDebug() << " - Start event loop...";
      a.setQuitOnLastWindowClosed(true);
      return a.exec();
    }
    WMSession w;
    w.start();
    QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(reloadIcons()) );
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(newInputsAvailable(QStringList)) );
    int retCode = a.exec();
    
    return retCode;
}