Ejemplo n.º 1
0
//! [0]
Window::Window()
{
    createIconGroupBox();
    createMessageGroupBox();

    iconLabel->setMinimumWidth(durationLabel->sizeHint().width());

    createActions();
    createTrayIcon();

    connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage()));
    connect(showIconCheckBox, SIGNAL(toggled(bool)), trayIcon, SLOT(setVisible(bool)));
    connect(iconComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setIcon(int)));
    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(iconGroupBox);
    mainLayout->addWidget(messageGroupBox);
    setLayout(mainLayout);

    iconComboBox->setCurrentIndex(1);
    trayIcon->show();

    setWindowTitle(tr("Systray"));
    resize(400, 300);
}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
// Name: QGmailNotifier
// Desc:
//------------------------------------------------------------------------------
QGmailNotifier::QGmailNotifier(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f), trayIcon_(0), alertIndex_(-1), animationIndex_(0) {

	ui.setupUi(this);

	gmailFeed_ = new GMailFeed(this);
	connect(gmailFeed_, SIGNAL(fetchComplete(QNetworkReply *)), this, SLOT(fetchComplete(QNetworkReply *)));

	trayIcon_ = new QSystemTrayIcon(this);
	trayIcon_->setContextMenu(createMenu());
	trayIcon_->setIcon(QIcon(":/img/normal.svgz"));

	connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activated(QSystemTrayIcon::ActivationReason)));
	connect(trayIcon_, SIGNAL(messageClicked()), this, SLOT(messageClicked()));

	trayIcon_->show();

	// start the check timer
	timer_ = new QTimer(this);
	connect(timer_, SIGNAL(timeout()), this, SLOT(doCheck()));
	timer_->start(0);

	// setup the anim timer
	animationTimer_ = new QTimer(this);
	connect(animationTimer_, SIGNAL(timeout()), this, SLOT(doAnim()));
}
Ejemplo n.º 3
0
QMainWindowTray::QMainWindowTray(QWidget *parent) :
    QMainWindow(parent)
  , icon_online(QIcon (":/resources/icon-online.svg"))
  , icon_offline(QIcon (":/resources/icon-offline.svg"))
  , icon_unread(QIcon (":/resources/icon-unread.svg"))
{
#if not __ANDROID__
    if (QSystemTrayIcon::isSystemTrayAvailable()) {

        createActions();
        createTrayIcon();
        setMainWindowIcon();

        connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
        connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

        trayIcon->setIcon(QIcon(":/resources/icon-offline.svg"));
        trayIcon->setToolTip(tr("Vcrypt messanger"));
        trayIcon->show();
    }

    qDebug() << "windows state: " << 0 + windowState();
#endif
}
Ejemplo n.º 4
0
Window::Window()
    : m_icon(":/images/justlock.png"), m_logFiles(),  m_logStreams(), m_fileWatcher(0),
      m_maxRows(5), m_rowCount(0), m_warningIcon(":/images/trianglewarning.png")
{
    loadPreferences(true);
    createLogWidgets();
    createActions();
    createTrayIcon();
    createMenus();
    QWidget *widget = new QWidget();
    widget->setLayout(m_topLayout);
    setCentralWidget(widget);

    createRegexps();

    // setup the tray icon
    trayIcon->setToolTip(tr("Shows the status of DNSSEC Requests on the system"));
    trayIcon->setIcon(m_icon);
    setWindowIcon(m_icon);

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));


    trayIcon->show();

    setWindowTitle(tr("DNSSEC Log Messages"));
}
Ejemplo n.º 5
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    trayIcon = new QSystemTrayIcon(this);

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    connect(ui->exit_button, SIGNAL(clicked(bool)),qApp,SLOT(quit()));


    trayIcon->setIcon(QIcon(":image/bad.png"));
    trayIcon->show();
    trayIcon->showMessage(QTime::currentTime().toString(),"Time over!");

    time = new QTime();

    //ui->tableView->setVerticalHeader("Hello");
    //ui->tableView->setRowCount(10);
    //ui->tableView->setColumnCount(3);
    //ui->tableView->set
    const int WDGT_WIDTH = 271;
    ui->tableWidget->setColumnWidth(0,WDGT_WIDTH/3);
    ui->tableWidget->setColumnWidth(1,WDGT_WIDTH/3);
    ui->tableWidget->setColumnWidth(2,WDGT_WIDTH/3);
}
Ejemplo n.º 6
0
Systray::Systray(QObject *parent) : QObject(parent)
{
    s.setEmptyToDefaults();

    createActions();
    createTrayIcon();

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
            SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    setTrayIcon(":/images/puush-qt.png");

    trayIcon->show();

    trayIcon->setToolTip("puush-qt");

    history = new History();

    connect(history,
            SIGNAL(historyDone(QList<ApiHist::HistData>)), this,
            SLOT(updateHistoryMenu(QList<ApiHist::HistData>)));

    // Get the history after the app starts. For some reason the context
    // menu hangs when getting the history, even though it's asynchronous.
    // So just call it soon (waiting for wifi or something to come up after starting on boot...).
    updateHistoryAfterTimeout();
}
uint AsemanMacNativeNotification::sendNotify(const QString &title, const QString &body, const QString &icon, uint replace_id, int timeOut, const QStringList &actions)
{
    uint result = replace_id;

    AsemanMacNativeNotificationItem *item = p->items.value(replace_id);
    if(!item)
    {
        item = new AsemanMacNativeNotificationItem(this);

        p->items.insert(p->last_id, item);

        result = p->last_id;
        p->last_id++;

        connect(item, SIGNAL(messageClicked()), SLOT(messageClicked())  , Qt::QueuedConnection );
        connect(item, SIGNAL(destroyed())     , SLOT(messageDestroyed()), Qt::QueuedConnection );
    }

    item->showMessage(title, body, QSystemTrayIcon::Information, timeOut);
    item->actions = actions;
    item->icon = icon;

    if(timeOut)
        QTimer::singleShot(timeOut+500, item, SLOT(deleteLater()));

    return result;
}
Ejemplo n.º 8
0
void TabRoom::actShowMentionPopup(QString &sender) {
    if (tabSupervisor->currentIndex() != tabSupervisor->indexOf(this) 
        || QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0) {
        disconnect(trayIcon, SIGNAL(messageClicked()), 0, 0);
        trayIcon->showMessage(sender + tr(" mentioned you."), tr("Click to view"));
        connect(trayIcon, SIGNAL(messageClicked()), chatView, SLOT(actMessageClicked()));
    }
}
Ejemplo n.º 9
0
//------------------------------------------------------------------------------------------------
//################################################################################################
//------------------------------------------------------------------------------------------------
Window::Window()
{
    errorMessage = new QErrorMessage(this);

    createTabs();

    createActions();
    createTrayIcon();

    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(tabs);

    QHBoxLayout *bl = new QHBoxLayout;

    quitButton = new QPushButton(QIcon(":/images/door-open-out.png"), tr("Quit"));
    quitButton->setAutoDefault(false);
    quitButton->setFocusPolicy(Qt::NoFocus);
    connect(quitButton, SIGNAL(clicked()), this, SLOT(quitApp()));
    bl->addWidget(quitButton, 0, Qt::AlignLeft);

    aboutButton = new QPushButton(QIcon(":/images/question-balloon.png"), tr("About"));
    aboutButton->setAutoDefault(false);
    aboutButton->setFocusPolicy(Qt::NoFocus);
    connect(aboutButton, SIGNAL(clicked()), this, SLOT(about()));
    bl->addWidget(aboutButton, 0, Qt::AlignCenter);

    closeButton = new QPushButton(QIcon(":/images/tick.png"), tr("Close"));
    closeButton->setAutoDefault(false);
    closeButton->setFocusPolicy(Qt::NoFocus);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeWanted()));
    bl->addWidget(closeButton, 0, Qt::AlignRight);

    mainLayout->addLayout(bl);

    setLayout(mainLayout);

    pingTimer = new QTimer(this);
    connect(pingTimer, SIGNAL(timeout()), this, SLOT(pingProc()));
    switchTimer = new QTimer(this);
    connect(switchTimer, SIGNAL(timeout()), this, SLOT(switchProc()));
    prioTimer = new QTimer(this);
    connect(prioTimer, SIGNAL(timeout()), this, SLOT(prioProc()));

    trayIcon->show();
    setWindowTitle("QGateway");

    readSettings();

    settChanged = false;
    startupChanged = true;
    checkStartup();

    setWindowIcon(QIcon(":/images/computer-network.png"));
}
Ejemplo n.º 10
0
Buddies::Buddies(QWidget *parent)
    : QMainWindow(parent)
{
	ui.setupUi(this);
	getSysInfo();
	createIconGroupBox();
	createActions();
	createTrayIcon();
	countOnlineUsers();




    QTimer * counter = new QTimer( this );
    connect( counter, SIGNAL(timeout()),
	             this, SLOT(structUser()) );
	counter->start( 3000 );
	qDebug("=> Starting timer 1sec interval...");






	//connect(ui.sendBtn, SIGNAL(clicked()), this, SLOT(showMessage()));
	// connect(ui.showIconCheckBox, SIGNAL(toggled(bool)), trayIcon, SLOT(setVisible(bool)));
    connect(ui.iconComboBox, SIGNAL(currentIndexChanged(int)),this, SLOT(setIcon(int)));
	connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
	connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
	           this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

	ui.iconComboBox->setCurrentIndex(1);

	trayIcon->show();

	setWindowTitle(tr("Buddies"));
	//resize(400, 300);


	ui.listWidget->setIconSize(QSize(40, 40));

	//showMessage();

//-- timer 5 min for online Users Baloon

	QTimer * onlinetimer = new QTimer( this );
		    connect( onlinetimer, SIGNAL(timeout()),
			             this, SLOT(onlineNotify()) );
			onlinetimer->start( 300000 );
			qDebug("=> Starting timer 5min interval...");

//-- Information on Edit Tab

			Information();
//-- Database status
			dbstatus();

}
Ejemplo n.º 11
0
SystemTrayIcon::SystemTrayIcon(QQuickItem *parent) :
    QQuickItem(parent)
{
    setVisible (false);
    systempTray = new QSystemTrayIcon(this);
    connect (systempTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
    connect (systempTray, SIGNAL(messageClicked()), this, SIGNAL(messageClicked()));
    connect (this, SIGNAL(visibleChanged()), SLOT(onVisibleChanged()));
}
Ejemplo n.º 12
0
StatusNotifierItem::StatusNotifierItem(QObject *parent) :
		QObject{parent},
		m_needAttention{false}
{
	m_systemTrayIcon = make_owned<QSystemTrayIcon>(this);
	m_systemTrayIcon->setContextMenu(new QMenu{});

	connect(m_systemTrayIcon.get(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activated(QSystemTrayIcon::ActivationReason)));
	connect(m_systemTrayIcon.get(), SIGNAL(messageClicked()), this, SIGNAL(messageClicked()));
}
Ejemplo n.º 13
0
window::window(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::window)
{
    ui->setupUi(this);

    friends_table = new table_model(this);

    ui->tableView->setModel(friends_table);
    ui->tableView->verticalHeader()->hide();
    ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);

    connect(ui->add, SIGNAL(clicked()), this, SLOT(add_row()));
    connect(ui->remove, SIGNAL(clicked()), this, SLOT(remove_rows()));
    connect(ui->close, SIGNAL(clicked()), this, SLOT(apply_settings()));

    manager = new QNetworkAccessManager(this);

    connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(readyRead(QNetworkReply*)));

    // define tray icon

    QAction * quit_action = new QAction(tr("&Quit"), this);
    connect(quit_action, SIGNAL(triggered()), qApp, SLOT(quit()));
    QAction * settings_action = new QAction(tr("&Settings"), this);
    connect(settings_action, SIGNAL(triggered()), this, SLOT(show()));

    QMenu * tray_menu = new QMenu(this);
    tray_menu->addAction(settings_action);
    tray_menu->addSeparator();
    tray_menu->addAction(quit_action);

    tray_icon = new QSystemTrayIcon(this);
    tray_icon->setContextMenu(tray_menu);

    connect(tray_icon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));


    QIcon icon(":/images/teeworlds_1.png");
    tray_icon->setIcon(icon);
    setWindowIcon(icon);

    tray_icon->setToolTip("Teeworlds Notifier");

    tray_icon->show();

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(mainloop()));
    //timer->start(update_interval * 1000);

    need_correction = 2;
    mainloop();
}
Ejemplo n.º 14
0
void TabMessage::showSystemPopup(const Event_UserMessage &event) {
    if (trayIcon) {
        disconnect(trayIcon, SIGNAL(messageClicked()), 0, 0);
        trayIcon->showMessage(tr("Private message from ") + otherUserInfo->name().c_str(), event.message().c_str());
        connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    }
    else
    {
        qDebug() << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
    }
}
Ejemplo n.º 15
0
qcd::TrayIcon::TrayIcon(QObject *parent) :
    QSystemTrayIcon(parent)
{
    // if __linux__ initialize libnotify
#ifdef Q_OS_LINUX
    notify_init(APP_NAME);
#else
    // set default Qt's messageClicked() callback
    connect(this, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
#endif // Q_OS_LINUX
}
Ejemplo n.º 16
0
void QSystemTrayIconPrivate::install_sys()
{
    if (qpa_sys) {
        qpa_sys->init();
        QObject::connect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)),
                         q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason)));
        QObject::connect(qpa_sys, SIGNAL(messageClicked()),
                         q_func(), SIGNAL(messageClicked()));
        updateMenu_sys();
        updateIcon_sys();
        updateToolTip_sys();
    }
}
Ejemplo n.º 17
0
	bool TrayIcon::toastSupported()
	{
		return false;
		if (QSysInfo().windowsVersion() > QSysInfo::WV_WINDOWS8_1)
		{
			if (!ToastManager_.get())
			{
				ToastManager_.reset(new ToastManager());
				connect(ToastManager_.get(), SIGNAL(messageClicked(QString)), this, SLOT(messageClicked(QString)), Qt::QueuedConnection);
			}
			return true;
		}
		return false;
	}
