Exemplo n.º 1
0
void GamesViewItem::setToolTips()
{
    Plasma::ToolTipContent data;
    data.setImage( m_preview->icon() );
    data.setMainText( m_gameName->text() );
    data.setSubText( i18n( "Click here to Start the game" ) );
    Plasma::ToolTipManager::self()->setContent( m_playButton, data );
}
Exemplo n.º 2
0
void ActivityManager::toolTipAboutToShow() {
  Plasma::ToolTipContent toolTip;

  toolTip.setMainText(i18n("Current Activity: %1").arg(m_currentName));
  if (!m_currentIcon.isEmpty())
    toolTip.setImage(KIcon(m_currentIcon));

  Plasma::ToolTipManager::self()->setContent(this, toolTip);
}
Exemplo n.º 3
0
void NowPlaying::toolTipAboutToShow()
{
    Plasma::ToolTipContent toolTip;
    if (m_state == Playing || m_state == Paused) {
        toolTip.setMainText(m_title);
        toolTip.setSubText(i18nc("song performer, displayed below the song title", "by %1", m_artist));
        toolTip.setImage(m_artwork.scaled(QSize(50,50),Qt::KeepAspectRatio));
    } else {
        toolTip.setMainText(i18n("No current track."));
    }

    Plasma::ToolTipManager::self()->setContent(this, toolTip);
}
Exemplo n.º 4
0
Arquivo: options.cpp Projeto: f0x/kcd
void Options::randomTrack()
{
   Plasma::ToolTipContent data;
   data.setSubText(i18n("Play random track"));
   data.setImage(KIcon("roll").pixmap(IconSize(KIconLoader::Desktop)));
   if (randomFlag) {
       data.setMainText(i18n("Random - off"));
       randomFlag = false;
       emit activeRandom(false);
   }
   else {
       data.setMainText(i18n("Random - on"));
       randomFlag = true;
       emit activeRandom(true);
   }

   Plasma::ToolTipManager::self()->setContent(m_random, data);
}
void FastUserSwitch::setupTooltip()
{
  QString username = getUsername(!m_useCompleteName);
  QPixmap pixmap;

  if (m_useUserImage) {
    pixmap = m_userpixmap.scaledToHeight(qMin(IconSize(KIconLoader::Desktop),
                                              m_userpixmap.height()));
  } else
    pixmap = KIcon(DEFAULT_ICON_NAME).pixmap(IconSize(KIconLoader::Desktop));

  Plasma::ToolTipContent data;
  data.setMainText(i18n("Fast user switch"));
  data.setSubText(i18n("You are currently logged in as <em>%1</em>.",
                       username));
  data.setImage(pixmap);
  Plasma::ToolTipManager::self()->setContent(this, data);
}
Exemplo n.º 6
0
void StackFolder::updateIconWidget()
{
    if (!m_placesModel) {
        m_placesModel = new KFilePlacesModel(this);

        const QModelIndex index = m_placesModel->closestItem(m_topUrl);
        const KUrl url = m_placesModel->url(index);

        KFileItem item = m_dirModel->itemForIndex(QModelIndex());

        if (!item.isNull() && item.iconName() != "inode-directory") {
            m_icon = KIcon(item.iconName(), 0, item.overlays());
        } 
        else if (m_topUrl.protocol() == "desktop") {
            m_icon = KIcon("user-desktop");
        } 
        else if (m_topUrl.protocol() == "trash") {
            m_icon = m_model->rowCount() > 0 ? KIcon("user-trash-full") : KIcon("user-trash");
        } 
        else if (index.isValid() && url.equals(m_topUrl, KUrl::CompareWithoutTrailingSlash)) {
            m_icon = m_placesModel->icon(index);
        }

        m_iconAnimation1 = new QPropertyAnimation(this, "popupIconSize");
        m_iconAnimation1->setDuration(600);
        m_iconAnimation2 = new QPropertyAnimation(this, "popupIconSize");
        m_iconAnimation1->setDuration(600);
        m_iconAnimationGroup = new QSequentialAnimationGroup;
        m_iconAnimationGroup->addAnimation(m_iconAnimation1);
        m_iconAnimationGroup->addAnimation(m_iconAnimation2);
        m_iconAnimationGroup->setLoopCount(4);
        connect(m_iconAnimationGroup, SIGNAL(finished()), this, SLOT(iconAnimationFinished()));

        setPopupIcon(m_icon);

        // Update the tooltip
        Plasma::ToolTipContent data;
        data.setMainText(i18n("Stack Folder"));
        data.setSubText(m_topUrl.fileName(KUrl::IgnoreTrailingSlash));
        data.setImage(m_icon);
        Plasma::ToolTipManager::self()->setContent(this, data);

    }
}
Exemplo n.º 7
0
Arquivo: options.cpp Projeto: f0x/kcd
void Options::loopList()
{
   Plasma::ToolTipContent data;
   data.setSubText(i18n("Play again the tracklist"));
   data.setImage(KIcon("object-rotate-right").pixmap(IconSize(KIconLoader::Desktop)));
   
   if (loopFlag) {
       data.setMainText(i18n("Repeat - off"));
       loopFlag = false;
       emit activeRepeat(false);
   }
   else {
       data.setMainText(i18n("Repeat - on"));
       loopFlag = true;
       emit activeRepeat(true);
   }

   Plasma::ToolTipManager::self()->setContent(m_loop, data);
}
Exemplo n.º 8
0
//-----------------------------------------------------------------------------
// Create task thumbnail
//FIXME
void daisy::createTaskThumbnail( TaskPtr task_tmp, int j )
{
  QIcon thumbnail;
  //thumbnail = QIcon( QPixmap::grabWindow ( task_tmp->win(), 0, 0, -1, -1 ) );//This would suck
  thumbnail = KIcon( task_tmp->icon( m_icodimension, m_icodimension, true ) );
  
  m_taskicons[j]->setIcon(thumbnail);
  
  if ( m_orientation== QString("horizontal") )
  {
    m_taskicons[j]->setGeometry( QRect( last_icopos[0]+( ( j* (m_icodimension+(m_icodimension*m_icospacing)) ) ), last_icopos[1], m_icodimension, m_icodimension) );
  }
  else
  {
    m_taskicons[j]->setGeometry( QRect( last_icopos[0], last_icopos[1]+( ( j* (m_icodimension+(m_icodimension*m_icospacing)) ) ), m_icodimension, m_icodimension) );
  }
  
  
  
  
  
  if (m_showtooltips_l)
  {
    Plasma::ToolTipContent toolTipData;toolTipData.setAutohide(false);
    QString str;QString desk_name = KWindowSystem::desktopName( task_tmp->desktop() );
    
    if (task_tmp->desktop() != -1)
    {str.append( desk_name );str.insert( 0, i18n("On ") );}
    else str.insert( 0, i18n("On all desktops") );
    toolTipData.setMainText( task_tmp->visibleNameWithState() );
    toolTipData.setSubText( str );
    
    if ( m_tiptype == "thumbnail" )
      toolTipData.setWindowToPreview( task_tmp->window() );
    
    if ( m_tiptype == "thumbnail" || m_tiptype == "icon" )
      toolTipData.setImage( task_tmp->icon(32, 32, true) );
    
    Plasma::ToolTipManager::self()->setContent(m_taskicons[j], toolTipData);
  }

  
}
Exemplo n.º 9
0
MainWindow::MainWindow(QObject *parent, const QVariantList &args)
        : Plasma::PopupApplet(parent, args),
          takeoff(new TakeoffWidget(this))
{
    // Plasmoid aspect
    this->setBackgroundHints(DefaultBackground);
    this->setAspectRatioMode(Plasma::IgnoreAspectRatio);

    // Hide the popup when an application is launched
    connect(this->takeoff, SIGNAL(clicked()), this, SLOT(hidePopup()));

    // Load the configuration
    this->loadConfig();

    // Tooltip
    Plasma::ToolTipContent data;
    data.setMainText(i18n("Takeoff Launcher"));
    data.setSubText(i18n("Launch your applications with elegance"));
    data.setImage(this->popupIcon().pixmap(IconSize(KIconLoader::Desktop)));
    Plasma::ToolTipManager::self()->setContent(this, data);

    connect(this->takeoff, SIGNAL(hideWindow()),
            this, SLOT(slotHide()));
}
Exemplo n.º 10
0
Arquivo: options.cpp Projeto: f0x/kcd
Options::Options(QGraphicsWidget *parent)
    : QGraphicsWidget(parent),
     // m_volume(new Plasma::IconWidget(this)),
      //m_meter(new KcdMeter(this)),
      //m_tracklist(new Plasma::IconWidget(this)),
      m_albumText(new Plasma::Label(this)),
      m_random(new Plasma::IconWidget(this)),
      m_loop(new Plasma::IconWidget(this))
{
 
   //m_volume->setIcon("audio-volume-high");
   //connect (m_volume, SIGNAL(clicked()), this, SLOT(handleVolume()));
   //m_volume->setMinimumSize(m_random->sizeFromIconSize(10));

   //m_meter->setMinimum(0);
   //m_meter->setMaximum(10);
   //m_meter->setMeterType(Plasma::Meter::BarMeterHorizontal);
   //connect (m_meter, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int)));

   //m_tracklist->setIcon("format-list-unordered");
   //m_tracklist->setMinimumSize(m_random->sizeFromIconSize(10));
   //connect(m_tracklist, SIGNAL(clicked()), this, SIGNAL(showTrackList()));

   Plasma::ToolTipContent data;
   //data.setMainText(i18n("Tracklist"));
   //data.setSubText(i18n("View the tracklist"));
   //data.setImage(KIcon("format-list-unordered").pixmap(IconSize(KIconLoader::Desktop)));
   //Plasma::ToolTipManager::self()->setContent(m_tracklist, data);

   m_random->setIcon("roll");
   connect(m_random, SIGNAL(clicked()), this, SLOT(randomTrack()));
   
   data.setMainText(i18n("Random - off"));
   data.setSubText(i18n("Play random track"));
   data.setImage(KIcon("roll").pixmap(IconSize(KIconLoader::Desktop)));
   Plasma::ToolTipManager::self()->setContent(m_random, data);

   m_loop->setIcon("object-rotate-right");
   connect(m_loop, SIGNAL(clicked()), this, SLOT(loopList()));

   data.setMainText(i18n("Repeat - off"));
   data.setSubText(i18n("Play again the tracklist"));
   data.setImage(KIcon("object-rotate-right").pixmap(IconSize(KIconLoader::Desktop)));
   Plasma::ToolTipManager::self()->setContent(m_loop, data);

   QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
   layout->setOrientation(Qt::Horizontal);
   //layout->addItem(m_volume);
   //layout->addItem(m_meter);
   layout->addItem(m_albumText);
   layout->addItem(m_random);
   layout->addItem(m_loop);
   layout->setAlignment(m_albumText, Qt::AlignLeft);
   layout->setAlignment(m_random, Qt::AlignRight);
   layout->setAlignment(m_loop, Qt::AlignRight);
   layout->setStretchFactor(m_random, 0);
   layout->setStretchFactor(m_loop, 0);
   setPreferredHeight(35);
   
   //layout->setItemSpacing(0, 50);
  
  
   //layout->addItem(m_tracklist);
   //layout->setStretchFactor(m_meter, 20);
   //layout->setSpacing(0);
   //layout->setAlignment(m_random, Qt::AlignRight);
   //layout->setAlignment(m_loop, Qt::AlignRight);
   //layout->setAlignment(m_tracklist, Qt::AlignRight);
   //layout->setItemSpacing(1, 10);
   setLayout(layout);

   randomFlag = false;
   loopFlag = false;
   //volumeFlag = true;

   
}
Exemplo n.º 11
0
//-----------------------------------------------------------------------------
// Get all the tasks
//FIXME
QList<WId> daisy::getAllTasks()
{
  m_activetasks.clear();m_attentionwindow.clear();showedTasks.clear();
  QList<WId> taskDict = KWindowSystem::windows();
  m_activewindow = -1;m_startingwindow = -1;m_closingwindow = -1;
  Plasma::ToolTipContent toolTipData;toolTipData.setAutohide(false);
  QString str;QString widclass_tmp;total_taskpreviews=0;
  
  
  //THUMBNAILS
  if ( m_taskpreviews && m_type == QString("standard_dock") )
  {
    for (int i = 0; i < m_max_taskpreviews; ++i)
    {m_taskicons[i]->setGeometry( QRect(-10000, -10000, 0, 0)  );}
  }
  
  
  if (m_showtooltips_l)clearToolTipContent();
  
  
  QList<WId>::ConstIterator it;
  for (it = taskDict.begin(); it != taskDict.end(); ++it )
  {
    KWindowInfo taskInfo = KWindowSystem::windowInfo( *it, NET::WMName | NET::WMVisibleName | NET::WMVisibleIconName | NET::WMState | NET::XAWMState | NET::WMDesktop | NET::WMWindowType, NET::WM2WindowClass );
    
    
    TaskPtr task_tmp = TaskManager::TaskManager::self()->findTask( *it );
    if ( task_tmp && *it == KWindowSystem::activeWindow() )
    {m_focusedWindow = *it;}
    
    
    //THUMBNAILS
    if ( m_taskpreviews && m_type == QString("standard_dock") && task_tmp )
    {
      if ( !m_showtaskoflauncher && ( m_alias.indexOf( taskInfo.windowClassName() ) != -1 || m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) ) != -1 ) )
      {}
      
      else if ( total_taskpreviews<m_max_taskpreviews )
      {
	createTaskThumbnail(task_tmp, total_taskpreviews);
	total_taskpreviews++;
	showedTasks << *it;
      }
    }
    
    
    
    if ( m_alias.indexOf( taskInfo.windowClassName() ) != -1 || m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) ) != -1 )
    {
      
      if ( m_alias.indexOf( taskInfo.windowClassName() ) != -1  )
	widclass_tmp = QString( taskInfo.windowClassName() );
      else
	widclass_tmp = QString(taskInfo.windowClassClass().toLower());
      
      
      //ATTENTION
      checkAttention( taskInfo, widclass_tmp );
      
      
      
      m_activetasks << m_alias.indexOf( widclass_tmp );
      if ( *it ==  KWindowSystem::activeWindow() )
	m_activewindow = m_alias.indexOf( widclass_tmp );
      
      
      //TOLLTIPS
      if (m_showtooltips_l)
      {
	str.clear();QString desk_name = KWindowSystem::desktopName( taskInfo.desktop() );
	int win_count = m_activetasks.count( m_alias.indexOf( widclass_tmp ) );
	
	if ( win_count == 1 )
	{
	  if (taskInfo.desktop() != -1)
	  {str.append( desk_name );str.insert( 0, i18n("On ") );}
	  else str.insert( 0, i18n("On all desktops") );
	  toolTipData.setMainText( taskInfo.visibleIconNameWithState()   );
	  toolTipData.setSubText( str );
	}
	else
	{
	  str.setNum( win_count );str.append( i18n(" instances") );
	  toolTipData.setMainText( widclass_tmp );
	  toolTipData.setSubText( str );
	}
	
	if ( m_tiptype == "thumbnail" )
	{
	  #if (KDE_VERSION_MINOR < 3)
	  toolTipData.setWindowToPreview(*it);
	  #else
	  toolTipData.setWindowsToPreview( matchAllTasks( widclass_tmp, 4 ) );
	  #endif
	}
	
	if ( m_tiptype == "thumbnail" || m_tiptype == "icon" )
	  toolTipData.setImage( KIcon( m_values[m_alias.indexOf( widclass_tmp )][2]).pixmap(IconSize(KIconLoader::Panel)) );
	Plasma::ToolTipManager::self()->setContent(m_widgets[m_alias.indexOf( widclass_tmp )], toolTipData);
	
      }
      
      
    }
    
  }
  
  
  //THUMBNAILS
  if ( m_taskpreviews && m_type == QString("standard_dock") )
  {
    resizeRepos( true );
  }
  
  
  return taskDict;
}
Exemplo n.º 12
0
//-----------------------------------------------------------------------------
// Window changed
//FIXME Signal is emited 4 times?
void daisy::windowChanged(WId id, const unsigned long* properties )
{
  QString widclass_tmp;
  Plasma::ToolTipContent toolTipData;toolTipData.setAutohide(false);
  
  KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMName | NET::WMVisibleName | NET::WMVisibleIconName | NET::WMState | NET::XAWMState | NET::WMDesktop, NET::WM2WindowClass );
  
  TaskPtr task_tmp = TaskManager::TaskManager::self()->findTask( id );
  
  
  if (  m_alias.indexOf( taskInfo.windowClassName() ) != -1 || m_alias.indexOf( QString(taskInfo.windowClassClass().toLower()) ) != -1 )
  {
    
    if ( m_alias.indexOf( taskInfo.windowClassName() ) != -1  )
    {widclass_tmp = QString( taskInfo.windowClassName() );}
    else
    {widclass_tmp = QString(taskInfo.windowClassClass().toLower());}
    
    
    //ATTENTION
    checkAttention( taskInfo, widclass_tmp );
    
    if (m_showtooltips_l)
    {
      
      int win_count = m_activetasks.count( m_alias.indexOf( widclass_tmp ) );
      QString str;QString desk_name = KWindowSystem::desktopName( taskInfo.desktop() );
      
      if ( win_count == 1 )
      {
	if (taskInfo.desktop() != -1)
	{str.append( desk_name );str.insert( 0, i18n("On ") );}
	else str.insert( 0, i18n("On all desktops") );
	toolTipData.setMainText( taskInfo.visibleIconNameWithState()   );
	toolTipData.setSubText( str ); 
      }
      else
      {
	str.setNum( win_count );str.append( i18n(" instances") );
	toolTipData.setMainText( widclass_tmp );
	toolTipData.setSubText( str );
      }
      
      if ( m_tiptype == "thumbnail" )
      {
	#if (KDE_VERSION_MINOR < 3)
	toolTipData.setWindowToPreview(id);
	#else
	toolTipData.setWindowsToPreview( matchAllTasks( widclass_tmp, 4 ) );
	#endif
      }
      
      if ( m_tiptype == "thumbnail" || m_tiptype == "icon" )
	toolTipData.setImage( task_tmp->icon(32, 32, true) );
      Plasma::ToolTipManager::self()->setContent(m_widgets[m_alias.indexOf( widclass_tmp )], toolTipData);
    }
    
    
    if ( m_taskpreviews && m_type == QString("standard_dock") && showedTasks.indexOf( id )!=-1 )
    {
      if (m_showtooltips_l && task_tmp)
      {Plasma::ToolTipManager::self()->setContent(m_taskicons[showedTasks.indexOf( id )], toolTipData);}
      
      if(properties[ NETWinInfo::PROTOCOLS ] & NET::WMIcon)
      {
	m_uti_tmr->stop();
	m_toupwid = id;
	m_uti_tmr->start();
      }
    }
  
    
    
  }

  
}