コード例 #1
0
ファイル: qcompanion.cpp プロジェクト: kwplummer/QCompanion
/*!
 * \brief Constructs the UI and sets up timers
 * \details Creates the tray, the icons, loads Components, and sets up all the
 * connections.
 * \param parent Used for Qt's memory management.
 */
QCompanion::QCompanion(QWidget *parent)
    : QDialog(parent),
      speaker(this, QCoreApplication::applicationDirPath() + "/murasaki.png"),
      ui(new Ui::QCompanion)
{
  ui->setupUi(this);
#ifdef Q_OS_WIN
  connect(&speaker, SIGNAL(showMessage(QString)), this,
          SLOT(displayMessage(QString)));
#else
  new QcompanionAdaptor(this);
  QDBusConnection dbus = QDBusConnection::sessionBus();
  dbus.registerObject("/", this);
  dbus.registerService("com.coderfrog.qcompanion");
#endif
  iconPath = QCoreApplication::applicationDirPath() + "/murasaki.png";
  tray = new QSystemTrayIcon(QIcon(iconPath), this);
  setWindowIcon(tray->icon());
  tray->show();
  QMenu *mainMenu = loadPlugins();

  QAction *speakClipboardAction = new QAction("Speak Clipboard", this);
  mainMenu->addAction(speakClipboardAction);

  toggleNotificationsAction = new QAction("Disable Notifications", this);
  mainMenu->addAction(toggleNotificationsAction);

  toggleTTSAction = new QAction("Disable Text To Speech", this);
  mainMenu->addAction(toggleTTSAction);

  QAction *quitAction = new QAction("Quit", this);
  mainMenu->addAction(quitAction);

  tray->setContextMenu(mainMenu);

  connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));
  connect(toggleTTSAction, SIGNAL(triggered()), this, SLOT(toggleTTS()));
  connect(toggleNotificationsAction, SIGNAL(triggered()), this,
          SLOT(toggleNotifications()));
  connect(speakClipboardAction, SIGNAL(triggered()), this,
          SLOT(speakClipboard()));
}
コード例 #2
0
SingleApplication::SingleApplication(int &argc, char **argv, StartOptions options)
    : Application(argc, argv),
    mActivationWindow(0)
{
    QString service =
        QString::fromLatin1("org.lxqt.%1").arg(QApplication::applicationName());

    SingleApplicationAdaptor *mAdaptor = new SingleApplicationAdaptor(this);
    QDBusConnection bus = QDBusConnection::sessionBus();

    if (!bus.isConnected()) {
        QLatin1String errorMessage("Can't connect to the D-Bus session bus\n"
                                   "Make sure the D-Bus daemon is running");

        /* ExitOnDBusFailure is the default. Any value other than
           NoExitOnDBusFailure will be taken as ExitOnDBusFailure (the default).
         */
        if (options == NoExitOnDBusFailure) {
            qDebug() << Q_FUNC_INFO << errorMessage;
            return;
        } else {
            qCritical() << Q_FUNC_INFO << errorMessage;
            QTimer::singleShot(0, [this] { exit(1); });
        }
    }

    bool registered = (bus.registerService(service) ==
                       QDBusConnectionInterface::ServiceRegistered);
    if (registered) { // We are the primary instance
        QLatin1String objectPath("/");
        bus.registerObject(objectPath, mAdaptor,
            QDBusConnection::ExportAllSlots);
    } else { // We are the second outstance
        QDBusMessage msg = QDBusMessage::createMethodCall(service,
            QStringLiteral("/"),
            QStringLiteral("org.lxqt.SingleApplication"),
            QStringLiteral("activateWindow"));
        QDBusConnection::sessionBus().send(msg);

        QTimer::singleShot(0, [this] { exit(0); });
    }
}
コード例 #3
0
int main(int argc, char **argv)
{
    MServiceMapperApplication app(argc, argv);

    QDBusConnection connection = QDBusConnection::sessionBus();

    if ( ! connection.isConnected() )
    {
        qWarning( "connecting to dbus failed, exiting." );
        return -1;
    }

    const QString serviceFileDir(M_DBUS_SERVICES_DIR);
    MServiceMapper service(serviceFileDir);
    new MServiceMapperAdaptor(&service); // must be on the heap, must not be deleted see QDBusAbstractAdaptor man page
    connection.registerService("com.nokia.MServiceFw");
    connection.registerObject("/", &service);

    return app.exec();
}
コード例 #4
0
ファイル: toutatis.cpp プロジェクト: Noughmad/Toutatis
Toutatis::Toutatis(QObject* parent) : QObject(parent)
{
    mDatabase = QSqlDatabase::addDatabase("QSQLITE");

    QDir dir(QDir::homePath() + "/.local/share/toutatis");

    if (!dir.exists())
    {
        qDebug() << dir.absolutePath();
        dir.mkpath(".");
    }
    mDatabase.setDatabaseName(dir.absoluteFilePath("database.db"));

    bool ok = mDatabase.open();
    if (!ok)
    {
        qDebug() << mDatabase.lastError();
    }

    if (mDatabase.tables().isEmpty())
    {
        qDebug() << "Existing database not found, creating tables";
        createTables();
    }
    else
    {
        qDebug() << "Found existing database in " << mDatabase.databaseName();
    }

    Q_ASSERT(mDatabase.tables().size() == 5);

    new ToutatisAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/Toutatis", this);
    dbus.registerService("com.noughmad.Toutatis");

    foreach (const QString& projectId, projectIds())
    {
        Project* p = new Project(projectId, this);
        connect (p, SIGNAL(removed()), SIGNAL(projectIdsChanged()));
    }
コード例 #5
0
/*!
    Publishes all slots on this object within subclasses of QtopiaAbstractService.
    This is typically called from a subclass constructor.
*/
void QtopiaAbstractService::publishAll()
{
#if defined(QTOPIA_DBUS_IPC)
    QDBusConnection dbc = QDBus::sessionBus();
    if (!dbc.isConnected()) {
        qWarning() << "Unable to connect to D-BUS:" << dbc.lastError();
        return;
    }

    qLog(Services) << "Registering service" << m_data->m_service;

    QDBusConnectionInterface *iface = dbc.interface();
    QString service = dbusInterface;
    service.append(".");
    service.append(m_data->m_service);
    if (iface->registerService(service) == QDBusConnectionInterface::ServiceNotRegistered) {
        qWarning() << "WARNING: could not request name" << service;
        return;
    }

    new QtopiaDBusAdaptor(this);
    QString path = dbusPathBase;
    path.append(m_data->m_service);
    dbc.registerObject(path, this, QDBusConnection::ExportNonScriptableSlots);
#else
    const QMetaObject *meta = metaObject();
    if ( !m_data->m_publishAllCalled ) {
        int count = meta->methodCount();
        int index = QtopiaAbstractService::staticMetaObject.methodCount();
        for ( ; index < count; ++index ) {
            QMetaMethod method = meta->method( index );
            if ( method.methodType() == QMetaMethod::Slot &&
                 method.access() == QMetaMethod::Public) {
                QByteArray name = method.signature();
                QtopiaIpcAdaptor::connect(m_data->m_copobject, "3" + name, this, "1" + name);
            }
        }
        m_data->m_publishAllCalled = true;
    }
#endif
}
コード例 #6
0
StatusIndicatorMenuWindow::StatusIndicatorMenuWindow(QWidget *parent) :
    MWindow(parent),
    statusBar(new MStatusBar),
    menuWidget(NULL)
{
    QDBusConnection bus = QDBusConnection::sessionBus();
    bus.registerService(SERVICE_NAME);
    bus.registerObject(OBJECT_NAME, this, QDBusConnection::ExportScriptableSlots);

    // Show status bar
    setSceneManager(new MSceneManager);
    sceneManager()->appearSceneWindowNow(statusBar);
    currentLanguage = MLocale().language();

    statusBar->setStyleName("StatusIndicatorMenuWindowStatusBar");

    // Set the X window type, so that the window does not appear in the switcher and
    // home screen can provide the correct UI flow
    setAttribute(Qt::WA_X11NetWmWindowTypeMenu);
    setTranslucentBackground(true);
    setWindowTitle("Status Indicator Menu");
    setProperty("followsCurrentApplicationWindowOrientation", true);
    connect(this, SIGNAL(displayEntered()), this, SLOT(displayActive()));
    connect(this, SIGNAL(displayExited()), this, SLOT(displayInActive()));

#ifdef HAVE_QMSYSTEM
    /*
     * We need to receive updates when device lock state changes
     * to prevent status indicator menu opening when device lock is on
     */
    connect (&qmLocks, SIGNAL(stateChanged (MeeGo::QmLocks::Lock, MeeGo::QmLocks::State)), this,
                                   SLOT(setWindowStateAccordingToDeviceLockState(MeeGo::QmLocks::Lock, MeeGo::QmLocks::State)));
    if (qmLocks.getState(MeeGo::QmLocks::Device) != MeeGo::QmLocks::Locked) {
        deviceLocked = false;
    } else {
        deviceLocked = true;
    }
#endif

    resetMenuWidget();
}
コード例 #7
0
ファイル: dbuswinidprovider.cpp プロジェクト: KDAB/FatCRM
void DBusWinIdProvider::Private::tryRegister()
{
    // we don't care if we can't register or if we are replaced by the real tray
    // this is for fallback in case the tray app is not running
    QDBusConnection bus = QDBusConnection::sessionBus();
    QDBusConnectionInterface *busInterface = bus.interface();
    busInterface->registerService(QStringLiteral("org.freedesktop.akonaditray"),
                                  QDBusConnectionInterface::DontQueueService,
                                  QDBusConnectionInterface::AllowReplacement);

    if (!mObjectRegistered) {
        mObjectRegistered = bus.registerObject(QStringLiteral("/Actions"), q,
                                               QDBusConnection::ExportScriptableSlots);
        if (!mObjectRegistered) {
            qCWarning(FATCRM_CLIENT_LOG) << "Failed to register provider object /Actions";
        }
    }

    qCDebug(FATCRM_CLIENT_LOG) << "currentOwner="
             << busInterface->serviceOwner(QStringLiteral("org.freedesktop.akonaditray"));
}
コード例 #8
0
ファイル: dbusinterface.cpp プロジェクト: KDE/kwin
DBusInterface::DBusInterface(QObject *parent)
    : QObject(parent)
    , m_serviceName(QStringLiteral("org.kde.KWin"))
{
    (void) new KWinAdaptor(this);

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject(QStringLiteral("/KWin"), this);
    const QByteArray dBusSuffix = qgetenv("KWIN_DBUS_SERVICE_SUFFIX");
    if (!dBusSuffix.isNull()) {
        m_serviceName = m_serviceName + QLatin1Char('.') + dBusSuffix;
    }
    if (!dbus.registerService(m_serviceName)) {
        QDBusServiceWatcher *dog = new QDBusServiceWatcher(m_serviceName, dbus, QDBusServiceWatcher::WatchForUnregistration, this);
        connect (dog, SIGNAL(serviceUnregistered(QString)), SLOT(becomeKWinService(QString)));
    } else {
        announceService();
    }
    dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
                 Workspace::self(), SLOT(slotReloadConfig()));
}
コード例 #9
0
ファイル: engine.cpp プロジェクト: drewbug/kandas
Kandas::Daemon::Engine::Engine()
    : QObject()
    , m_clean(true)
    , m_clientCount(0)
    , m_system(Kandas::SystemUnchecked)
{
    //auto refresh
    connect(&m_autoRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshData()));
    //D-Bus
    new KandasAdaptor(this);
    QDBusConnection bus = QDBusConnection::systemBus();
    if (!bus.registerService("org.kandas"))
    {
        kError() << "Could not register service. D-Bus returned:" << bus.lastError().message();
        m_clean = false;
    }
    else
        bus.registerObject("/", this);
    //schedule initial data updates
    QTimer::singleShot(0, this, SLOT(refreshData()));
}
コード例 #10
0
SailorgramInterface::SailorgramInterface(QObject *parent) : QObject(parent)
{
    new SailorgramAdaptor(this);

    QDBusConnection connection = QDBusConnection::sessionBus();

    if(!connection.isConnected())
    {
        qWarning("Cannot connect to the D-Bus session bus.");
        return;
    }

    if(!connection.registerService(SailorgramInterface::INTERFACE_NAME))
    {
        qWarning() << connection.lastError().message();
        return;
    }

    if(!connection.registerObject("/", this))
        qWarning() << connection.lastError().message();
}
コード例 #11
0
ファイル: subscriptions.cpp プロジェクト: marxoft/cutenews
Subscriptions::Subscriptions() :
    QObject(),
    m_feedDownloader(0),
    m_iconDownloader(0),
    m_feedRequest(0),
    m_subscription(0),
    m_process(0),
    m_progress(0),
    m_status(Idle),
    m_total(0)
{
    m_updateTimer.setInterval(60000);
    
    connect(DBNotify::instance(), SIGNAL(subscriptionsAdded(QStringList)), this, SLOT(update(QStringList)));
    connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(getScheduledUpdates()));