Ejemplo n.º 18
0
widget::widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::widget)
{
    ui->setupUi(this);
    //去窗口栏
//    this->setWindowFlags(Qt::FramelessWindowHint);
    manager = new QNetworkAccessManager(this);
    city = "温州";
    queryWeather();
    connect(manager,SIGNAL(finished(QNetworkReply*)),  // 必须要有finished信号才算下载完数据
            this,SLOT(replyFinished(QNetworkReply*)));

    //托盘图标
    tray = new Tray;
    tray->show();
    timer = new QTimer;
    timer->start(3600000);
    connect(tray->hours1,&QAction::triggered,[this](){timer->start(3600000);qDebug() << timer->interval();});
    connect(tray->hours3,&QAction::triggered,[this](){timer->start(10800000);qDebug() << timer->interval();});
    connect(tray->hours6,&QAction::triggered,[this](){timer->start(21600000);qDebug() << timer->interval();});
    //计时器到了后查天气
    connect(timer,&QTimer::timeout,[this](){
       this->queryWeather();
    });
    //托盘图标点击事件
    connect(tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(widgetShow(QSystemTrayIcon::ActivationReason)));
   //托盘消息点击
    connect(tray,SIGNAL(messageClicked()),this,SLOT(widgetShow(QSystemTrayIcon::DoubleClick)));
}
Ejemplo n.º 19
0
//! [4]
void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
{
    switch (reason) {
    case QSystemTrayIcon::Context:
        //trayIcon->setContextMenu(trayIconMenu);
        //trayIcon->setContextMenu( new QMenu(this) );


        break;
    case QSystemTrayIcon::Trigger:
    case QSystemTrayIcon::DoubleClick:
        messageClicked();


//        currentIconIndex = (currentIconIndex+1) % iconList.count();
//        setIcon(currentIconIndex);


        break;
    case QSystemTrayIcon::MiddleClick:

        break;
    default:
        ;
    }
}
Ejemplo n.º 20
0
int Buddies::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: countOnlineUsers(); break;
        case 1: setUserStatus(); break;
        case 2: loginUser(); break;
        case 3: loginCurrentStatus(); break;
        case 4: validateUser(); break;
        case 5: stopifNotConnected(); break;
        case 6: myexit(); break;
        case 7: focusTabEdit(); break;
        case 8: structUser(); break;
        case 9: startChat(); break;
        case 10: helpAbout(); break;
        case 11: getSysInfo(); break;
        case 12: onlineNotify(); break;
        case 13: WriteOnWall(); break;
        case 14: Information(); break;
        case 15: dbstatus(); break;
        case 16: openNotes(); break;
        case 17: setIcon((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 18: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        case 19: messageClicked(); break;
        case 20: showMessage(); break;
        }
        _id -= 21;
    }
    return _id;
}
Ejemplo n.º 21
0
LegacySystemTray::LegacySystemTray(QWidget *parent)
  : SystemTray(parent),
  _blinkState(false),
  _lastMessageId(0)
{
#ifndef HAVE_KDE
  _trayIcon = new QSystemTrayIcon(associatedWidget());
#else
  _trayIcon = new KSystemTrayIcon(associatedWidget());
  // We don't want to trigger a minimize if a highlight is pending, so we brutally remove the internal connection for that
  disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                 _trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason)));
