src/hbapps/hbthemechanger/resourceview.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    85     mResourceItem = new HbLabel(this);
    85     mResourceItem = new HbLabel(this);
    86     mResourceItem->setIcon(HbIcon(mThemedIcons.size()?mThemedIcons[0]:""));
    86     mResourceItem->setIcon(HbIcon(mThemedIcons.size()?mThemedIcons[0]:""));
    87     mResourceItem->setAlignment(Qt::AlignCenter);
    87     mResourceItem->setAlignment(Qt::AlignCenter);
    88     mResourceItem->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
    88     mResourceItem->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
    89     mResourcesList = new HbTumbleView(mThemedIcons, this);
    89     mResourcesList = new HbTumbleView(mThemedIcons, this);
       
    90     mResourcesList->setLoopingEnabled(true);
    90 
    91 
    91     layout->addItem(mResourceItem);
    92     layout->addItem(mResourceItem);
    92     layout->addItem(mResourcesList);
    93     layout->addItem(mResourcesList);
    93 
    94 
    94     mSearchPanel = new HbSearchPanel(this);
    95     mSearchPanel = new HbSearchPanel(this);
    97     layout->addItem(mSearchPanel);
    98     layout->addItem(mSearchPanel);
    98     this->setLayout(layout);
    99     this->setLayout(layout);
    99 
   100 
   100     connect(mSearchPanel, SIGNAL(criteriaChanged(const QString &)), this, SLOT(criteriaChanged(const QString &)));
   101     connect(mSearchPanel, SIGNAL(criteriaChanged(const QString &)), this, SLOT(criteriaChanged(const QString &)));
   101     connect(mResourcesList, SIGNAL(itemSelected(int)), this, SLOT(iconItemSelected(int)));
   102     connect(mResourcesList, SIGNAL(itemSelected(int)), this, SLOT(iconItemSelected(int)));
   102     mMode = iconMode;
   103     toggleMode(iconMode);
   103 
   104 
   104     mMainWindow->addView(this);
   105     mMainWindow->addView(this);
   105 }
   106 }
   106 
   107 
   107 /**
   108 /**
   213 void ResourceView::loadThemedColors()
   214 void ResourceView::loadThemedColors()
   214 {
   215 {
   215     mThemedColors.clear();
   216     mThemedColors.clear();
   216     QString basetheme = HbThemeUtils::getThemeSetting(HbThemeUtils::BaseThemeSetting);
   217     QString basetheme = HbThemeUtils::getThemeSetting(HbThemeUtils::BaseThemeSetting);
   217     basetheme = basetheme.replace("/icons/", "/style/");
   218     basetheme = basetheme.replace("/icons/", "/style/");
   218     QFile file(basetheme + "/variables/color/hbcolorgroup.css");
   219     QDir colorsDir(basetheme + "/variables/color");
   219 
   220     QFileInfoList files = colorsDir.entryInfoList(QDir::Files);
   220     if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
   221     for (int i=0;i<files.count();i++) {
   221         QTextStream in(&file);
   222         QFile file(colorsDir.absolutePath() + '/' +files[i].fileName());
   222 
   223         if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
   223         while(!in.atEnd()) {
   224             QTextStream in(&file);
   224             QString line = in.readLine().trimmed();
   225 
   225             if (line.startsWith("qtc_")) {
   226             while(!in.atEnd()) {
   226                 // Extract logical name
   227                 QString line = in.readLine().trimmed();
   227                 mThemedColors += line.mid(0, line.indexOf(':')).trimmed();
   228                 if (line.startsWith("qtc_")) {
       
   229                     // Extract logical name
       
   230                     mThemedColors += line.mid(0, line.indexOf(':')).trimmed();
       
   231                 }
   228             }
   232             }
       
   233             file.close();
   229         }
   234         }
   230         file.close();
       
   231     }
   235     }
   232 }
   236 }
   233 
   237 
   234 void ResourceView::iconModeSelected()
   238 void ResourceView::iconModeSelected()
   235 {
   239 {