#ifdef DBUS_INTERFACE
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.marxoft.cutenews.subscriptions");
    connection.registerObject("/org/marxoft/cutenews/subscriptions", this, QDBusConnection::ExportScriptableSlots);
#endif
}
コード例 #12
0
NdefHandler::NdefHandler(QNearFieldManagerPrivateImpl *manager, const QString &serviceName,
                         const QString &path, QObject *object, const QMetaMethod &method)
:   m_manager(manager), m_adaptor(0), m_object(object), m_method(method),
    m_serviceName(serviceName), m_path(path)
{
    QDBusConnection handlerConnection =
        QDBusConnection::connectToBus(QDBusConnection::SystemBus, connectionUuid);
    if (serviceName != handlerConnection.baseService()) {
        handlerConnection = QDBusConnection::connectToBus(QDBusConnection::SessionBus,
                                                          serviceName);

        if (!handlerConnection.registerService(serviceName))
            return;
    }

    m_adaptor = new NDEFHandlerAdaptor(this);

    if (!handlerConnection.registerObject(path, this)) {
        delete m_adaptor;
        m_adaptor = 0;
    }
}
コード例 #13
0
ファイル: QGVChannel.cpp プロジェクト: Damra/qgvdial
bool
QGVChannel::registerObject()
{
    ChannelAdaptor *ca = new ChannelAdaptor(this);
    if (NULL == ca) {
        Q_WARN("Failed to create channel adapter object");
        return false;
    }

    QDBusConnection sessionBus = QDBusConnection::sessionBus();
    bool rv = sessionBus.registerObject(m_dbusObjectPath, this);
    if (!rv) {
        Q_WARN(QString("Couldn't register Channel object path %1")
                .arg(m_dbusObjectPath));
        delete ca;
        return false;
    }

    Q_DEBUG(QString("Registered channel object %1").arg(m_dbusObjectPath));

    return true;
}//QGVChannel::registerObject
コード例 #14
0
ファイル: tohkeyboard.cpp プロジェクト: ljo/tohkbd2
/* Register to dbus
 */
