示例#1
0
UbuntuTray::UbuntuTray(Main *qtnote, QObject *parent) :
    TrayImpl(parent),
    qtnote(qtnote),
    contextMenu(0)
{
    menuUpdateTimer = new QTimer(this);
    menuUpdateTimer->setInterval(1000);
    menuUpdateTimer->setSingleShot(true);
    connect(menuUpdateTimer, SIGNAL(timeout()), SLOT(rebuildMenu()));

    sti = new QSystemTrayIcon(QIcon::fromTheme("qtnote", QIcon(":/icons/trayicon")), this);
    connect(sti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SIGNAL(newNoteTriggered()));

    actQuit = new QAction(QIcon(":/icons/exit"), tr("&Quit"), this);
    actNew = new QAction(QIcon(":/icons/new"), tr("&New"), this);
    actAbout = new QAction(QIcon(":/icons/trayicon"), tr("&About"), this);
    actOptions = new QAction(QIcon(":/icons/options"), tr("&Options"), this);
    actManager = new QAction(QIcon(":/icons/manager"), tr("&Note Manager"), this);

    connect(actQuit, SIGNAL(triggered()), SIGNAL(exitTriggered()));
    connect(actNew, SIGNAL(triggered()), SIGNAL(newNoteTriggered()));
    connect(actManager, SIGNAL(triggered()), SIGNAL(noteManagerTriggered()));
    connect(actOptions, SIGNAL(triggered()), SIGNAL(optionsTriggered()));
    connect(actAbout, SIGNAL(triggered()), SIGNAL(aboutTriggered()));

    advancedMenu = new QMenu;
    advancedMenu->addAction(actOptions);
    advancedMenu->addAction(actManager);
    advancedMenu->addAction(actAbout);
    advancedMenu->addSeparator();
    advancedMenu->addAction(actQuit);
    advancedMenu->setTitle(tr("More.."));

    connect(NoteManager::instance(), SIGNAL(storageAdded(StorageItem)), menuUpdateTimer, SLOT(start()));
    connect(NoteManager::instance(), SIGNAL(storageRemoved(StorageItem)), menuUpdateTimer, SLOT(start()));
    connect(NoteManager::instance(), SIGNAL(storageChanged(StorageItem)), menuUpdateTimer, SLOT(start()));
    menuUpdateTimer->start();
}
示例#2
0
void ColladaViewerModule::serverProcess()
{
    isServer = true;

    // Listens if there are new added storages
    bool check = connect(assetAPI_, SIGNAL(AssetStorageAdded(AssetStoragePtr)), this, SLOT(storageAdded(AssetStoragePtr)),
                                    Qt::QueuedConnection);
    Q_ASSERT(check);

    // Setting up the remote storage
    if(remoteStorageUrl != ""){
        stringstream storageString;
        storageString << "type=HttpAssetStorage;name=colladaStorage;src=" <<
                         remoteStorageUrl << ";trusted=true;autodiscoverable=false;replicated=false;readonly=false;default=false;";

        assetAPI_->DeserializeAssetStorageFromString(QString::fromStdString(storageString.str()), true);

    }


    // Initializing the websocket port
    if(framework_->HasCommandLineParameter("--wsport"))
    {
        QStringList params = framework_->CommandLineParameters("--wsport");
        if(params.length() > 0)
            websocketPort = params.at(0).toUShort();
    }else{
        websocketPort = 9002;
    }


    // Starting websocket server
    websocketManager_ = new WebSocketManager(websocketPort);
    websocketManager_->startServer();

    // Listening for event signals from websocket manager
    check = connect(websocketManager_, SIGNAL(gotEvent(QString, QString, QString)),
                         SLOT(processEvent(QString, QString, QString)), Qt::QueuedConnection);
    Q_ASSERT(check);

    // Listening for storage refresh requests from tundra client
    check = connect(server_, SIGNAL(MessageReceived(UserConnection*,kNet::packet_id_t,kNet::message_id_t,const char*,size_t)),
                    SLOT(parseKnetMessage(UserConnection*,kNet::packet_id_t,kNet::message_id_t,const char*,size_t)));

    Q_ASSERT(check);

}