Пример #1
0
void QTlen::activeTrayIcon()
{
	if( !v_tray )
	{
		trayPopup = new QPopupMenu( this );
		//trayPopup->insertItem( tr("Receive event"), this, SLOT( showHide() ), 0, 0 );
		//trayPopup->setItemVisible( 0, false );
		//trayPopup->insertSeparator();
		trayPopup->insertItem( tr("Hide"), this, SLOT( showHide() ), 0, 1 );
		trayPopup->insertItem( tr("Set status"), statusPopup );
		trayPopup->insertSeparator();
		trayPopup->insertItem( QIconSet( takePixmap("exit") ), tr("Exit program"), this, SLOT( quit() ) );
		
		tray = new TrayIcon( takePixmap("offline"), "QTlen<br>" + tr( "Offline" ), trayPopup, this );
		
		updateTrayIcon();
		
		tray->show();
		
		v_tray = true;
		
		v_quit = false;
		
		connect( tray, SIGNAL( clicked( const QPoint&, int) ),
			this, SLOT( trayClicked( const QPoint&, int) ) );
		connect( tray, SIGNAL( doubleClicked( const QPoint& ) ),
			this, SLOT( trayDoubleClicked( const QPoint& ) ) );
		connect( tray, SIGNAL( closed() ),
			this, SLOT( trayClosed() ) );
	}
Пример #2
0
void MainWindow::retranslateUI()
{
	setWindowTitle(tr("Bluecherry %1").arg(QApplication::applicationVersion()));

	m_mainToolbar->setWindowTitle(tr("Main"));
	m_expandAllServersAction->setText(tr("Expand All Servers"));
	m_collapseAllServersAction->setText(tr("Collapse All Servers"));

	m_appMenu->setTitle(tr("&Bluecherry"));
	m_browseEventsAction->setText(tr("Browse &events"));
	m_downloadManagerAction->setText(tr("Show &download manager"));
	m_addServerAction->setText(tr("Add another server"));
	m_optionsAction->setText(tr("&Options"));
	m_quitAction->setText(tr("&Quit"));

	m_liveMenu->setTitle(tr("&Live"));
	m_newWindowAction->setText(tr("New window"));

	m_helpMenu->setTitle(tr("&Help"));
	m_documentationAction->setText(tr("&Documentation"));
	m_supportAction->setText(tr("Bluecherry &support"));
	m_suggestionsAction->setText(tr("Suggest a &feature"));
	m_aboutAction->setText(tr("&About Bluecherry"));

	updateLiveMenu();

	updateServersMenu();

	updateTrayIcon();
}
Пример #3
0
void TrayUI::watcherMessage(SystemFlags::SYSFLAG flag, SystemFlags::SYSMESSAGE msg){
  //reset the noInternet flag (prevent false positives, since something obviously just changed)
  bool oldstat = noInternet;
  if(flag != SystemFlags::NetRestart){ noInternet = false; }
  bool runcheck = false;
  switch(flag){
	case SystemFlags::NetRestart:
	  if(msg==SystemFlags::Error){ noInternet = true; }
	  else{ noInternet = false; }
	  if(!noInternet && oldstat){ checkForUpdates(); } //only re-check if no internet previously available
	  break;
	case SystemFlags::PkgUpdate:
	  if(msg==SystemFlags::Working){ PKGSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ PKGSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;
	case SystemFlags::SysUpdate:
	  if(msg==SystemFlags::Working){ SYSSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ SYSSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;	
	case SystemFlags::WardenUpdate:
	  if(msg==SystemFlags::Working){ WARDENSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ WARDENSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;	
  }
  if(runcheck){ checkForUpdates(); }
  qDebug() << "System Status Change:" << SYSSTATUS << PKGSTATUS << WARDENSTATUS << noInternet;
  //Update the tray icon
  updateTrayIcon();
  //Update the tooltip
  updateToolTip();
}
Пример #4
0
void Core::updateControls(int cardId)
{
	settingsStr_->clear(MIXERS);
	settingsStr_->clearSwitches();
	const int soundCardId = (alsaWork_->cardExists(cardId)) ? cardId : alsaWork_->getFirstCardWithMixers();
	alsaWork_->setCurrentCard(soundCardId);
	settingsStr_->setCardId(soundCardId);
	settingsStr_->setList(MIXERS, alsaWork_->getVolumeMixers());
	settingsStr_->addMixerSwitch(alsaWork_->getSwitchList());
	const std::string newName = alsaWork_->getMixerName(settingsStr_->mixerId());
	if (mixerName_ != newName) {
		mixerName_ = newName;
		alsaWork_->setCurrentMixer(mixerName_);
	}
	if (!isPulse_) {
		volumeValue_ = alsaWork_->getAlsaVolume();
	}
#ifdef HAVE_PULSE
	else if (pulse_) {
		volumeValue_ = pulse_->getVolume();
	}
#endif
	m_signal_volume_changed(volumeValue_);
	updateTrayIcon(volumeValue_);
	m_signal_mixer_muted(getMuted());
	if(settingsDialog_) {
		blockAllSignals(true);
		settingsDialog_->updateMixers(settingsStr_->mixerList());
		settingsDialog_->updateSwitches(settingsStr_->switchList());
		blockAllSignals(false);
	}
}
Пример #5
0
void Widget::onStatusSet(Status status)
{
    //We have to use stylesheets here, there's no way to
    //prevent the button icon from moving when pressed otherwise
    switch (status)
    {
    case Status::Online:
        ui->statusButton->setProperty("status" ,"online");
        ui->statusButton->setIcon(QIcon(":img/status/dot_online.png"));
        break;
    case Status::Away:
        ui->statusButton->setProperty("status" ,"away");
        ui->statusButton->setIcon(QIcon(":img/status/dot_idle.png"));
        break;
    case Status::Busy:
        ui->statusButton->setProperty("status" ,"busy");
        ui->statusButton->setIcon(QIcon(":img/status/dot_busy.png"));
        break;
    case Status::Offline:
        ui->statusButton->setProperty("status" ,"offline");
        ui->statusButton->setIcon(QIcon(":img/status/dot_away.png"));
        break;
    }
    updateTrayIcon();
}
Пример #6
0
void TrayIcon::pauseOrResume()
{
    _isPaused = !_isPaused;

    updateMenu();
    updateToolTip();
    updateTrayIcon();
}
Пример #7
0
void Widget::onEventIconTick()
{
    if (eventFlag)
    {
        eventIcon ^= true;
        updateTrayIcon();
    }
}
Пример #8
0
// ===============
//     PRIVATE SLOTS
// ===============
void LPTray::watcherMessage(QString type) {
    if ( ! type.isEmpty() )
        qDebug() << "New Watcher Message:" << type;

    QStringList info;
    if(type=="message" &&  popupPolicy > 1) {
        //Show the message pop-up
        info << "time" << "message";
        info = watcher->getMessages(type,info);
        if(!info.isEmpty()) {
            this->showMessage( info[0], info[1], QSystemTrayIcon::Information, 5000);
        }
    } else if(type=="replication") {
        info << "id" << "time" << "message";
        info = watcher->getMessages(type,info);
        if(info.isEmpty()) {
            return;
        }
        if(info[0] == "STARTED" && popupPolicy > 1 ) {
            this->showMessage( info[1], info[2], QSystemTrayIcon::Information, 5000);
        } else if(info[0] == "FINISHED" && popupPolicy > 1) {
            this->showMessage( info[1], info[2], QSystemTrayIcon::Information, 5000);
        } else if(info[0] == "ERROR" && popupPolicy > 0) {
            this->showMessage( info[1], info[2], QSystemTrayIcon::Warning, 10000);
        }

    } else if(type=="critical") {
        info << "time" << "message" << "device";
        info = watcher->getMessages(type,info);
        if(!info.isEmpty()) {
            QString msg = QString(tr("Time: %1")).arg(info[0]);
            //message/device information can have more than one listed
            QStringList devs = info[2].split(":::");
            QStringList msgs = info[1].split(":::");
            for(int i=0; i<devs.length(); i++) {
                msg.append("\n"+QString(tr("%1: %2")).arg(devs[i],msgs[i]) );
            }
            QString title = tr("System Alert");
            QMessageBox::warning(0, title ,msg);
        }
    } else if(type=="mirror") {

    } else if(type=="scrub" || type =="resilver") {
        info << "id" << "time" << "message";
        info = watcher->getMessages(type, info);
        if(!info.isEmpty()) {
            if(info[0]=="ERROR" && popupPolicy > 0 ) {
                this->showMessage(info[1], info[2], QSystemTrayIcon::Warning, 5000);
            } else if(popupPolicy > 1) {
                this->showMessage(info[1], info[2], QSystemTrayIcon::Information, 5000);
            }
        }
    }
    //Update the tray icon
    updateTrayIcon();
    //Update the tooltip
    updateToolTip();
}
Пример #9
0
void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) {
	g.sh->sendPing(); // Send initial ping to establish UDP connection

	g.uiSession = msg.session();
	g.pPermissions = ChanACL::Permissions(static_cast<unsigned int>(msg.permissions()));
	g.l->clearIgnore();
	if (msg.has_welcome_text()) {
		QString str = u8(msg.welcome_text());
		if (!str.isEmpty()) {
			g.l->log(Log::Information, tr("Welcome message: %1").arg(str));
		}
	}
	pmModel->ensureSelfVisible();
	pmModel->recheckLinks();

	qmTargetUse.clear();
	qmTargets.clear();
	for (int i=1;i<6;++i) {
		qmTargetUse.insert(i, i);
	}
	iTargetCounter = 100;

	AudioInput::setMaxBandwidth(msg.max_bandwidth());

	findDesiredChannel();

	QString host, uname, pw;
	unsigned short port;

	g.sh->getConnectionInfo(host, port, uname, pw);

	QList<Shortcut> sc = Database::getShortcuts(g.sh->qbaDigest);
	if (! sc.isEmpty()) {
		for (int i=0;i<sc.count(); ++i) {
			Shortcut &s = sc[i];
			s.iIndex = g.mw->gsWhisper->idx;
		}
		g.s.qlShortcuts << sc;
		GlobalShortcutEngine::engine->bNeedRemap = true;
	}

	const ClientUser *user = ClientUser::get(g.uiSession);
	connect(user, SIGNAL(talkingStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(muteDeafStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(prioritySpeakerStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(recordingStateChanged()), this, SLOT(userStateChanged()));
	
	qstiIcon->setToolTip(tr("Mumble: %1").arg(Qt::escape(Channel::get(0)->qsName)));

	// Update QActions and menues
	on_qmServer_aboutToShow();
	on_qmSelf_aboutToShow();
	qmChannel_aboutToShow();
	qmUser_aboutToShow();
	on_qmConfig_aboutToShow();

	updateTrayIcon();
}
Пример #10
0
// ===============
//     PRIVATE SLOTS
// ===============
void TrayUI::checkForUpdates(){
  //Simplification function to start all checks
    startSYSCheck();
    startPKGCheck();
    startWardenCheck();
    updateTrayIcon();
    updateToolTip();
    //QTimer::singleShot(60000, watcher, SLOT(checkFlags()) ); //make sure to manually check 1 minute from now
}
Пример #11
0
void Core::onSettingsDialogUsePulse(bool isPulse)
{
	if (pulse_) {
		isPulse_ = isPulse;
		settingsStr_->setUsePulse(isPulse);
		settings_->setUsePulse(isPulse);
		updateTrayIcon(volumeValue_);
	}
}
Пример #12
0
void TrayUI::startupChecks(){
  //Slot to perform startup checks as necessary
  // - This should make sure we don't re-check systems that were checked recently
  if(SYSSTATUS<0){ startSYSCheck(); }
  if(PKGSTATUS<0){ startPKGCheck(); }
  if(WARDENSTATUS<0){ startWardenCheck(); }
  updateTrayIcon();
  updateToolTip();  
  //QTimer::singleShot(60000, watcher, SLOT(checkFlags()) ); //make sure to manually check 1 minute from now
}
Пример #13
0
void TrayUI::startPKGCheck(){
  if(PKGSTATUS==1){ return; } //already checking for updates
  qDebug() << " -Starting Package Check...";
  PKGSTATUS=1; //working
  updateTrayIcon();
  updateToolTip();
  QString info = pcbsd::Utils::runShellCommand("syscache \"pkg #system hasupdates\"").join("");
  if(info.isEmpty() || info.contains("ERROR") ){ PKGSTATUS=0; noInternet=true; }
  else if(info.toLower().simplified()=="true"){ PKGSTATUS=2; noInternet=false; }
  else{ PKGSTATUS=0; noInternet=false; } //no updates available
}
Пример #14
0
void TrayIcon::nextWallpaper()
{
    try
    {
        WallpaperResult result;
        QRect desktopSize = Desktop::GetSize();

        _trayIcon->setIcon(*_iconLoading);

        QAction *action = qobject_cast<QAction *>(sender());
        if (action && action->property("categoryIndex") != QVariant::Invalid)
        {
            int categoryIndex = action->property("categoryIndex").toInt();
            QList<SourceViewModel*> sources;
            sources.append(_settingsViewModel->GetSources()[categoryIndex]);

            result = _providersManager->DownloadRandomImage(
                    sources,
                    desktopSize.width(),
                    desktopSize.height());
        }
        else
        {
            result = _providersManager->DownloadRandomImage(
                    _settingsViewModel->GetSources(),
                    desktopSize.width(),
                    desktopSize.height());
        }

        if (result.image.length() > 0)
        {
            Desktop::SetWallpaper(result.image);
        }

        updateTrayIcon();

        _currentUrl = result.url;
        _currentDescription = result.urlDescription;
        _currentName = result.name;

        _trayIcon->showMessage(result.name,
                               result.urlDescription,
                               QSystemTrayIcon::Information, 4000);

        _timeCounter = 0;
        updateToolTip();
    }
    catch (...)
    {
    }
}
Пример #15
0
void TrayUI::startSYSCheck(){
  if(rebootNeeded()){ return; } //do not start another check if a reboot is required first
  if(SYSSTATUS==1){ return; } //already checking for updates
  qDebug() << " -Starting System Check...";
  //QString cmd = "sudo pc-updatemanager check";
  SYSSTATUS=1; //working
  //QProcess::startDetached(cmd);
  updateTrayIcon();
  updateToolTip();  
  QString info = pcbsd::Utils::runShellCommand("syscache hasupdates").join("");
  if(info.isEmpty() || info.contains("ERROR") ){ SYSSTATUS=0; }
  else if(info.toLower().simplified()=="true"){ SYSSTATUS=2; }
  else{ SYSSTATUS=0; } //no updates available
}
Пример #16
0
void TrayUI::watcherMessage(SystemFlags::SYSFLAG flag, SystemFlags::SYSMESSAGE msg){
  //reset the noInternet flag (prevent false positives, since something obviously just changed)
    // - PBI system uses cached files - not a good indicator of internet availability
  bool oldstat = noInternet;
  if(flag != SystemFlags::PbiUpdate && flag != SystemFlags::NetRestart){ noInternet = false; }
  switch(flag){
	case SystemFlags::NetRestart:
	  if(msg==SystemFlags::Error){ noInternet = true; }
	  else{ noInternet = false; }
	  if(!noInternet && oldstat){ checkForUpdates(); } //only re-check if no internet previously available
	  break;
	case SystemFlags::PkgUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ PKGSTATUS=2; }
	  else if(msg==SystemFlags::Working){ PKGSTATUS=1; }
	  else if(msg==SystemFlags::Success){ PKGSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ PKGSTATUS=3; }
	  else if(msg==SystemFlags::Error){ PKGSTATUS=0; noInternet=true; }
	  else{ startPKGCheck(); } //unknown - check it
	  break;
	case SystemFlags::SysUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ SYSSTATUS=2; }
	  else if(msg==SystemFlags::Working){ SYSSTATUS=1; }
	  else if(msg==SystemFlags::Success){ SYSSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ SYSSTATUS=3; }
	  else if(msg==SystemFlags::Error){ SYSSTATUS=0; noInternet=true; }
	  else{ startSYSCheck(); } //unknown - check it
	  break;	
	case SystemFlags::PbiUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ PBISTATUS=2; }
	  else if(msg==SystemFlags::Working){ PBISTATUS=1; }
	  else if(msg==SystemFlags::Success){ PBISTATUS=0; }
	  else if(msg==SystemFlags::Updating){ PBISTATUS=3; }
	  else if(msg==SystemFlags::Error){ PBISTATUS=0; } //nothing special for PBI errors yet
	  else{ startPBICheck(); } //unknown - check it
	  break;	
	case SystemFlags::WardenUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ WARDENSTATUS=2; }
	  else if(msg==SystemFlags::Working){ WARDENSTATUS=1; }
	  else if(msg==SystemFlags::Success){ WARDENSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ WARDENSTATUS=3; }
	  else if(msg==SystemFlags::Error){ WARDENSTATUS=0; noInternet=true; }
	  else{ startWardenCheck(); } //unknown - check it
	  break;	
  }
  qDebug() << "System Status Change:" << SYSSTATUS << PKGSTATUS << PBISTATUS <<WARDENSTATUS;
  //Update the tray icon
  updateTrayIcon();
  //Update the tooltip
  updateToolTip();
}
Пример #17
0
void TrayIcon::createTrayIcon()
{
    if (_trayIcon != 0) return;

    QAction *actionConfig = new QAction(tr("Config..."), this);
    connect(actionConfig, &QAction::triggered, this, &TrayIcon::toggleConfigView);

    QAction *actionAbout = new QAction(tr("About..."), this);
    connect(actionAbout, &QAction::triggered, this, &TrayIcon::about);

    QAction *actionShowProvidersInfo = new QAction(tr("Show providers info..."), this);
    connect(actionShowProvidersInfo, &QAction::triggered, this, &TrayIcon::showProvidersInfo);

    QAction *actionCopyWallpaperAddress = new QAction(tr("Copy wallpaper address"), this);
    connect(actionCopyWallpaperAddress, &QAction::triggered, this, &TrayIcon::copyWallpaperAddress);

    _actionPauseOrResume = new QAction(tr("Pause"), this);
    connect(_actionPauseOrResume, &QAction::triggered, this, &TrayIcon::pauseOrResume);

    QAction *actionNextWallpaper = new QAction(tr("Next wallpaper"), this);
    connect(actionNextWallpaper, &QAction::triggered, this, &TrayIcon::nextWallpaper);

    QAction *actionQuit = new QAction(tr("&Quit"), this);
    connect(actionQuit, &QAction::triggered, this, &TrayIcon::quit);

    _trayIconMenu = new QMenu(0);
    _trayIconMenu->addAction(actionConfig);
    _trayIconMenu->addSeparator();
    _trayIconMenu->addAction(actionAbout);
    _trayIconMenu->addAction(actionShowProvidersInfo);
    _trayIconMenu->addSeparator();
    _trayIconMenu->addAction(_actionPauseOrResume);
    _trayIconMenu->addAction(actionCopyWallpaperAddress);
    _submenuNextWallpaperCategory = _trayIconMenu->addMenu(tr("Next wallpaper from category"));
    _trayIconMenu->addAction(actionNextWallpaper);
    _trayIconMenu->addSeparator();
    _trayIconMenu->addAction(actionQuit);

    _trayIcon = new QSystemTrayIcon(0);
    _trayIcon->setContextMenu(_trayIconMenu);
    updateTrayIcon();
    _trayIcon->setToolTip(tr("Tapeciarnia"));

    connect(_trayIcon, &QSystemTrayIcon::activated,
            this, &TrayIcon::iconActivated);

    updateMenu();

    _trayIcon->show();
}
Пример #18
0
void Core::onVolumeSlider(double value)
{
	signal_timer_.block(true);
	volumeValue_ = value;
	pollVolume_ = value;
	if (!isPulse_) {
		alsaWork_->setAlsaVolume(value);
		pollVolume_ = alsaWork_->getAlsaVolume();
	}
#ifdef HAVE_PULSE
	else if (pulse_) {
		pulse_->setVolume(int(value));
	}
#endif
	updateTrayIcon(value);
	signal_timer_.block(false);
}
Пример #19
0
void BalanceWindow::setupTrayIcon(){
    trayIcon = new QSystemTrayIcon(this);
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    trayIcon->show();
    updateTrayIcon(120.);

    trayMenu = new QMenu();
    trayIcon->setContextMenu(trayMenu);

    trayMenu->addAction(ui->updateAction);
    trayMenu->addSeparator();
    trayMenu->addAction(ui->settingsAction);
    trayMenu->addSeparator();
    trayMenu->addAction(ui->quitAction);

}
Пример #20
0
void BalanceWindow::updateInfo()
{
    double balance = settings->balance();
    ui->balance->setText(QString("%1").arg(balance));
    updateTrayIcon(balance);
    ui->lastUpdate->setText(settings->lastUpdate());
    ui->dayTo->setText(QString("%1").arg(settings->dayToPay()));

    ui->payTo->setText(settings->needPay());

    if(settings->levelBalance()){
        if(settings->trayNotice())
            showMessage(settings->levelBalance());
        if(settings->emailNotice())
            sendEmail(settings->levelBalance());
    }


    setStatus("Готово");
}
Пример #21
0
bool Widget::event(QEvent * e)
{
    switch(e->type())
    {
        case QEvent::WindowActivate:
            if (activeChatroomWidget != nullptr)
            {
                activeChatroomWidget->resetEventFlags();
                activeChatroomWidget->updateStatusLight();
            }
            if (eventFlag)
            {
                eventFlag = false;
                eventIcon = false;
                updateTrayIcon();
            }
        default:
            break;
    }

    return QWidget::event(e);
}
Пример #22
0
void TrayUI::startWardenCheck(){
  //WARDENSTATUS=0;
  //return; //Warden check command not currently working - just keep it invisible
  //-------
  if(rebootNeeded()){ return; } //do not start another check if a reboot is required first
  if(WARDENSTATUS==1){ return; } //already checking for updates
  qDebug() << " -Starting Warden Check...";
  WARDENSTATUS=1; //working
  updateTrayIcon();
  updateToolTip();
  
  QStringList info = pcbsd::Utils::runShellCommand("syscache \"jail list\"").join("").split(", ");
  for(int i=0; i<info.length(); i++){
    if(info[i].isEmpty()){ continue; }
    else if( info[i].contains("[ERROR]") ){ WARDENSTATUS=0; break;} //unknown jails - assume none so success
    //Check for updates in this jail
    info[i] = pcbsd::Utils::runShellCommand("syscache \"pkg "+info[i]+" hasupdates\"").join("");
    if(info[i].toLower().simplified()=="true"){ WARDENSTATUS=2; break; } //updates available: stop checking others
    //keep checking if it gets here (no updates for this one)
  }
  if(WARDENSTATUS==1){ WARDENSTATUS=0; } //Nothing found - success
}
Пример #23
0
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);
		}
	}
}
Пример #24
0
void Widget::init()
{
    ui->setupUi(this);

    timer = new QTimer();
    timer->start(1000);
    offlineMsgTimer = new QTimer();
    offlineMsgTimer->start(15000);

    //restore window state
    restoreGeometry(Settings::getInstance().getWindowGeometry());
    restoreState(Settings::getInstance().getWindowState());
    ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());

    statusOnline = new QAction(tr("Online", "Button to set your status to 'Online'"), this);
    statusOnline->setIcon(QIcon(":img/status/dot_online.png"));
    connect(statusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
    statusAway = new QAction(tr("Away", "Button to set your status to 'Away'"), this);
    statusAway->setIcon(QIcon(":img/status/dot_idle.png"));
    connect(statusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
    statusBusy = new QAction(tr("Busy", "Button to set your status to 'Busy'"), this);
    statusBusy->setIcon(QIcon(":img/status/dot_busy.png"));
    connect(statusBusy, SIGNAL(triggered()), this, SLOT(setStatusBusy()));

    if (QSystemTrayIcon::isSystemTrayAvailable())
    {
        icon = new SystemTrayIcon;
        updateTrayIcon();
        trayMenu = new QMenu;

        actionQuit = new QAction(tr("&Quit"), this);
        connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));

        trayMenu->addAction(statusOnline);
        trayMenu->addAction(statusAway);
        trayMenu->addAction(statusBusy);
        trayMenu->addSeparator();
        trayMenu->addAction(actionQuit);
        icon->setContextMenu(trayMenu);

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

        icon->show();
        icon->hide();

        if (Settings::getInstance().getShowSystemTray())
        {
            icon->show();
            if (Settings::getInstance().getAutostartInTray() == false)
                this->show();
        }
        else
            this->show();
    }
    else
    {
        qWarning() << "Widget: No system tray detected!";
        icon = nullptr;
        this->show();
    }

    ui->statusbar->hide();
    ui->menubar->hide();

    layout()->setContentsMargins(0, 0, 0, 0);
    ui->friendList->setStyleSheet(Style::resolve(Style::getStylesheet(":ui/friendList/friendList.css")));

    profilePicture = new MaskablePixmapWidget(this, QSize(40, 40), ":/img/avatar_mask.png");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.png"));
    profilePicture->setClickable(true);
    ui->myProfile->insertWidget(0, profilePicture);
    ui->myProfile->insertSpacing(1, 7);

    ui->mainContent->setLayout(new QVBoxLayout());
    ui->mainHead->setLayout(new QVBoxLayout());
    ui->mainHead->layout()->setMargin(0);
    ui->mainHead->layout()->setSpacing(0);

    ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}"));
    
    if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
            && Settings::getInstance().getStyle() != "None")
    {
        ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
        ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
    }
    
    ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));    
    ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
    
    ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));

    contactListWidget = new FriendListWidget();
    ui->friendList->setWidget(contactListWidget);
    ui->friendList->setLayoutDirection(Qt::RightToLeft);

    ui->nameLabel->setEditable(true);
    ui->statusLabel->setEditable(true);

    ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));

    QMenu *statusButtonMenu = new QMenu(ui->statusButton);
    statusButtonMenu->addAction(statusOnline);
    statusButtonMenu->addAction(statusAway);
    statusButtonMenu->addAction(statusBusy);
    ui->statusButton->setMenu(statusButtonMenu);

    // disable proportional scaling
    ui->mainSplitter->setStretchFactor(0,0);
    ui->mainSplitter->setStretchFactor(1,1);

    ui->statusButton->setProperty("status", "offline");
    Style::repolish(ui->statusButton);

    // Disable some widgets until we're connected to the DHT
    ui->statusButton->setEnabled(false);

    Style::setThemeColor(Settings::getInstance().getThemeColor());
    reloadTheme();
    
    filesForm = new FilesForm();
    addFriendForm = new AddFriendForm;
    settingsWidget = new SettingsWidget();

    Core* core = Nexus::getCore();
    connect(core, SIGNAL(fileDownloadFinished(const QString&)), filesForm, SLOT(onFileDownloadComplete(const QString&)));
    connect(core, SIGNAL(fileUploadFinished(const QString&)), filesForm, SLOT(onFileUploadComplete(const QString&)));
    connect(settingsWidget, &SettingsWidget::setShowSystemTray, this, &Widget::onSetShowSystemTray);
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
    connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
    connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
    connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
    connect(ui->nameLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onUsernameChanged(QString, QString)));
    connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
    connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved);
    connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
    connect(addFriendForm, SIGNAL(friendRequested(QString, QString)), this, SIGNAL(friendRequested(QString, QString)));
    connect(timer, &QTimer::timeout, this, &Widget::onUserAwayCheck);
    connect(timer, &QTimer::timeout, this, &Widget::onEventIconTick);
    connect(offlineMsgTimer, &QTimer::timeout, this, &Widget::processOfflineMsgs);

    addFriendForm->show(*ui);