void Tohkbd::registerDBus()
{
    if (!dbusRegistered)
    {
        // DBus
        QDBusConnection connection = QDBusConnection::systemBus();
        if (!connection.registerService(SERVICE))
        {
            QCoreApplication::quit();
            return;
        }

        if (!connection.registerObject(PATH, this))
        {
            QCoreApplication::quit();
            return;
        }
        dbusRegistered = true;

        printf("tohkbd2: succesfully registered to dbus systemBus \"%s\"\n", SERVICE);
    }
}
コード例 #15
0
 Config::Config(const QString & organization, const QString & application, QObject * parent ): QSettings(organization, application, parent)
 {
     proxyOn=false;
     proxyURL="";
     proxyUser="";
     proxyPasswd="";
     proxyPort=3128;
     read();
     if (value("CurrentWallpaper").toString().isNull())
     CurrentWallpaper =  DesktopWidget::applicationDirPath() + "/share/plexy/skins/default/default.png";
     //collitions detection
     collitionOn = false;
     qDebug()<<widgetList.count()<<endl;
     if (widgetList.count() < 0 )
     widgetList.append("plexyclock");
     writeToFile();
     //register  with dbus
     new ConfigAdaptor(this);
     QDBusConnection dbus = QDBusConnection::sessionBus();
     dbus.registerObject("/Configuration", this);
     dbus.registerService("org.PlexyDesk.Config");
 }