#endif
#ifndef Q_WS_MAC
  connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                     SLOT(on_activated(QSystemTrayIcon::ActivationReason)));
#endif
  connect(_trayIcon, SIGNAL(messageClicked()),
                     SLOT(on_messageClicked()));

  _blinkTimer.setInterval(500);
  _blinkTimer.setSingleShot(false);
  connect(&_blinkTimer, SIGNAL(timeout()), SLOT(on_blinkTimeout()));

  connect(this, SIGNAL(toolTipChanged(QString,QString)), SLOT(syncLegacyIcon()));
}
Ejemplo n.º 22
0
void MountTray::programInit()
{
  DCheck = new DevCheck(); //initialize class for checking devices
  qDebug() << "pc-mounttray: starting up";
  MTINIT=true; //set the flag that the mount tray is initializing;
  //getInitialUsername(); //try to detect the non-root user who is running the program with root permissions
  getFileManager();
    
  loadSavedSettings();
  
  trayIcon = new QSystemTrayIcon(this);
  trayIconMenu = new QMenu();
  //Generate the system menu options (these don't change)
  sysMenu = new QMenu( tr("More Options") );
    sysMenu->setIcon( QIcon(":icons/config.png") );
    //Add the additional options
    sysMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) );
    sysMenu->addAction( QIcon(":icons/harddrive.png"), tr("View Disk Usage"),this,SLOT(slotOpenFSDialog()) );
    sysMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) );
    //Add the setting dialog option seperately
    sysMenu->addSeparator();
    sysMenu->addAction( QIcon(":icons/dvd.png"), tr("Load ISO File"), this, SLOT(slotOpenISO()) );
    sysMenu->addAction( QIcon(":icons/config.png"), tr("Change Settings"), this, SLOT(slotOpenSettings()) );
    //Add the Close button seperately
    sysMenu->addSeparator();
    sysMenu->addAction( QIcon(":icons/application-exit.png"), tr("Close Tray"), this, SLOT(closeTray()) );
  
  // Tie the left-click signal to open the context menu
  connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) );
  //Connect the message clicked slot
  connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotPopupClicked()) );
  //Set the default Tray Icon (will change once tray menus are set)
  trayIcon->setIcon(QIcon(":icons/CDdevices-inactive.png"));
  trayIcon->show();

  //Do an initial scan of the devices with dmesg
  qDebug() << "-Performing initial device scan";
  scanInitialDevices();
  
  //Startup the devd watching process
  qDebug() << "-Starting up the DEVD watcher";
  devdTimer = new QTimer();
  devdTimer->setSingleShot(TRUE);
  connect(devdTimer,SIGNAL(timeout()),this,SLOT(slotDevChanges()));
  startupDevdProc();
  
  //Start up the filesystem watcher
  diskWatcher = new FSWatcher();
  connect(diskWatcher,SIGNAL(FSWarning(QString,QString)),this,SLOT(slotDisplayWarning(QString,QString)));
  if(useDiskWatcher){ 
    qDebug() << "-Starting up the disk space alert system";
    diskWatcher->start(diskTimerMaxMS); 
  }
  
  //Update the tray menu and icons
  updateMenu();

  qDebug() << "-Program now ready for use";
  QTimer::singleShot(500, this, SLOT(slotDoneWithInit()) ); //give it 1/2 a second to settle
}
Ejemplo n.º 23
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0),
      state_(STATE_DAEMON_UP)
{
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()));
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIconToolTip()));

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

    connect(SeahubNotificationsMonitor::instance(), SIGNAL(notificationsChanged()),
            this, SLOT(onSeahubNotificationsChanged()));