#if (AUTOUPDATE_ENABLED)
    if (Settings::getInstance().getCheckUpdates())
        AutoUpdater::checkUpdatesAsyncInteractive();
#endif
}
Пример #25
0
void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
	ACTOR_INIT;
	SELF_INIT;
	ClientUser *pDst = ClientUser::get(msg.session());
	bool bNewUser = false;

	if (! pDst) {
		if (msg.has_name()) {
			pDst = pmModel->addUser(msg.session(), u8(msg.name()));
			bNewUser = true;
		} else {
			return;
		}
	}

	if (msg.has_user_id())
		pmModel->setUserId(pDst, msg.user_id());

	if (msg.has_hash()) {
		pmModel->setHash(pDst, u8(msg.hash()));
		const QString &name = Database::getFriend(pDst->qsHash);
		if (! name.isEmpty())
			pmModel->setFriendName(pDst, name);
		if (Database::isLocalMuted(pDst->qsHash))
			pDst->setLocalMute(true);
		if (Database::isLocalIgnored(pDst->qsHash))
			pDst->setLocalIgnore(true);
	}

	if (bNewUser)
		g.l->log(Log::UserJoin, tr("%1 connected.").arg(Log::formatClientUser(pDst, Log::Source)));

	if (msg.has_self_deaf() || msg.has_self_mute()) {
		if (msg.has_self_mute())
			pDst->setSelfMute(msg.self_mute());
		if (msg.has_self_deaf())
			pDst->setSelfDeaf(msg.self_deaf());

		if (pSelf && pDst != pSelf && (pDst->cChannel == pSelf->cChannel)) {
			QString name = pDst->qsName;
			if (pDst->bSelfMute && pDst->bSelfDeaf)
				g.l->log(Log::OtherSelfMute, tr("%1 is now muted and deafened.").arg(Log::formatClientUser(pDst, Log::Target)));
			else if (pDst->bSelfMute)
				g.l->log(Log::OtherSelfMute, tr("%1 is now muted.").arg(Log::formatClientUser(pDst, Log::Target)));
			else
				g.l->log(Log::OtherSelfMute, tr("%1 is now unmuted.").arg(Log::formatClientUser(pDst, Log::Target)));
		}
	}

	if (msg.has_recording()) {
		pDst->setRecording(msg.recording());

		// Do nothing during initial sync
		if (pSelf) {
			if (pDst == pSelf) {
				if (pDst->bRecording) {
					g.l->log(Log::Recording, tr("Recording started"));
				} else {
					g.l->log(Log::Recording, tr("Recording stopped"));
				}
			} else if (pDst->cChannel->allLinks().contains(pSelf->cChannel)) {
				if (pDst->bRecording) {
					g.l->log(Log::Recording, tr("%1 started recording.").arg(Log::formatClientUser(pDst, Log::Source)));
				} else {
					g.l->log(Log::Recording, tr("%1 stopped recording.").arg(Log::formatClientUser(pDst, Log::Source)));
				}
			}
		}
	}

	if (msg.has_priority_speaker()) {
		if (pSelf && ((pDst->cChannel == pSelf->cChannel) || (pSrc == pSelf))) {
			if ((pSrc == pDst) && (pSrc == pSelf)) {
				if (pDst->bPrioritySpeaker) {
					g.l->log(Log::YouMuted, tr("You revoked your priority speaker status."));
				} else  {
					g.l->log(Log::YouMuted, tr("You assumed priority speaker status."));
				}
			} else if ((pSrc != pSelf) && (pDst == pSelf) ) {
				if (pDst->bPrioritySpeaker) {
					g.l->log(Log::YouMutedOther, tr("%1 revoked your priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
				} else  {
					g.l->log(Log::YouMutedOther, tr("%1 gave you priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
				}
			} else if ((pSrc == pSelf) && (pSrc != pDst)) {
				if (pDst->bPrioritySpeaker) {
					g.l->log(Log::YouMutedOther, tr("You revoked priority speaker status for %1.").arg(Log::formatClientUser(pDst, Log::Target)));
				} else  {
					g.l->log(Log::YouMutedOther, tr("You gave priority speaker status to %1.").arg(Log::formatClientUser(pDst, Log::Target)));
				}
			} else if ((pSrc == pDst) && (pSrc != pSelf)) {
				if (pDst->bPrioritySpeaker) {
					g.l->log(Log::OtherMutedOther, tr("%1 revoked own priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
				} else {
					g.l->log(Log::OtherMutedOther, tr("%1 assumed priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
				}
			} else if ((pSrc != pSelf) && (pDst != pSelf)) {
				if (pDst->bPrioritySpeaker) {
					g.l->log(Log::OtherMutedOther, tr("%1 revoked priority speaker status for %2.").arg(Log::formatClientUser(pSrc, Log::Source), Log::formatClientUser(pDst, Log::Target)));
				} else if (!pDst->bPrioritySpeaker) {
					g.l->log(Log::OtherMutedOther, tr("%1 gave priority speaker status to %2.").arg(Log::formatClientUser(pSrc, Log::Source), Log::formatClientUser(pDst, Log::Target)));
				}
			}
		}

		pDst->setPrioritySpeaker(msg.priority_speaker());
	}

	if (msg.has_deaf() || msg.has_mute() || msg.has_suppress()) {
		if (msg.has_mute())
			pDst->setMute(msg.mute());
		if (msg.has_deaf())
			pDst->setDeaf(msg.deaf());
		if (msg.has_suppress())
			pDst->setSuppress(msg.suppress());

		if (pSelf && ((pDst->cChannel == pSelf->cChannel) || (pSrc == pSelf))) {
			if (pDst == pSelf) {
				if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
					g.l->log(Log::YouMuted, tr("You were muted and deafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
				} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
					g.l->log(Log::YouMuted, tr("You were unmuted and undeafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
				} else {
					if (msg.has_mute()) {
						if (pDst->bMute)
							g.l->log(Log::YouMuted, tr("You were muted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
						else
							g.l->log(Log::YouMuted, tr("You were unmuted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
					}

					if (msg.has_deaf()) {
						if (!pDst->bDeaf)
							g.l->log(Log::YouMuted, tr("You were undeafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
					}
				}

				if (msg.has_suppress()) {
					if (pDst->bSuppress)
						g.l->log(Log::YouMuted, tr("You were suppressed."));
					else {
						if (msg.has_channel_id())
							g.l->log(Log::YouMuted, tr("You were unsuppressed."));
						else
							g.l->log(Log::YouMuted, tr("You were unsuppressed by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
					}
				}

				updateTrayIcon();
			} else if (pSrc == pSelf) {
				if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
					g.l->log(Log::YouMutedOther, tr("You muted and deafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
				} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
					g.l->log(Log::YouMutedOther, tr("You unmuted and undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
				} else {
					if (msg.has_mute()) {
						if (pDst->bMute)
							g.l->log(Log::YouMutedOther, tr("You muted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
						else
							g.l->log(Log::YouMutedOther, tr("You unmuted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
					}

					if (msg.has_deaf()) {
						if (!pDst->bDeaf)
							g.l->log(Log::YouMutedOther, tr("You undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
					}
				}

				if (msg.has_suppress()) {
					if (! msg.has_channel_id()) {
						if (pDst->bSuppress)
							g.l->log(Log::YouMutedOther, tr("You suppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
						else
							g.l->log(Log::YouMutedOther, tr("You unsuppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
					}
				}
			} else {
				if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
					g.l->log(Log::OtherMutedOther, tr("%1 muted and deafened by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
				} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
					g.l->log(Log::OtherMutedOther, tr("%1 unmuted and undeafened by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
				} else {
					if (msg.has_mute()) {
						if (pDst->bMute)
							g.l->log(Log::OtherMutedOther, tr("%1 muted by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
						else
							g.l->log(Log::OtherMutedOther, tr("%1 unmuted by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
					}

					if (msg.has_deaf()) {
						if (!pDst->bDeaf)
							g.l->log(Log::OtherMutedOther, tr("%1 undeafened by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
					}
				}

				if (msg.has_suppress()) {
					if (! msg.has_channel_id()) {
						if (pDst->bSuppress)
							g.l->log(Log::OtherMutedOther, tr("%1 suppressed by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
						else
							g.l->log(Log::OtherMutedOther, tr("%1 unsuppressed by %2.").arg(Log::formatClientUser(pDst, Log::Target), Log::formatClientUser(pSrc, Log::Source)));
					}
				}
			}
		}
	}

	if (msg.has_channel_id()) {
		Channel *c = Channel::get(msg.channel_id());
		if (!c) {
			qWarning("MessageUserMove for unknown channel.");
			c = Channel::get(0);
		}

		Channel *old = pDst->cChannel;
		if (c != old) {
			bool log = pSelf && !((pDst == pSelf) && (pSrc == pSelf));

			if (log) {
				if (pDst == pSelf) {
					g.l->log(Log::ChannelJoin, tr("You were moved to %1 by %2.").arg(Log::formatChannel(c)).arg(Log::formatClientUser(pSrc, Log::Source)));
				} else if (pDst->cChannel == pSelf->cChannel) {
					if (pDst == pSrc)
						g.l->log(Log::ChannelLeave, tr("%1 moved to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c)));
					else
						g.l->log(Log::ChannelLeave, tr("%1 moved to %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c)).arg(Log::formatClientUser(pSrc, Log::Source)));
				} else if (pSrc == pSelf) {
					g.l->log(Log::ChannelJoin, tr("You moved %1 to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c)));
				}
			}

			pmModel->moveUser(pDst, c);

			if (pDst == pSelf) {
				g.mw->updateChatBar();
				qsDesiredChannel = c->getPath();
			}

			if (log && (pDst != pSelf) && (pDst->cChannel == pSelf->cChannel)) {
				if (pDst == pSrc)
					g.l->log(Log::ChannelJoin, tr("%1 entered channel.").arg(Log::formatClientUser(pDst, Log::Target)));
				else
					g.l->log(Log::ChannelJoin, tr("%1 moved in from %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(old)).arg(Log::formatClientUser(pSrc, Log::Source)));

				if (pDst->bRecording)
					g.l->log(Log::Recording, tr("%1 is recording").arg(Log::formatClientUser(pDst, Log::Target)));
			}
		}
	}
	if (msg.has_name()) {
		QString oldName = pDst->qsName;
		QString newName = u8(msg.name());
		pmModel->renameUser(pDst, newName);
		if (! oldName.isNull() && oldName != newName) {
			g.l->log(Log::UserRenamed, tr("%1 renamed to %2.").arg(Log::formatClientUser(pDst, Log::Target, oldName),
				Log::formatClientUser(pDst, Log::Target)));
		}
	}
	if (msg.has_texture_hash()) {
		pDst->qbaTextureHash = blob(msg.texture_hash());
		pDst->qbaTexture = QByteArray();
		g.o->verifyTexture(pDst);
	}
	if (msg.has_texture()) {
		pDst->qbaTexture = blob(msg.texture());
		if (pDst->qbaTexture.isEmpty()) {
			pDst->qbaTextureHash = QByteArray();
		} else {
			pDst->qbaTextureHash = sha1(pDst->qbaTexture);
			Database::setBlob(pDst->qbaTextureHash, pDst->qbaTexture);
		}
		g.o->verifyTexture(pDst);
	}
	if (msg.has_comment_hash())
		pmModel->setCommentHash(pDst, blob(msg.comment_hash()));
	if (msg.has_comment())
		pmModel->setComment(pDst, u8(msg.comment()));
	if (msg.icons_size()) {
		QList<QByteArray> ql;
		for (int i=0;i<msg.icons_size();++i) {
			ql << blob(msg.icons(i));
		}
		pmModel->setIcons(pDst, ql);
	}
}
Пример #26
0
MainWindow::MainWindow(DVRServerRepository *serverRepository, QWidget *parent)
    : QMainWindow(parent), m_serverRepository(serverRepository), m_trayIcon(0)
{
    Q_ASSERT(m_serverRepository);

    bcApp->mainWindow = this;
    connect(bcApp->eventDownloadManager(), SIGNAL(eventVideoDownloadAdded(EventVideoDownload*)),
            this, SLOT(showDownloadsWindow()));

    setUnifiedTitleAndToolBarOnMac(true);
	resize(1100, 750);
    createMenu();
    updateTrayIcon();
    setObjectName("MainWindow");

    statusBar()->addPermanentWidget(new StatusBandwidthWidget(statusBar()));
    statusBar()->addWidget(new StatusBarServerAlert(m_serverRepository, statusBar()));

#ifdef Q_OS_MAC
    statusBar()->setSizeGripEnabled(false);
    if (style()->inherits("QMacStyle"))
        statusBar()->setFixedHeight(24);
#endif

    /* Experimental toolbar */
    m_mainToolbar = new QToolBar(tr("Main"));
    m_mainToolbar->setMovable(false);
    m_mainToolbar->setIconSize(QSize(16, 16));
    m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/cassette.png")), tr("Events"), this, SLOT(showEventsWindow()));
	m_expandAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/expand-all.png")), tr("Expand All Servers"));
	m_collapseAllServersAction = m_mainToolbar->addAction(QIcon(QLatin1String(":/icons/collapse-all.png")), tr("Collapse All Servers"));
    addToolBar(Qt::TopToolBarArea, m_mainToolbar);

    /* Splitters */
    m_leftSplit = new MacSplitter(Qt::Horizontal);
    m_centerSplit = new MacSplitter(Qt::Vertical);

    /* Live view */
    m_liveView = new LiveViewWindow(serverRepository, this);

    /* Recent events */
    QWidget *eventsWidget = createRecentEvents();

    /* Layouts */
    m_leftSplit->addWidget(createSourcesList());
    m_leftSplit->addWidget(m_centerSplit);
    m_leftSplit->setStretchFactor(1, 1);
    m_leftSplit->setCollapsible(0, false);
    m_leftSplit->setCollapsible(1, false);

    m_centerSplit->addWidget(m_liveView);
    m_centerSplit->addWidget(eventsWidget);
    m_centerSplit->setStretchFactor(0, 1);
    m_centerSplit->setCollapsible(0, false);
    m_centerSplit->setCollapsible(1, false);

    /* Set center widget */
    QWidget *center = new QWidget;
    QBoxLayout *centerLayout = new QVBoxLayout(center);
    centerLayout->setMargin(0);
    centerLayout->setSpacing(0);
    centerLayout->addWidget(m_leftSplit, 1);
    setCentralWidget(center);

#ifdef Q_OS_WIN
    /* There is no top border on the statusbar on Windows, and we need one. */
    if (style()->inherits("QWindowsStyle"))
    {
        QFrame *line = new QFrame;
        line->setFrameStyle(QFrame::Plain | QFrame::HLine);
        QPalette p = line->palette();
        p.setColor(QPalette::WindowText, QColor(171, 175, 183));
        line->setPalette(p);
        line->setFixedHeight(1);
        centerLayout->addWidget(line);
    }
#endif

    QSettings settings;
    bcApp->liveView->setBandwidthMode(settings.value(QLatin1String("ui/liveview/bandwidthMode")).toInt());
    restoreGeometry(settings.value(QLatin1String("ui/main/geometry")).toByteArray());
    if (!m_centerSplit->restoreState(settings.value(QLatin1String("ui/main/centerSplit")).toByteArray()))
    {
        m_centerSplit->setSizes(QList<int>() << 1000 << 130);
    }
    if (!m_leftSplit->restoreState(settings.value(QLatin1String("ui/main/leftSplit")).toByteArray()))
    {
#ifdef Q_OS_MAC
        m_leftSplit->setSizes(QList<int>() << 210 << 1000);
#else
        m_leftSplit->setSizes(QList<int>() << 190 << 1000);
#endif
    }

    m_leftSplit->setHandleWidth(2);
    m_centerSplit->setHandleWidth(2);

    QString lastLayout = settings.value(QLatin1String("ui/cameraArea/lastLayout"), tr("Default")).toString();
    m_liveView->setLayout(lastLayout);

    connect(m_liveView, SIGNAL(layoutChanged(QString)), SLOT(liveViewLayoutChanged(QString)));
    connect(m_leftSplit, SIGNAL(splitterMoved(int,int)), SLOT(updateToolbarWidth()));
    updateToolbarWidth();

    connect(bcApp, SIGNAL(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)),
            SLOT(sslConfirmRequired(DVRServer*,QList<QSslError>,QSslConfiguration)));
    connect(bcApp, SIGNAL(queryLivePaused()), SLOT(queryLivePaused()));
    connect(m_serverRepository, SIGNAL(serverAdded(DVRServer*)), SLOT(onServerAdded(DVRServer*)));

    foreach (DVRServer *s, m_serverRepository->servers())
        onServerAdded(s);

    connect(qApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));

    m_sourcesList->setFocus(Qt::OtherFocusReason);

    connect(m_expandAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(expandAll()));
    connect(m_collapseAllServersAction, SIGNAL(triggered()), m_sourcesList, SLOT(collapseAll()));

    retranslateUI();

    if (settings.value(QLatin1String("ui/saveSession"), false).toBool())
        m_liveView->restoreSession();
}
Пример #27
0
//PUBLIC
TrayUI::TrayUI() : QSystemTrayIcon(){
  qDebug() << "Starting Up System Updater Tray...";
  //Set all the initial flags ( <0 means do initial checks if appropriate)
  PKGSTATUS=-1;
  SYSSTATUS=-1;
  WARDENSTATUS=-1;
  noInternet = false; //assume internet is available until we get a failure
  wasworking = false;
  //Load the tray settings file
  settings = new QSettings("PCBSD");
    settings->sync(); //make sure to load it right away
  //Setup the checktimer
  chktime = new QTimer(this);
	chktime->setInterval(1000 * 60 * 60 * 24); //every 24 hours
	connect(chktime, SIGNAL(timeout()), this, SLOT(checkForUpdates()) );
  //Generate the Menu
  menu = new QMenu(0);
  this->setContextMenu(menu);
  connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemClicked(QAction*)) );
  //Now fill the menu with items
    // - System Update Manager
  QAction* act = new QAction( QIcon(":/images/sysupdater.png"), tr("Start the Update Manager"), this);
	act->setWhatsThis("sys"); //system updater code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - AppCafe
  act = new QAction( QIcon(":/images/appcafe.png"), tr("Start the AppCafe"), this);
	act->setWhatsThis("pkg"); // PKG code
	menu->addAction(act);
    // - Warden
  act = new QAction( QIcon(":/images/warden.png"), tr("Start the Warden"), this);
	act->setWhatsThis("warden"); //warden code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Check for Updates
  act = new QAction( QIcon(":/images/view-refresh.png"), tr("Check For Updates"), this);
	act->setWhatsThis("update"); //update check code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Run At Startup Checkbox
  runAtStartup = new QCheckBox(tr("Run At Startup"), 0);
    runAtStartup->setChecked( settings->value("/PC-BSD/SystemUpdater/runAtStartup",true).toBool() );
    connect(runAtStartup, SIGNAL(clicked()), this, SLOT(slotRunAtStartupClicked()) );
  rasAct = new QWidgetAction(this);
    rasAct->setDefaultWidget(runAtStartup);
    menu->addAction(rasAct);
    // - Display Notifications Checkbox
  showNotifications = new QCheckBox(tr("Display Notifications"), 0);
    showNotifications->setChecked( settings->value("/PC-BSD/SystemUpdater/displayPopup",true).toBool() );
    connect(showNotifications, SIGNAL(clicked()), this, SLOT(slotShowMessagesClicked()) );
  snAct = new QWidgetAction(this);
    snAct->setDefaultWidget(showNotifications);
    menu->addAction(snAct);   

  makeScheduleMenu();
  menu->addAction(tr("Automatic updates check"))->setMenu(schedule_menu);

    // - Separator
  menu->addSeparator();
    // - Warden
  act = new QAction( tr("Quit"), this);
	act->setWhatsThis("quit"); //system updater code
	menu->addAction(act);

  //Now Update the tray visuals
  updateTrayIcon();
  updateToolTip();
  //Start up the system flag watcher and connect the signals/slots
  watcher = new SystemFlagWatcher(this);
	connect(watcher,SIGNAL(FlagChanged(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)),this,SLOT(watcherMessage(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)) );
  //watcher->checkForRecent(10); //Check for flags in the last 10 minutes
  
  //Now connect the tray clicked signal
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)) );
  connect(this, SIGNAL(messageClicked()), this, SLOT(launchApp()) );
  
  //Startup the initial checks in 1 minute
  QTimer::singleShot(60000, this, SLOT(startupChecks()));

  //Periodically check timer start
  checkTimer=new QTimer(this);
  checkTimer->setInterval(60000); // 1min
  connect(checkTimer, SIGNAL(timeout()), this, SLOT(slotCheckTimer()));
  checkTimer->start();

}
Пример #28
0
//PUBLIC
LPTray::LPTray() : QSystemTrayIcon() {
    qDebug() << "Starting up Life-preserver Tray...";
    //Start up the log file watcher and connect the signals/slots
    watcher = new LPWatcher();
    connect(watcher,SIGNAL(MessageAvailable(QString)),this,SLOT(watcherMessage(QString)) );
    connect(watcher,SIGNAL(StatusUpdated()),this,SLOT(watcherMessage()) );
    //Load the tray settings file
    settings = new QSettings(QSettings::UserScope,"PCBSD", "life-preserver-tray");
    //Create the notification option widgets
    nShowAll = new QRadioButton(tr("Show all"));
    naAll = new QWidgetAction(this);
    naAll->setDefaultWidget(nShowAll);
    nShowError = new QRadioButton(tr("Warnings Only"));
    naErr = new QWidgetAction(this);
    naErr->setDefaultWidget(nShowError);
    nShowNone = new QRadioButton(tr("None"));
    naNone = new QWidgetAction(this);
    naNone->setDefaultWidget(nShowNone);
    //Create notification menu
    notificationMenu = new QMenu(tr("Popup Settings"));
    notificationMenu->setIcon( QIcon(":/images/configure.png") );
    notificationMenu->addAction(naAll);
    notificationMenu->addAction(naErr);
    notificationMenu->addAction(naNone);
    //Activate the proper notification setting widget
    QString popset = settings->value("popup-policy", "").toString();
    qDebug() << "Current Popup Policy:" << popset;
    if(popset=="all") {
        nShowAll->setChecked(true);
        popupPolicy = 2;
    }
    else if(popset=="errors") {
        nShowError->setChecked(true);
        popupPolicy = 1;
    }
    else if(popset=="none") {
        nShowNone->setChecked(true);
        popupPolicy = 0;
    }
    else {
        nShowError->setChecked(true);
        settings->setValue("popup-policy","errors"); //save the proper setting
        popupPolicy = 1;
    }
    //Now connect the popup settings signals/slots
    connect(nShowAll, SIGNAL(clicked()), this, SLOT(changePopupPolicy()) );
    connect(nShowError, SIGNAL(clicked()), this, SLOT(changePopupPolicy()) );
    connect(nShowNone, SIGNAL(clicked()), this, SLOT(changePopupPolicy()) );
    //Setup the context menu
    menu = new QMenu;
    menu->addAction(QIcon(":/images/tray-icon-idle.png"),tr("Open Life Preserver"),this,SLOT(startGUI()) );
    menu->addSeparator();
    menu->addAction(QIcon(":/images/backup-failed.png"),tr("View Messages"),this,SLOT(startMessageDialog()) );
    menu->addMenu(notificationMenu);
    menu->addAction(QIcon(":/images/refresh.png"),tr("Refresh Tray"),this,SLOT(refreshStatus()) );
    menu->addSeparator();
    menu->addAction(QIcon(":/images/application-exit.png"),tr("Close Tray"),this,SLOT(slotClose()) );
    this->setContextMenu(menu);
    //Setup initial icon for the tray
    this->setIcon( QIcon(":/images/tray-icon-idle.png") );
    //Create the messages GUI
    msgdlg = new LPMessages();
    //connect other signals/slots
    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)) );
    //Start up the watcher
    watcher->start();
    updateTrayIcon();
    updateToolTip();
}