Ejemplo n.º 1
0
ActionLabel::ActionLabel(QWidget *parent)
    : QLabel(parent)
{
    int iconSize=Icon::dlgIconSize();
    int labelSize=Icon::stdSize((int)((iconSize*1.333333333)+0.5));

    setMinimumSize(labelSize, labelSize);
    setMaximumSize(labelSize, labelSize);
    setAlignment(Qt::AlignCenter);

    if(0==theUsageCount++) {
        QImage img(Icons::self()->audioFileIcon.pixmap(iconSize, iconSize).toImage());
        double increment=360.0/constNumIcons;

        for(int i=0; i<constNumIcons; ++i) {
            theIcons[i]=new QPixmap(QPixmap::fromImage(0==i ? img
                                                            : img.transformed(rotateMatrix(img.width(), img.height(), increment*i),
                                                                              Qt::SmoothTransformation)));
        }
    }

    setPixmap(*theIcons[0]);
    timer=new QTimer(this);
    connect(timer, SIGNAL(timeout()), SLOT(rotateIcon()));
}
Ejemplo n.º 2
0
void IndigoTabbar::addTab ( QWidget * child, const QIcon & icon, const QString & label ){

    // rotate icon if needed
    QIcon ricon = rotateIcon(icon);

    // use normal addTab function
    QTabWidget::addTab(child, ricon, label);


    m_activeWidget = this->widget(currentIndex());

}
Ejemplo n.º 3
0
void IndigoTabbar::setTabPosition(TabPosition tabPos){


    // Rotate icons in right direction
    for(int i=0;i<count();i++)
    {
        QIcon icon = this->tabBar()->tabIcon(i);

        icon = rotateIcon(icon, tabPos);

        this->tabBar()->setTabIcon(i, icon);

    }

    // set new tab position
    QTabWidget::setTabPosition(tabPos);

}
Ejemplo n.º 4
0
CActionLabel::CActionLabel(QWidget *parent)
            : QLabel(parent)
{
    static const int constIconSize(48);

    setMinimumSize(constIconSize, constIconSize);
    setMaximumSize(constIconSize, constIconSize);
    setAlignment(Qt::AlignCenter);

    if(0==theUsageCount++)
    {
        QImage img(KIconLoader::global()->loadIcon("application-x-font-ttf", KIconLoader::NoGroup, 32).toImage());
        double increment=360.0/constNumIcons;

        for(int i=0; i<constNumIcons; ++i)
            theIcons[i]=new QPixmap(QPixmap::fromImage(0==i ? img : img.transformed(rotateMatrix(img.width(), img.height(), increment*i))));
    }

    setPixmap(*theIcons[0]);
    itsTimer=new QTimer(this);
    connect(itsTimer, SIGNAL(timeout()), SLOT(rotateIcon()));
}
Ejemplo n.º 5
0
UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWidget){
  ui->setupUi(this);
  if(parent!=0){ parent->setMouseTracking(true); }
  this->setMouseTracking(true);
  sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info
  //Setup the Icons
    // - favorites tab
    this->setTabIcon(0, rotateIcon(LXDG::findIcon("favorites","")) );
    this->setTabText(0,"");
    // - apps tab
    this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) );
    this->setTabText(1,"");
    // - home tab
    this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) );
    this->setTabText(2,"");
    // - config tab
    this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) );
    this->setTabText(3,"");
  ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") );
  ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") );
  ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") );
  ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") );
  ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") );	
  ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") );
  ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") );

  //Connect the signals/slots
  connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) );
  connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) );
  connect(ui->tool_fav_apps, SIGNAL(clicked()), this, SLOT(FavChanged()) );
  connect(ui->tool_fav_files, SIGNAL(clicked()), this, SLOT(FavChanged()) );
  connect(ui->tool_fav_dirs, SIGNAL(clicked()), this, SLOT(FavChanged()) );
  connect(ui->combo_app_cats, SIGNAL(currentIndexChanged(int)), this, SLOT(updateApps()) );
  connect(ui->tool_home_gohome, SIGNAL(clicked()), this, SLOT(slotGoHome()) );
  connect(ui->tool_home_browse, SIGNAL(clicked()), this, SLOT(slotOpenDir()) );
  
  //Setup the special buttons
  QString APPSTORE = LOS::AppStoreShortcut();
  if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){
    //Now load the info
    bool ok = false;
    XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok);
    if(ok){
      ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") );
      ui->tool_app_store->setText( store.name );
      connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) );
    }
    ui->tool_app_store->setVisible(ok); //availability
  }else{
    ui->tool_app_store->setVisible(false); //not available
  }
  QString CONTROLPANEL = LOS::ControlPanelShortcut();
  if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){
    //Now load the info
    bool ok = false;
    XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok);
    if(ok){
      ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") );
      connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) );
    }
    ui->tool_controlpanel->setVisible(ok); //availability
  }else{
    ui->tool_controlpanel->setVisible(false); //not available
  }
  QString QTCONFIG = LOS::QtConfigShortcut();
  if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){
    ui->tool_qtconfig->setVisible(true);
    ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") );
    connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) );
  }else{
    ui->tool_qtconfig->setVisible(false);
  }
  lastUpdate = QDateTime(); //make sure it refreshes 
  QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization
}
Ejemplo n.º 6
0
//============
//  PRIVATE SLOTS
//============
void UserWidget::UpdateAll(){
  ui->retranslateUi(this);
  //Setup the Icons
    // - favorites tab
    this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) );
    this->setTabText(0,"");
    // - apps tab
    this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) );
    this->setTabText(1,"");
    // - home tab
    this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) );
    this->setTabText(2,"");
    // - config tab
    this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) );
    this->setTabText(3,"");
  ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") );
  ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") );
  ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") );
  ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") );
  ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") );	
  ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") );
  ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") );
  ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") );
  ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") );
  ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") );
  
  //Setup the special buttons
  QString APPSTORE = LOS::AppStoreShortcut();
  if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){
    //Now load the info
    bool ok = false;
    XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok);
    if(ok){
      ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") );
      ui->tool_app_store->setText( store.name );
    }
    ui->tool_app_store->setVisible(ok); //availability
  }else{
    ui->tool_app_store->setVisible(false); //not available
  }
  QString CONTROLPANEL = LOS::ControlPanelShortcut();
  if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){
    //Now load the info
    bool ok = false;
    XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok);
    if(ok){
      ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") );
    }
    ui->tool_controlpanel->setVisible(ok); //availability
  }else{
    ui->tool_controlpanel->setVisible(false); //not available
  }
  QString QTCONFIG = LOS::QtConfigShortcut();
  if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){
    ui->tool_qtconfig->setVisible(true);
    ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") );
  }else{
    ui->tool_qtconfig->setVisible(false);
  }
  //Now update the menus
  UpdateMenu();	
}