#ifdef Q_OS_WIN32
    connect(this, SIGNAL(messageClicked()),
            this, SLOT(onMessageClicked()));
#endif

    hide();

    createGlobalMenuBar();
#if defined(Q_OS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Ejemplo n.º 24
0
TrayIcon::TrayIcon(AppCore *core)
  : QSystemTrayIcon(core)
  , m_core(core)
  , m_message(Unknown)
{
  setIcon(QIcon(QLatin1String(":/images/icon16.png")));
  setToolTip(QString("%1 %2").arg(PRODUCT_NAME).arg(VERSION_STRING));

  m_widget = new QWidget();
  RecentItemDelegate *delegate = new RecentItemDelegate(core, this);

  m_window = new TrayWindow(core, m_widget);
  m_window->installEventFilter(this);
  m_window->recentView()->setItemDelegate(delegate);
  m_window->recentView()->setModel(core->recentModel());

  QTimer::singleShot(0, this, SLOT(show()));
  QTimer::singleShot(1000, this, SLOT(show()));

  connect(this, SIGNAL(messageClicked()), SLOT(onMessageClicked()));
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
  connect(m_window, SIGNAL(grabRect()), m_core, SLOT(grabRect()));
  connect(m_window, SIGNAL(grabScreen()), m_core, SLOT(grabScreen()));
  connect(m_window, SIGNAL(openFile()), m_core, SLOT(openFile()));
  connect(delegate, SIGNAL(closeRequest()), m_window, SLOT(close()));
  connect(delegate, SIGNAL(linkCopied(QUrl)), SLOT(onLinkCopied(QUrl)));
  connect(core->autoUpdate(), SIGNAL(done(int)), SLOT(onUpdateDone(int)));
}
void NMNotificationWindow::mousePressEvent(QMouseEvent *event)
{
    qDebug() << 3;
    emit messageClicked();

    QWidget::mousePressEvent(event);
}
Ejemplo n.º 26
0
PCloudApp::PCloudApp(int &argc, char **argv) :
    QApplication(argc, argv)
{
#ifdef Q_OS_MAC

    objc_class * cls = objc_getClass("NSApplication");
    SEL sharedApplication = sel_registerName("sharedApplication");
    objc_object* appInst = objc_msgSend((objc_object*) cls,sharedApplication);

    if(appInst != NULL)
    {
        objc_object* delegate = objc_msgSend(appInst, sel_registerName("delegate"));
        objc_object* delClass = objc_msgSend(delegate,  sel_registerName("class"));
        class_addMethod((Class)delClass,
                        sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:"),
                        (IMP)dockClickHandler,"B@:");
    }

#endif

#ifdef Q_OS_WIN
    notifythread = NULL;
#endif

    reglog=NULL;
    regwin=NULL;
    logwin=NULL;
    loggedmenu=NULL;
    settingswin=NULL;
    sharefolderwin=NULL;
    incomingshareswin=NULL;
    outgoingshareswin=NULL;
    mthread=NULL;
    loggedin=false;
    lastMessageType=-1;
    createMenus();
    settings=new PSettings(this);
    tray=new QSystemTrayIcon(this);
    tray->setIcon(QIcon(OFFLINE_ICON));
    tray->setContextMenu(notloggedmenu);
    tray->setToolTip("pCloud");
    connect(tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayClicked(QSystemTrayIcon::ActivationReason)));
    connect(tray, SIGNAL(messageClicked()), this, SLOT(trayMsgClicked()));
    connect(this, SIGNAL(logInSignal(QString, QString, quint64, bool, bool, quint64, quint64, bool)),
            this, SLOT(logIn(QString, QString, quint64,bool, bool, quint64, quint64, bool)));
    connect(this, SIGNAL(showLoginSignal()), this, SLOT(showLogin()));
    pCloudWin = new PCloudWindow(this);
    pCloudWin->layout()->setSizeConstraint(QLayout::SetFixedSize); //for auto resize
    pCloudWin->setOnlineItems(false);
    tray->show();
    if (settings->isSet("auth") && settings->get("auth").length() > 0){
        this->authentication = settings->get("auth");
        othread=new OnlineThread(this);
        othread->start();
    }
    else{
        othread=NULL;
        emit showLoginSignal();
    }
}
Ejemplo n.º 27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    parent(parent),
    ui(new Ui::MainWindow),
    trayIcon(new QSystemTrayIcon(this)),
    trayIconMenu(new QMenu(this)),
    quitAction(new QAction("Zamknij", this)),
    restoreAction(new QAction("Przywróć", this)),
    wiadomosciAction(new QAction("Wiadomości", this)),
    wyslij(new QAction("Wyślij wiadomość", this)),
    info(new QAction("Informacje", this)),
    connection(new Connection(this))
{
    ui->setupUi(this);
    ui->Ustawienia_status->setText(QString("Rozłączony"));
    ui->Ustawienia_wersja->setText(QString("Wersja: ")+VERSION);
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
    connect (ui->Ustawienia_b_aktualizuj, SIGNAL(clicked()), this, SLOT(aktualizujButtonClicked()));
    connect (ui->Ustawienia_b_zaloguj, SIGNAL(clicked()), this, SLOT(zalogujButtonClicked()));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(show()));
    connect(wiadomosciAction, SIGNAL(triggered()), this, SLOT(showWiadomosciDialog()));
    connect(ui->Grupy_list, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(setGrupaDane(QListWidgetItem *)));
    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(trayMessageClicked()));
    setIconsAndTray();
    trayMessageState.first = QString("INFORMATION");
}
Ejemplo n.º 28
0
//! [0]
void MainWindow::Window()
{
    iconList<<QIcon(":/images/bad.png")<<QIcon(":/images/heart.png")<<QIcon(":/images/trash.png");

    createActions();
    createTrayIcon();


    connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));


    setIcon(1);
    trayIcon->show();


}
Ejemplo n.º 29
0
QtTrayBackend::QtTrayBackend(MainWindow* parent):
    QObject(parent),
    TrayIconInterface(),
    m_mainWindow(parent),
    m_trayicon(new QSystemTrayIcon(this))
{
    m_trayicon->setIcon(QIcon::fromTheme("hotot_qt-inactive", QIcon("share/hotot/image/ic24_hotot_mono_dark.svg")));
    m_trayicon->show();
    connect(m_trayicon,
            SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this,
            SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));
    connect(m_trayicon,
            SIGNAL(messageClicked()),
            this,
            SLOT(messageClicked()));
}
Ejemplo n.º 30
0
void WareSrcMsgViewer::mouseDoubleClickEvent(QMouseEvent* /*Event*/)
{
  QMap<int, openfluid::waresdev::WareSrcMsgParser::WareSrcMsg>::iterator it = m_MessagesByBlockNumber.find(
      textCursor().blockNumber());

  if (it != m_MessagesByBlockNumber.end())
    emit messageClicked(it.value());
}