void TTSStyleActions::generateActions(QVector<int> & styles, const int current) { category()->setText(QCoreApplication::tr("Style")); actions_.clear(); QVector<int>::const_iterator begin = styles.begin(); QVector<int>::const_iterator end = styles.end(); for(QVector<int>::const_iterator iter = begin; iter != end; ++iter) { // The text QString text; QString icon_name(":/images/style_item.png"); switch ( *iter ) { case SPEAK_STYLE_CLEAR: text = QCoreApplication::tr("Clear"); icon_name = ":/images/tts_clear.png"; break; case SPEAK_STYLE_NORMAL: text = QCoreApplication::tr("Normal"); icon_name = ":/images/tts_normal.png"; break; case SPEAK_STYLE_PLAIN: text = QCoreApplication::tr("Plain"); icon_name = ":/images/tts_plain.png"; break; case SPEAK_STYLE_VIVID: text = QCoreApplication::tr("Vivid"); icon_name = ":/images/tts_vivid.png"; break; default: text = QCoreApplication::tr("Invalid Speed"); break; } // Add to category automatically. shared_ptr<QAction> act(new QAction(text, exclusiveGroup())); // Change font and make it as checkable. act->setCheckable(true); act->setData(*iter); act->setIcon(QIcon(QPixmap(icon_name))); if ( *iter == current ) { act->setChecked(true); } actions_.push_back(act); } }
nux::BaseTexture* SimpleLauncherIcon::GetTextureForSize(int size) { auto it = texture_map_.find(size); if (it != texture_map_.end()) return it->second.GetPointer(); std::string const& icon_string = icon_name(); if (icon_string.empty()) return nullptr; BaseTexturePtr texture; if (icon_string[0] == '/') texture = TextureFromPath(icon_string, size); else texture = TextureFromGtkTheme(icon_string, size); if (!texture) return nullptr; texture_map_.insert({size, texture}); return texture.GetPointer(); }
MainFrame::MainFrame() : wxFrame((wxFrame*)0, -1, wxT(""), wxDefaultPosition, wxDefaultSize) { create_menu(); create_widgets(); update_start(true); // Set icon #if defined(__WXMSW__) wxIcon icon(wxT("metalink"), wxBITMAP_TYPE_ICO_RESOURCE); #else wxFileName icon_name(wxStandardPaths::Get().GetDataDir(), wxT("metalink.png")); wxBitmap bmp(icon_name.GetFullPath(), wxBITMAP_TYPE_ANY); wxIcon icon; icon.CopyFromBitmap(bmp); #endif SetIcon(icon); // Set properties SetTitle(wxT("Metalink Editor")); SetSize(wxSize(600, 550)); // Update interface update(); editor_.add_listener(this); }