コード例 #16
0
ファイル: dbusadapter.cpp プロジェクト: MrJoe/SkippingStones
DbusAdapter::DbusAdapter(QObject *parent) :
    QObject(parent)
{
    QDBusConnection systemConn = QDBusConnection::systemBus();
    systemConn.connect("org.ofono", "/ril_0", "org.ofono.VoiceCallManager", "CallAdded",
                         this, SLOT(_phoneCall(QDBusMessage)));
    systemConn.connect("org.ofono", "/ril_0", "org.ofono.MessageManager", "IncomingMessage",
                         this, SLOT(_smsReceived(QDBusMessage)));

    QDBusConnection sessionConn = QDBusConnection::sessionBus();
    sessionConn.connect("", "/", "org.coderus.harbour_mitakuuluu_server", "messageReceived",
                        this, SLOT(_mitakuuluuMessageReceived(QDBusMessage)));

    qDebug() << "Setting up hack for getting notifications...";
    // The inspiration for this hack was taken from: http://stackoverflow.com/questions/22592042/qt-dbus-monitor-method-calls
    sessionConn.registerObject("/org/freedesktop/Notifications", this, QDBusConnection::ExportAllSlots);
    QString matchString = "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'";
    QDBusInterface busInterface("org.freedesktop.DBus", "/org/freedesktop/DBus",
                                "org.freedesktop.DBus");
    busInterface.call("AddMatch", matchString);
    qDebug() << "Leaving constructor...";
}
コード例 #17
0
ファイル: splashapp.cpp プロジェクト: cmacq2/plasma-workspace
SplashApp::SplashApp(int &argc, char ** argv)
    : QGuiApplication(argc, argv),
      m_stage(0),
      m_testing(false),
      m_window(false),
      m_startTime(QDateTime::currentDateTime())
{
    QCommandLineParser parser;
    parser.addOption(QCommandLineOption(QStringLiteral("test"), QStringLiteral("Run in test mode")));
    parser.addOption(QCommandLineOption(QStringLiteral("window"), QStringLiteral("Run in windowed mode")));
    parser.addOption(QCommandLineOption(QStringLiteral("nofork"), QStringLiteral("Don't fork")));
    parser.addOption(QCommandLineOption(QStringLiteral("pid"), QStringLiteral("Print the pid of the child process")));
    parser.addHelpOption();

    parser.process(*this);
    m_testing = parser.isSet(QStringLiteral("test"));
    m_window = parser.isSet(QStringLiteral("window"));

    foreach(QScreen* screen, screens())
        adoptScreen(screen);

    setStage(QStringLiteral("initial"));

    QPixmap cursor(32, 32);
    cursor.fill(Qt::transparent);
    setOverrideCursor(QCursor(cursor));

    if (m_testing) {
        m_timer.start(TEST_STEP_INTERVAL, this);
    }

    connect(this, &QGuiApplication::screenAdded, this, &SplashApp::adoptScreen);

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject(QStringLiteral("/KSplash"), this, QDBusConnection::ExportScriptableSlots);
    dbus.registerService(QStringLiteral("org.kde.KSplash"));

}
コード例 #18
0
ファイル: application.cpp プロジェクト: Pr0Wolf29/lximage-qt
bool Application::init(int argc, char** argv) {
  // install the translations built-into Qt itself
  qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
  installTranslator(&qtTranslator);

  // install libfm-qt translator
  installTranslator(libFm.translator());

  // install our own tranlations
  translator.load("lximage-qt_" + QLocale::system().name(), LXIMAGE_DATA_DIR "/translations");
  installTranslator(&translator);

  // initialize dbus
  QDBusConnection dbus = QDBusConnection::sessionBus();
  if(dbus.registerService(serviceName)) {
    settings_.load(); // load settings
    // we successfully registered the service
    isPrimaryInstance = true;
    setQuitOnLastWindowClosed(false); // do not quit even when there're no windows

    new ApplicationAdaptor(this);
    dbus.registerObject("/Application", this);

    connect(this, &Application::aboutToQuit, this, &Application::onAboutToQuit);

    if(settings_.useFallbackIconTheme())
      QIcon::setThemeName(settings_.fallbackIconTheme());
  }
  else {
    // an service of the same name is already registered.
    // we're not the first instance
    isPrimaryInstance = false;
  }

  QPixmapCache::setCacheLimit(1024); // avoid pixmap caching.

  return parseCommandLineArgs();
}
コード例 #19
0
ファイル: kupdaemon.cpp プロジェクト: somniumAeternam/Kup
void KupDaemon::setupGuiStuff() {
	// timer to update logged time and also trigger warning if too long
	// time has now passed since last backup
	mUsageAccumulatorTimer = new QTimer(this);
	mUsageAccumulatorTimer->setInterval(KUP_USAGE_MONITOR_INTERVAL_S * 1000);
	mUsageAccumulatorTimer->start();
	KIdleTime::instance()->addIdleTimeout(KUP_IDLE_TIMEOUT_S * 1000);
	connect(KIdleTime::instance(), SIGNAL(timeoutReached(int)), mUsageAccumulatorTimer, SLOT(stop()));
	connect(KIdleTime::instance(), SIGNAL(timeoutReached(int)), KIdleTime::instance(), SLOT(catchNextResumeEvent()));
	connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), mUsageAccumulatorTimer, SLOT(start()));

	setupTrayIcon();
	setupExecutors();
	setupContextMenu();
	updateTrayIcon();

	QDBusConnection lDBus = QDBusConnection::sessionBus();
	if(lDBus.isConnected()) {
		if(lDBus.registerService(KUP_DBUS_SERVICE_NAME)) {
			lDBus.registerObject(KUP_DBUS_OBJECT_PATH, this, QDBusConnection::ExportAllSlots);
		}
	}
}
コード例 #20
0
ファイル: apcupsc.cpp プロジェクト: licehunter/plasma-apcups
ApcUpsMon::ApcUpsMon(QString host, quint16 port, int updint, QObject *parent)
: QObject(parent)
{
    bytesLeft = 0;
    lastResponseTimestamp = 0;
    connect(&socket, SIGNAL(readyRead()), this, SLOT(socketRead()));
    connect(&socket, SIGNAL(connected()), this, SLOT(timeout()));
    connect(&socket, SIGNAL(connected()), &timer, SLOT(start()));
    connect(&socket, SIGNAL(disconnected()), this, SLOT(timeout()));
    connect(&socket, SIGNAL(disconnected()), &timer, SLOT(stop()));
    connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(socketError(QAbstractSocket::SocketError)));
    connect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
    
    connectToHost(host, port);
    setInterval(updint);
    
    // Launch D-BUS
    new ApcUpsMonAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/", this);
    dbus.registerService("eu.navlost.apcupsmon");
}
コード例 #21
0
ファイル: plexyconfig.cpp プロジェクト: jdarnold/plexydesk
Config::Config(const QString &organization,
     const QString &application, QObject *parent) :
    QObject(parent),
    d(new Private)
{
    d->mSettings = new QSettings(organization, application, this);

    d->mData["proxyOn"] = QVariant(false);
    d->mData["proxyURL"] = QVariant(QLatin1String(""));
    d->mData["proxyUser"] = QVariant(QLatin1String(""));
    d->mData["proxyPasswd"] = QVariant(QLatin1String(""));
    d->mData["proxyPort"] = QVariant(3128);
    d->mData["openGL"] = QVariant(false);
#ifdef Q_WS_MAC
    d->mData["openGL"] = QVariant(true);
#endif
    read();
    QString suffix="4x3";
    QSize desktopSize = QDesktopWidget().screenGeometry().size();
    float screenRatio = float(desktopSize.width())/float(desktopSize.height());
    if (screenRatio > 1.333) {
        suffix="16x9";
    }

    if (d->mSettings->value("CurrentWallpaper").toString().isEmpty()) {
        d->mData["CurrentWallpaper"] = QDir::toNativeSeparators(
                                            plexydeskBasePath()
                                            + "/" + QString(PLEXYRESOURCESDIR)
                                            + "/default-"
                                            + suffix
                                            + ".png");
    }

    if (d->mSettings->value("CurrentWallpaperMode").toString().isEmpty()) {
        d->mData["CurrentWallpaperMode"] = QString("IgnoreAspectRatio");
    }

    if (d->mSettings->value("photo").toString().isEmpty()) {
        d->mData["photo"] = QDir::toNativeSeparators(
                                            plexydeskBasePath()
                                            + "/" + QString(PLEXYRESOURCESDIR)
                                            + "/default-photo.png");
    }

    if (d->mSettings->value("iconTheme").toString().isEmpty()) {
        d->mData["iconTheme"] = QLatin1String("default");
    }

    if (d->mSettings->value(QLatin1String("themepack")).toString().isEmpty()) {
        d->mData["themepack"] = QLatin1String("default");
    }

    writeToFile();

#ifdef Q_WS_X11
    // register with dbus
    new ConfigAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/data", this);
    dbus.registerService("org.PlexyDesk.Config");
#endif

    qDebug() << Q_FUNC_INFO << d->mData;
}
コード例 #22
0
ファイル: MainWindow.cpp プロジェクト: obiwankennedy/ssr
MainWindow::MainWindow()
	: QMainWindow() {

	m_old_geometry = QRect();

	setWindowTitle(WINDOW_CAPTION);
	setWindowIcon(g_icon_ssr);

	QWidget *centralwidget = new QWidget(this);
	setCentralWidget(centralwidget);

	m_page_welcome = new PageWelcome(this);
	m_page_input = new PageInput(this);
	m_page_output = new PageOutput(this);
	m_page_record = new PageRecord(this);
	m_page_record_adaptor = new PageRecordAdaptor(m_page_record);
	QDBusConnection connection = QDBusConnection::sessionBus();
	bool rel = connection.registerService("be.maartenbaert.ssr");
	rel = connection.registerObject("/",m_page_record);


	m_page_done = new PageDone(this);

	m_stacked_layout = new QStackedLayout(centralwidget);
	m_stacked_layout->addWidget(m_page_welcome);
	m_stacked_layout->addWidget(m_page_input);
	m_stacked_layout->addWidget(m_page_output);
	m_stacked_layout->addWidget(m_page_record);
	m_stacked_layout->addWidget(m_page_done);
	m_stacked_layout->setCurrentWidget(m_page_welcome);

	LoadSettings();

	// warning for glitch with proprietary NVIDIA drivers
	if(GetNVidiaDisableFlipping() == NVIDIA_DISABLE_FLIPPING_ASK || GetNVidiaDisableFlipping() == NVIDIA_DISABLE_FLIPPING_YES) {
		if(NVidiaDetectFlipping()) {
			bool disable;
			if(GetNVidiaDisableFlipping() == NVIDIA_DISABLE_FLIPPING_ASK) {
				enum_button button = MessageBox(QMessageBox::Warning, NULL, MainWindow::WINDOW_CAPTION,
												MainWindow::tr("SimpleScreenRecorder has detected that you are using the proprietary NVIDIA driver with flipping enabled. "
															   "This is known to cause glitches during recording. It is recommended to disable flipping. Do you want me to do this for you?\n\n"
															   "You can also change this option manually in the NVIDIA control panel.", "Don't translate 'flipping' unless NVIDIA does the same"),
												BUTTON_YES | BUTTON_YES_ALWAYS | BUTTON_NO | BUTTON_NO_NEVER, BUTTON_YES);
				if(button == BUTTON_YES_ALWAYS)
					SetNVidiaDisableFlipping(NVIDIA_DISABLE_FLIPPING_YES);
				if(button == BUTTON_NO_NEVER)
					SetNVidiaDisableFlipping(NVIDIA_DISABLE_FLIPPING_NO);
				disable = (button == BUTTON_YES || button == BUTTON_YES_ALWAYS);
			} else {
				disable = true;
			}
			if(disable) {
				if(!NVidiaDisableFlipping()) {
					SetNVidiaDisableFlipping(NVIDIA_DISABLE_FLIPPING_ASK);
					MessageBox(QMessageBox::Warning, NULL, MainWindow::WINDOW_CAPTION,
							   MainWindow::tr("I couldn't disable flipping for some reason - sorry! Try disabling it in the NVIDIA control panel.",
											  "Don't translate 'flipping' unless NVIDIA does the same"),
							   BUTTON_OK, BUTTON_OK);
				}
			}
		}
	}

	// maybe show the window
	if(!g_option_start_hidden)
		show();
	m_page_record->UpdateShowHide();

}
コード例 #23
0
void JobViewServer::startServer() {
  QDBusConnection bus = QDBusConnection::sessionBus();
  bus.unregisterService("org.kde.kuiserver"); 
  bus.unregisterService("org.kde.JobViewServer");
  bus.unregisterObject("/JobViewServer");
  if (bus.registerService("org.kde.kuiserver") && bus.registerService("org.kde.JobViewServer") && bus.registerObject("/JobViewServer", this)) {
    connected = true;
  } else {
    connected = false;
    QDBusServiceWatcher* watcher = new QDBusServiceWatcher("org.kde.kuiserver", bus, QDBusServiceWatcher::WatchForUnregistration, this);
    QDBusServiceWatcher* watcher2 = new QDBusServiceWatcher("org.kde.JobViewServer", bus, QDBusServiceWatcher::WatchForUnregistration, this);
    QObject::connect(watcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(startServer()));
    QObject::connect(watcher, SIGNAL(serviceUnregistered(QString)), watcher, SLOT(deleteLater()));
    QObject::connect(watcher2, SIGNAL(serviceUnregistered(QString)), this, SLOT(startServer()));
    QObject::connect(watcher2, SIGNAL(serviceUnregistered(QString)), watcher2, SLOT(deleteLater()));
  }
  updateStatusIndicators();
}
コード例 #24
0
QConnectionManager::QConnectionManager(QObject *parent) :
    QObject(parent),
     netman(NetworkManagerFactory::createInstance()),
     currentNetworkState(QString()),
     currentType(QString()),
     currentNotification(0),
     askForRoaming(false),
     isEthernet(false),
     connmanAvailable(false),
     handoverInProgress(false),
     oContext(0),
     tetheringWifiTech(0),
     tetheringEnabled(false),
     flightModeSuppression(false)
{
    qDebug() << Q_FUNC_INFO;

    manualConnnectionTimer.invalidate();

    connect(netman,SIGNAL(availabilityChanged(bool)),this,SLOT(connmanAvailabilityChanged(bool)));

    connectionAdaptor = new ConnAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();

    if (!dbus.registerService(CONND_SERVICE)) {
        qDebug() << "XXXXXXXXXXX could not register service XXXXXXXXXXXXXXXXXX";
    }

    if (!dbus.registerObject(CONND_PATH, this)) {
        qDebug() << "XXXXXXXXXXX could not register object XXXXXXXXXXXXXXXXXX";
    }

    askForRoaming = askRoaming();

    connect(&clockModel,SIGNAL(timeUpdatesChanged()),this,SLOT(timeUpdatesChanged()));
    ua = new UserAgent(this);

    connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)),
            this,SLOT(onUserInputRequested(QString,QVariantMap)));

    connect(ua,SIGNAL(connectionRequest()),this,SLOT(onConnectionRequest()));
    connect(ua,SIGNAL(errorReported(QString, QString)),this,SLOT(onErrorReported(QString, QString)));
    connect(ua,SIGNAL(userInputCanceled()),this,SLOT(onUserInputCanceled()));
    connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)),
            this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection);
    connect(ua,SIGNAL(browserRequested(QString,QString)),
            this,SLOT(browserRequest(QString,QString)), Qt::UniqueConnection);

    connect(netman,SIGNAL(servicesListChanged(QStringList)),this,SLOT(servicesListChanged(QStringList)));
    connect(netman,SIGNAL(stateChanged(QString)),this,SLOT(networkStateChanged(QString)));
    connect(netman,SIGNAL(servicesChanged()),this,SLOT(setup()));
    connect(netman,SIGNAL(offlineModeChanged(bool)),this,SLOT(offlineModeChanged(bool)));

    QFile connmanConf("/etc/connman/main.conf");
    if (connmanConf.open(QIODevice::ReadOnly | QIODevice::Text)) {
        while (!connmanConf.atEnd()) {
            QString line = connmanConf.readLine();
            if (line.startsWith("DefaultAutoConnectTechnologies")) {
                QString token = line.section(" = ",1,1).simplified();
                techPreferenceList = token.split(",");
                break;
            }
        }
        connmanConf.close();
    }
    if (techPreferenceList.isEmpty())
        //ethernet,bluetooth,cellular,wifi is default
        techPreferenceList << "wifi" << "cellular" << "bluetooth" << "ethernet";

    mceWatch = new WakeupWatcher(this);
    connect(mceWatch,SIGNAL(displayStateChanged(QString)),this,SLOT(displayStateChanged(QString)));
    connect(mceWatch,SIGNAL(sleepStateChanged(bool)),this,SLOT(sleepStateChanged(bool)));

    connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman");
    if (connmanAvailable)
        setup();
    goodConnectTimer = new QTimer(this);
    goodConnectTimer->setSingleShot(true);
    goodConnectTimer->setInterval(12 * 1000);
    connect(goodConnectTimer,SIGNAL(timeout()),this,SLOT(connectionTimeout()));

}
コード例 #25
0
ファイル: main.cpp プロジェクト: chegestar/Ab-Share-UI
M_EXPORT int main (int argc, char **argv) {

    bool run_standalone = true;
    
    QCoreApplication::setApplicationName (QLatin1String ("Share UI"));
    QCoreApplication::setOrganizationName (QLatin1String ("MeeGo"));    
    
    // Let's use custom logging
    Logger logger;    

    // Use dynamic memory control to make sure free is successfull before we
    // print out bye message.
    MApplication * app = MComponentCache::mApplication (argc, argv);

    // Load the translation catalog. The engineering english catalog is per
    // application/package, and gets loaded automatically. In the device, there
    // will be only one translation catalog for share-ui, webupload-engine and
    // transfer-ui, and we need to explicitly load it
    MLocale locale;
    locale.installTrCatalog ("transfer");
    MLocale::setDefault (locale);

    Service * service = new Service();

    for(int i = 1; i < argc; i++) {
        if (strcmp(argv[i], "--service") == 0) {
            run_standalone = false;
        } else if (strcmp(argv[i], "--help") == 0) {
            std::cout << "Share UI command line usage is" << std::endl;
            std::cout << "\tshare-ui <file list>" << std::endl;
            exit(0);
        }
    }

    if (run_standalone == true) {
        QStringList itemList;

        for (int i = 1; i < argc; i++) {
            if(argv[i][0] == '-') {
                // This is probably some kind of argument, like -software
                continue;
            }
            
            QString input = argv[i];
            
            if (input.startsWith ("data:") == true) {
                qDebug() << "Received data URI" << input;
                itemList << input;
            } else {
                QFileInfo fileInfo (input);
                QString fileUri = fileInfo.canonicalFilePath();
                if (fileUri.isEmpty ()) {
                    qDebug() << "Received Tracker IRI (?)" << input;
                    itemList << input;
                } else {
                    fileUri.prepend("file://");
                    qDebug() << "Received file path uri" << fileUri;
                    itemList << fileUri;
                }
            }
        }

        service->share (itemList);
        
    } else {

        new ShareUiInterfaceAdaptor (service);

        QDBusConnection connection = QDBusConnection::sessionBus();
        bool retA = connection.registerService("com.nokia.ShareUi");
        bool retB = connection.registerObject("/", service);
        qDebug() << "Setup dbus connection" << retA << retB;
    }
    
    int mainRes = app->exec();  
    qDebug() << "app returned" << mainRes;
    
    delete service;
    delete app;
    
    qDebug() << "Clean shutdown of Share UI application";
    return mainRes;
}
コード例 #26
0
static void registerDBusObject(QDBusConnection &bus, const char *path, QObject *object)
{
    if (!bus.registerObject(path, object)) {
        qWarning("Unable to register object at path %s: %s", path, bus.lastError().message().toUtf8().constData());
    }
}
コード例 #27
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    qDebug()<<QApplication::applicationVersion();
    music = new MusicControl;
    netCore = new NetWorker;
    settings = new QSettings(this);
    settingsWindow = new PrefWindow(this);
    settingsWindow->setWindowFlags(Qt::Dialog);
    ui->lineEdit->setPlaceholderText("Search here");
    ui->seekSlider->setRange(0,0);
    ui->repeatButton->hide();
    isUnity = false;

    ///tray icon setup
    QAction *next = new QAction(tr("Next"),this);
    QAction *restore = new QAction(tr("Show window"),this);
    QAction *prev = new QAction(tr("Previous"),this);
    QAction *playPause = new QAction(tr("Play/Pause"),this);
    QAction *close = new QAction(tr("Exit"),this);
    connect(next,SIGNAL(triggered()),music,SLOT(playNextSong()));
    connect(prev,SIGNAL(triggered()),music,SLOT(playPrevSong()));
    connect(playPause,SIGNAL(triggered()),music,SLOT(changeState()));
    connect(close,SIGNAL(triggered()),qApp,SLOT(quit()));
    connect(restore,SIGNAL(triggered()),this,SLOT(show()));
    QMenu *trayIconMenu = new QMenu(this);
    trayIconMenu->addAction(restore);
    trayIconMenu->addAction(next);
    trayIconMenu->addAction(prev);
    trayIconMenu->addAction(playPause);
    trayIconMenu->addAction(close);
    trayIcon = new QSystemTrayIcon(QIcon(":/icons/qvk.svg"));
    trayIcon->setContextMenu(trayIconMenu);
    connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,
            SLOT(trayHandler(QSystemTrayIcon::ActivationReason)));
    //trayIcon->setVisible(true);
    //trayIcon->show();


    ///table setting
    QStringList header;
    ui->musicWidget->setColumnCount(4);
    header <<"Artist"<<"Title"<<"Duration"<<"link";   //in case of unsuccesseful update....
    ui->musicWidget->hideColumn(3);
    ui->musicWidget->setHorizontalHeaderLabels(header);
    ui->musicWidget->verticalHeader()->setVisible(false);
    ui->musicWidget->setShowGrid(false);
    ui->musicWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->musicWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->musicWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->musicWidget->setSelectionMode(QAbstractItemView::SingleSelection);

    ////////////////////////////////////////////////Creating actions
    QAction *login = new QAction(tr("Login"),this);
    QAction *About = new QAction(tr("About"),this);
    QAction *refrsh = new QAction(tr("Refresh"),this);
    QAction *showSettingsWindow = new QAction(tr("Settings"),this);
    connect(showSettingsWindow, SIGNAL(triggered()),settingsWindow,SLOT(show()));
    connect(refrsh,SIGNAL(triggered()), netCore, SLOT(getAudioList()));
    connect(login, SIGNAL(triggered()), netCore, SLOT(loginSlot()));
    connect(About, SIGNAL(triggered()), this, SLOT(about()));
    ////////////////////////////////////////////////Creating menu
    QMenu *gearButtonMenu = new QMenu("Options", ui->toolButton);
    gearButtonMenu->addAction(refrsh);
    gearButtonMenu->addAction(login);
    gearButtonMenu->addAction(showSettingsWindow);
    gearButtonMenu->addSeparator();
    gearButtonMenu->addAction(About);
    gearButtonMenu->addAction(close);
    ///////////////////////////////////////////////making menu button
    ui->toolButton->setMenu(gearButtonMenu);

    ///connection area
    connect(this,SIGNAL(setPlayingOrder(QList<QUrl>)),music,SLOT(setPlayList(QList<QUrl>)));
    connect(ui->volumeSlider,SIGNAL(valueChanged(int)),music,SLOT(volumeSliderSlot(int)));
    connect(ui->musicWidget,SIGNAL(cellDoubleClicked(int,int)),music,SLOT(playThatSong(int,int)));
    connect(ui->shuffButton,SIGNAL(toggled(bool)),music,SLOT(shuffleMode(bool)));
    connect(ui->nextButton,SIGNAL(clicked()),music,SLOT(playNextSong()));
    connect(music,SIGNAL(setIndexToUi(int,int)),this,SLOT(setSongUi(int,int)));
    connect(ui->prevButton,SIGNAL(clicked()),music,SLOT(playPrevSong()));
    connect(ui->tooglePlayingButton,SIGNAL(clicked()),music,SLOT(changeState()));
    connect(music,SIGNAL(setPlayingUi()),this,SLOT(setPlayingUi()));
    connect(music,SIGNAL(setPausedUi()),this,SLOT(setPausedUi()));
    connect(ui->seekSlider,SIGNAL(sliderMoved(int)),music,SLOT(setPosition(int)));
    connect(music,SIGNAL(newPosition(qint64)),this,SLOT(positionChanged(qint64)));
    connect(music,SIGNAL(newRange(qint64)),this,SLOT(durationChanged(qint64)));
    connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(currentSearch(QString)));
    connect(this,SIGNAL(loadToken(QString,QString)),netCore,SLOT(setToken(QString,QString)));
    connect(netCore,SIGNAL(audioListGet(QList<QUrl>)),music,SLOT(setPlayList(QList<QUrl>)));
    connect(ui->musicWidget,SIGNAL(cellClicked(int,int)),music,SLOT(setSelectedSong(int,int)));
    connect(ui->repeatButton,SIGNAL(clicked(bool)),music,SLOT(repeatMode(bool)));
    connect(netCore,SIGNAL(dataGot()),this,SLOT(setMusicTable()));
    connect(this,SIGNAL(setPrefWindowsHotkeysUi(bool,bool)),settingsWindow,SLOT(setUseHotkeysUi(bool,bool)));
    connect(this,SIGNAL(setMinToTray(bool)),settingsWindow,SLOT(setUseMinTray(bool)));
    connect(settingsWindow,SIGNAL(setNewSettings(bool,bool,bool,QString,bool)),
            this,SLOT(setNewSettings(bool,bool,bool,QString,bool)));
    ///connection area



    ///DBUS setting
