Ошибка Ubuntu Server 18.04 EXT4-fs

Я также изучаю Qt и пытаюсь найти способ использования Unity API в Qt, я могу использовать только API Dbus, но мне не повезло с Quicklist, так как ему нужен DbusMenu, и я не знаю, как реализовать это (все еще learning :)).

Это пример, который я создал для себя, и надеюсь, что он будет полезен другим. Возможно, Unity-разработчики могут помочь исправить / исправить / добавить новый код (quicklist) к нему:)

/*
    Unity Launcher Dbus API exmable for Qt
    foxoman [gplus.to/foxoman][foxoman.u@gmail.com]

    https://wiki.ubuntu.com/Unity/LauncherAPI#Low_level_DBus_API:_com.canonical.Unity.LauncherEntry

    First step : add this line to your Qt project file .pro
     QT       += dbus
*/

/* I will run this example as Qt console apps */
#include <QtCore/QCoreApplication>

/* Include Qt Dbus required */
#include <QtDBus>

// Qt Main Method
int main(int argc, char *argv[])
{


    /* Qt console Main Loop [ in GUI application the Main loop is QApplication ]
        Unity API need Main Loop to run */
    QCoreApplication a(argc, argv);


    /* Create Qt Dbus Signal to send Dbus Message to unity Dbus API
        signal com.canonical.Unity.LauncherEntry.Update (in s app_uri, in a{sv} properties)
    */
    QDBusMessage signal = QDBusMessage::createSignal(
     "/", /* Path */
     "com.canonical.Unity.LauncherEntry", /* Unity DBus Interface */
     "Update"); /* Update Signal */


    /* app_uri
       Desktop ID ex: firefox -> need to be pined in the launcher to see the effect
    */
    signal << "application://firefox.desktop";


    /* properties : A map of strings to variants with the properties to set on the launcher icon */
    QVariantMap setProperty;

    /* A number to display on the launcher icon */
    setProperty.insert("count", qint64(80));

    /* show count */
    setProperty.insert("count-visible", true);

    /* progress bar count must be float between 0 and 1 (mean from 0.00 to 0.100)*/
    setProperty.insert("progress", double(0.80));

    /* show progress bar */
    setProperty.insert("progress-visible", true);

    /* Tells the launcher to get the users attention  */
    setProperty.insert("urgent",true);

    /* Pack the properties Map to the signal */
    signal << setProperty;

    /* Send the signal */
    QDBusConnection::sessionBus().send(signal);


    return a.exec();
}

скачать пример здесь http://ubuntuone.com/1SLDPcN9OhrU6LD1wgDs3r

0
задан 11 May 2018 в 03:28

0 ответов

Другие вопросы по тегам:

Похожие вопросы: