Esempio n. 1
0
void TrayIcon::setCurrentProject(Project* new_, bool delete_)
{
  if (currentProject)
  {
    currentProject->toggleCounterAction->setChecked(false);
    if (! delete_)
      currentProject->saveToFile();
    currentProject->disconnect();
    currentProject->toggleCounterAction->disconnect();

    if (details)
      details->toggler->setEnabled(false);
  }

  if (delete_)
    delete currentProject;
  currentProject = new_;
  if (currentProject)
  {
    // enable menu actions
    deleteCurrentProjectAction->setEnabled(true);
    currentProjectDetailsAction->setEnabled(true);

    // setup connection(s)
    connect(currentProject, SIGNAL(counterTicked()),
            this, SLOT(updateToolTip()));
    connect(currentProject->toggleCounterAction, SIGNAL(toggled(bool)),
            this, SLOT(updateCounterView(bool)));

    updateToolTip();
  }
  else
  {
void ExpressionLineEdit::setClock(Clock *clock)
{
    m_clock = clock;

    updateToolTip(text());

    connect(this, SIGNAL(textChanged(QString)), this, SLOT(updateToolTip(QString)));
}
Esempio n. 3
0
void FreeSpaceWidget::setEstimatedDSizeKb(unsigned long dSize)
{
    d->dSizeKb = dSize;

    updateToolTip();
    update();
}
Esempio n. 4
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();
}
Esempio n. 5
0
void NewGameTab::editImageProperties()
{
	QListWidgetItem* item = m_images->currentItem();
	if (!item || item->isHidden()) {
		return;
	}

	QString filename = item->data(ImageRole).toString();
	ImagePropertiesDialog dialog(item->icon(), item->text(), m_image_tags, filename, window());
	if (dialog.exec() == QDialog::Accepted) {
		// Update name
		item->setText(dialog.name());
		if (item->text() != item->data(NameRole).toString()) {
			item->setData(NameRole, item->text());

			QSettings details(Path::image("details"), QSettings::IniFormat);
			details.setValue(filename + "/Name", item->text());
			emit imageRenamed(filename, item->text());

			m_images->sortItems();
			m_images->scrollToItem(item);
		}

		// Update tags
		item->setData(TagsRole, m_image_tags->tags(item->data(ImageRole).toString()));
		updateToolTip(item);

	}
}
Esempio n. 6
0
void QgsLayoutItem3DMap::assignFreeId()
{
  if ( !mLayout )
    return;

  QList<QgsLayoutItem3DMap *> mapsList;
  mLayout->layoutItems( mapsList );

  int maxId = -1;
  bool used = false;
  for ( QgsLayoutItem3DMap *map : qgis::as_const( mapsList ) )
  {
    if ( map == this )
      continue;

    if ( map->mMapId == mMapId )
      used = true;

    maxId = std::max( maxId, map->mMapId );
  }
  if ( used )
  {
    mMapId = maxId + 1;
    mLayout->itemsModel()->updateItemDisplayName( this );
  }
  updateToolTip();
}
// private
void kpColorSimilarityToolBarItem::setColorSimilarityInternal (double similarity,
        bool writeConfig)
{
#if DEBUG_KP_COLOR_SIMILARITY_TOOL_BAR_ITEM
    qCDebug(kpLogWidgets) << "kpColorSimilarityToolBarItem::setColorSimilarityInternal("
              << "similarity=" << similarity << ",writeConfig=" << writeConfig
              << ")" << endl;
#endif

    m_oldColorSimilarity = colorSimilarity ();

    kpColorSimilarityHolder::setColorSimilarity (similarity);
    m_processedColorSimilarity = kpColor::processSimilarity (colorSimilarity ());

    updateIcon ();
    updateToolTip ();

    if (writeConfig)
    {
        KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupGeneral);
        cfg.writeEntry (kpSettingColorSimilarity, colorSimilarity ());
        cfg.sync ();
    }

    emit colorSimilarityChanged (colorSimilarity (), m_processedColorSimilarity);
}
Esempio n. 8
0
void AMDeadTimeButton::setDeadTimeSources(AMDataSource *inputCountSource, AMDataSource *outputCountSource)
{
    if (inputCountSource_) {
        disconnect(inputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateColorState()));
        disconnect(inputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateToolTip()));
    }

    if (outputCountSource_) {
        disconnect(outputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateColorState()));
        disconnect(outputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateToolTip()));
    }

    inputCountSource_ = inputCountSource;
    outputCountSource_ = outputCountSource;

    if (inputCountSource_) {
        connect(inputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateColorState()));
        connect(inputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateToolTip()));
    }

    if (outputCountSource_) {
        connect(outputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateColorState()));
        connect(outputCountSource_->signalSource(), SIGNAL(valuesChanged(AMnDIndex,AMnDIndex)), this, SLOT(updateToolTip()));
    }

    updateColorState();
    updateToolTip();
}
void KNotificationBackend::notify(const Notification &n)
{
    QString type;
    switch (n.type) {
    case Highlight:
        type = "Highlight"; break;
    case HighlightFocused:
        type = "HighlightFocused"; break;
    case PrivMsg:
        type = "PrivMsg"; break;
    case PrivMsgFocused:
        type = "PrivMsgFocused"; break;
    }

#if QT_VERSION < 0x050000
    QString message = QString("<b>&lt;%1&gt;</b> %2").arg(n.sender, Qt::escape(n.message));
#else
    QString message = QString("<b>&lt;%1&gt;</b> %2").arg(n.sender, n.message.toHtmlEscaped());
#endif
    KNotification *notification = KNotification::event(type, message, QIcon::fromTheme("dialog-information").pixmap(48), QtUi::mainWindow(),
        KNotification::RaiseWidgetOnActivation
        |KNotification::CloseWhenWidgetActivated
        |KNotification::CloseOnTimeout);
    connect(notification, SIGNAL(activated(uint)), SLOT(notificationActivated()));
    notification->setActions(QStringList("View"));
    notification->setProperty("notificationId", n.notificationId);

    _notifications.append(qMakePair(n.notificationId, QPointer<KNotification>(notification)));

    updateToolTip();
    QtUi::mainWindow()->systemTray()->setAlert(true);
}
Esempio n. 10
0
void TrayIcon::pauseOrResume()
{
    _isPaused = !_isPaused;

    updateMenu();
    updateToolTip();
    updateTrayIcon();
}
Esempio n. 11
0
void
KnobGui::onHelpChanged()
{
    if (_imp->descriptionLabel) {
        _imp->descriptionLabel->setToolTip( toolTip() );
    }
    updateToolTip();
}
Esempio n. 12
0
void KAction::setToolTip( const QString& tt )
{
  d->setToolTip( tt );

  int len = containerCount();
  for( int i = 0; i < len; ++i )
    updateToolTip( i );
}
Esempio n. 13
0
KNotificationBackend::KNotificationBackend(QObject *parent)
    : AbstractNotificationBackend(parent)
{
    connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(SystemTray::ActivationReason)),
        SLOT(notificationActivated(SystemTray::ActivationReason)));

    updateToolTip();
}
Esempio n. 14
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();
}
Esempio n. 15
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
}
Esempio n. 16
0
QListWidgetItem* NewGameTab::createItem(const QString& image, const QSettings& details)
{
	const qreal pixelratio = devicePixelRatioF();
	QListWidgetItem* item = ThumbnailLoader::createItem(Path::image(image), details.value(image + "/Name", tr("Untitled")).toString(), m_images, pixelratio);
	item->setData(ImageRole, image);
	item->setData(NameRole, item->text());
	item->setData(TagsRole, m_image_tags->tags(image));
	updateToolTip(item);
	return item;
}
Esempio n. 17
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
}
Esempio n. 18
0
void FreeSpaceToolTip::show()
{
    updateToolTip();
    reposition();

    if (isHidden() && !toolTipIsEmpty())
    {
        DItemToolTip::show();
    }
}
Esempio n. 19
0
KNotificationBackend::KNotificationBackend(QObject* parent)
    : AbstractNotificationBackend(parent)
{
    connect(QtUi::mainWindow()->systemTray(),
            &SystemTray::activated,
            this,
            selectOverload<SystemTray::ActivationReason>(&KNotificationBackend::notificationActivated));

    updateToolTip();
}
Esempio n. 20
0
void AMDeadTimeButton::setIndex(int newIndex)
{
    if (index_ != newIndex || !indexSet_) {
        index_ = newIndex;
        indexSet_ = true;

        updateToolTip();
    }

}
Esempio n. 21
0
void NewGameTab::updateTagsStrings()
{
	QListWidgetItem* item;
	int count = m_images->count();
	for (int i = 0; i < count; ++i) {
		item = m_images->item(i);
		item->setData(TagsRole, m_image_tags->tags(item->data(ImageRole).toString()));
		updateToolTip(item);
	}
}
Esempio n. 22
0
void ThumbnailSlider::slotActionTriggered(int actionTriggered)
{
    updateToolTip();

    if (actionTriggered != QAbstractSlider::SliderNoAction) {
        // If we are updating because of a direct action on the slider, show
        // the tooltip immediately.
        const QPoint pos = slider()->mapToGlobal(QPoint(0, slider()->height() / 2));
        QToolTip::showText(pos, slider()->toolTip(), slider());
    }
}
Esempio n. 23
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
}
Esempio n. 24
0
KUrlNavigatorToggleButton::KUrlNavigatorToggleButton(QWidget* parent) :
    KUrlNavigatorButtonBase(parent)
{
    setCheckable(true);
    connect(this, SIGNAL(toggled(bool)),
            this, SLOT(updateToolTip()));
    connect(this, SIGNAL(clicked(bool)),
            this, SLOT(updateCursor()));
    m_pixmap = KIcon("dialog-ok").pixmap(QSize(22, 22).expandedTo(iconSize()));
    updateToolTip();
}
Esempio n. 25
0
void SBI_NetworkIcon::onlineStateChanged(bool online)
{
    if (online) {
        setPixmap(QIcon(":sbi/data/network-online.png").pixmap(16));
    }
    else {
        setPixmap(QIcon(":sbi/data/network-offline.png").pixmap(16));
    }

    updateToolTip();
}
Esempio n. 26
0
void ItemViewHoverButton::enterEvent(QEvent* event)
{
    QAbstractButton::enterEvent(event);

    // if the mouse cursor is above the button, display
    // it immediately without fading timer
    m_isHovered   = true;
    m_fadingTimeLine->stop();
    m_fadingValue = 255;
    updateToolTip();
    update();
}
Esempio n. 27
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 (...)
    {
    }
}
Esempio n. 28
0
bool Spacer::event(QEvent *e)
{
    switch (e->type()) {
    case QEvent::ToolTip:
        updateToolTip(); // Tooltip includes size, so, refresh on demand
        break;
    case QEvent::ParentChange: // Cache information about 'being in layout' which is expensive to calculate.
        m_layoutState = UnknownLayoutState;
        break;
    default:
        break;
    }
    return QWidget::event(e);
}
Esempio n. 29
0
void KNotificationBackend::removeNotificationById(uint notificationId)
{
    QList<QPair<uint, QPointer<KNotification> > >::iterator i = _notifications.begin();
    while (i != _notifications.end()) {
        if (i->first == notificationId) {
            if (i->second)
                i->second->close();
            i = _notifications.erase(i);
        }
        else
            ++i;
    }
    updateToolTip();
}
Esempio n. 30
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
}