#ifdef Q_OS_LINUX
    DBusMethods* demo = new DBusMethods();
    new DBusAdaptor(demo);
    new DBusAdaptor1(demo);

    QDBusConnection connection = QDBusConnection::sessionBus();
    bool ret = connection.registerService("org.mpris.MediaPlayer2.qvkplayer.mainwindow");
    ret = connection.registerObject("/org/mpris/MediaPlayer2", demo);
    connect(demo,SIGNAL(dbusNext()),ui->nextButton,SIGNAL(clicked()));
    connect(demo,SIGNAL(dbusPlayPause()),ui->tooglePlayingButton,SIGNAL(clicked()));
    connect(demo,SIGNAL(dbusPrev()),ui->prevButton,SIGNAL(clicked()));
    connect(demo,SIGNAL(dbusQuit()),qApp,SLOT(quit()));
    connect(demo,SIGNAL(dbusRaise()),this,SLOT(show()));
#endif

    ///DBUS setting



    ///CONFIG LOADING==================================
    this->loadSettings();
}
コード例 #28
0
ファイル: main.cpp プロジェクト: foolab/meecast
Q_DECL_EXPORT int main(int argc, char* argv[])
{
    //QApplication::setGraphicsSystem("native");
    QApplication app(argc, argv);

    app.setProperty("NoMStyle", true);

    QDir::setCurrent(app.applicationDirPath());

    
    std::cerr<<"Begin "<<std::endl;
    std::cerr<<app.applicationDirPath().toStdString().c_str()<<std::endl;
    std::cerr<<"End "<<std::endl;


    QString str = QDir::currentPath();
    std::cerr<<str.toStdString().c_str()<<std::endl;

    str.truncate(str.length()-4);

    Core::AbstractConfig::prefix = str.toStdString();
    QDir::setCurrent(QDir::currentPath());



    /*
    //Set up a graphics scene with a QGraphicsWidget and Layout
    QGraphicsView view;
    QGraphicsScene scene;
    QGraphicsWidget *widget = new QGraphicsWidget();
    QGraphicsGridLayout *layout = new QGraphicsGridLayout;
    layout->setSpacing(0);
    widget->setLayout(layout);
    scene.addItem(widget);
    view.setScene(&scene);
*/

    //Add the QML snippet into the layout

  //  QString locale = QLocale::system().name();

   // std::cerr<<"locale: "<<locale.toStdString()<<std::endl;
    
    //ConfigQml *config;
    //
    Controller *controller;
/*
    QTranslator translator;
    translator.load("ru.qml", "i18n");
    app.installTranslator(&translator);
*/
    controller = new Controller(); 
    
    /* Locale */
    for (unsigned int i=1; i<controller->config()->languagesList().size(); i++){
        if (controller->config()->languagesList().at(i).first == controller->config()->Language()){
            setlocale (LC_ALL, controller->config()->languagesList().at(i).second.c_str());
            setlocale (LC_MESSAGES, controller->config()->languagesList().at(i).second.c_str());
            QLocale::setDefault(QLocale(controller->config()->languagesList().at(i).second.c_str()));
        }
    }
    textdomain("omweather");
    bindtextdomain("omweather", "/opt/com.meecast.omweather/share/locale");

    /* D-BUS */
    DbusAdaptor* dadapt = new DbusAdaptor(controller);

    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.meego.omweather");
    connection.registerObject("/org/meego/omweather", controller);
   

    //config = controller->config();
    //std::cerr<<"iconpath = "<<config->imagespath().toStdString() << std::endl;
    //update_weather_forecast(config);
    
    QDeclarativeView *qview;
    qview = controller->qview();

    std::cerr << "qml path = " << Core::AbstractConfig::layoutqml << std::endl;
    qview->setSource(QUrl::fromLocalFile(QString::fromStdString(Core::AbstractConfig::prefix +
                                                                Core::AbstractConfig::sharePath +
                                                                Core::AbstractConfig::layoutqml)));
    QObject::connect((QObject*)qview->engine(), SIGNAL(quit()), &app, SLOT(quit()));
    qview->showFullScreen();
    /*This code provides Segmantation fault
    delete dadapt;
    delete controller;
    */
    return app.exec();
   
}
コード例 #29
0
ファイル: DBusInterface.cpp プロジェクト: Icenowy/Cubway
void createInterface(QString service_name, QWidget *view) {
    new Adaptor(view);
    QDBusConnection con = QDBusConnection::sessionBus();
    con.registerObject("/view", view);
    con.registerService(service_name);
}
コード例 #30
0
ファイル: main.cpp プロジェクト: AnadoluPanteri/meecast
Q_DECL_EXPORT int main(int argc, char* argv[])
{
    //QApplication::setGraphicsSystem("native");
    QApplication app(argc, argv);
    app.setOrganizationDomain("meecast.omweather.com");
    app.setApplicationName("MeeCast");
    QValueSpace::initValueSpaceServer();

    app.setProperty("NoMStyle", true);

    QDir::setCurrent(app.applicationDirPath());

    textdomain("omweather");
    bindtextdomain("omweather", "/opt/com.meecast.omweather/share/locale");
/*
    //Set up a graphics scene with a QGraphicsWidget and Layout
    QGraphicsView view;
    QGraphicsScene scene;
    QGraphicsWidget *widget = new QGraphicsWidget();
    QGraphicsGridLayout *layout = new QGraphicsGridLayout;
    layout->setSpacing(0);
    widget->setLayout(layout);
    scene.addItem(widget);
    view.setScene(&scene);
*/

    //Add the QML snippet into the layout

    //QString locale = QLocale::system().name();
    //std::cerr<<"locale: "<<locale.toStdString()<<std::endl;
    
    //ConfigQml *config;
    Controller *controller;

    QTranslator translator;
    translator.load("ru.qml", "i18n");
    app.installTranslator(&translator);

    controller = new Controller(); 
    /* D-BUS */
    DbusAdaptor* dadapt = new DbusAdaptor(controller);

    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.meego.omweather");
    connection.registerObject("/org/meego/omweather", controller);
   

    //config = controller->config();
    //std::cerr<<"iconpath = "<<config->imagespath().toStdString() << std::endl;
    //update_weather_forecast(config);
    
    QDeclarativeView *qview;
    qview = controller->qview();

    std::cerr << "qml path = " << Core::AbstractConfig::layoutqml << std::endl;
    qview->setSource(QUrl::fromLocalFile(QString::fromStdString(Core::AbstractConfig::prefix +
                                                                Core::AbstractConfig::sharePath +
                                                                Core::AbstractConfig::layoutqml)));
    QObject::connect((QObject*)qview->engine(), SIGNAL(quit()), &app, SLOT(quit()));
    qview->showFullScreen();
    /*This code provides Segmantation fault
    delete dadapt;
    delete controller;
    */
    return app.exec();
   
}