void AddBackupWizard::initView() { KIconLoader* loader = KIconLoader::global(); setWindowIcon( loader->loadIcon( "tools-wizard", KIconLoader::Small )); page1 = new AddBackupWizardPage1(this); addPage(page1); page2 = new AddBackupWizardPage2(this); addPage(page2); page3 = new AddBackupWizardPage3(this); addPage(page3); }
void ModuleTitle::showTitleFor(ConfigModule *config) { if(!config) return; QWhatsThis::remove(this); QWhatsThis::add(this, config->comment()); KIconLoader *loader = KGlobal::instance()->iconLoader(); QPixmap icon = loader->loadIcon(config->icon(), KIcon::NoGroup, 22); m_icon->setPixmap(icon); m_name->setText(config->moduleName()); show(); }
OpmlDirectoryService::OpmlDirectoryService( OpmlDirectoryServiceFactory* parent, const QString &name, const QString &prettyName ) : ServiceBase( name, parent, false, prettyName ) { setShortDescription( i18n( "A large listing of podcasts" ) ); setIcon( KIcon( "view-services-opml-amarok" ) ); setLongDescription( i18n( "A comprehensive list of searchable podcasts that you can subscribe to directly from within Amarok." ) ); KIconLoader loader; setImagePath( loader.iconPath( "view-services-opml-amarok", -128, true ) ); The::amarokUrlHandler()->registerRunner( this, command() ); setServiceReady( true ); }
void starter::reloadImages() { KIconLoader* iLoader = KGlobal::iconLoader(); QString pth; if (_VALID_(BaseURL)) pth = configDialog->BaseURL->url(); else pth = iLoader->iconPath("bStarter", KIcon::Small, true); if (pth) pixmap = QImage(pth); if (!pth || pixmap.isNull()) { pixmap = QPixmap(22,22); pixmap.fill(Qt::black); } pth = QString(); if (_VALID_(HoverURL)) pth = configDialog->HoverURL->url(); else pth = iLoader->iconPath("bStarter_hover", KIcon::Small, true); if (pth) hoverPixmap = QImage(pth); if (!pth || hoverPixmap.isNull()) { hoverPixmap = QPixmap(22,22); hoverPixmap.fill(Qt::black); } pth = QString(); if (_VALID_(DownURL)) pth = configDialog->DownURL->url(); else pth = iLoader->iconPath("bStarter_down", KIcon::Small, true); if (pth) downPixmap = QImage(pth); if (!pth || downPixmap.isNull()) { downPixmap = QPixmap(22,22); downPixmap.fill(Qt::white); } int wd = pixmap.width(); int ht = pixmap.height(); if (wd < hoverPixmap.width()) wd = hoverPixmap.width(); if (wd < downPixmap.width()) wd = downPixmap.width(); if (ht < hoverPixmap.height()) ht = hoverPixmap.height(); if (ht < downPixmap.height()) ht = downPixmap.height(); mainView->setFixedSize(wd,ht); repaint(); }
void ViewWidget::icoLoad() { KIconLoader iconLoader; QIcon icoLeft(iconLoader.loadIcon(QString("object-rotate-left"),(KIconLoader::Group)4)); ui->pushButton_2->setIcon(icoLeft); QIcon icoRight(iconLoader.loadIcon(QString("object-rotate-right"),(KIconLoader::Group)4)); ui->pushButton_3->setIcon(icoRight); QIcon icoDownload(iconLoader.loadIcon(QString("download"),(KIconLoader::Group)4)); ui->pushButton_4->setIcon(icoDownload); QIcon icoDel(iconLoader.loadIcon(QString("edit-delete"),(KIconLoader::Group)4)); ui->pushButton->setIcon(icoDel); }
void KbfxPlasmaCanvasItem::setIconPath ( QString str ) { KIconLoader *iconload = KGlobal::iconLoader (); m_iconPath = iconload->iconPath ( str, KIcon::Desktop, false ); // m_icon.load(m_iconPath); QImage _img ( m_iconPath ); if ( _img.height() > 128 ) { _img = _img.smoothScale ( 32,32 ); } m_icon.convertFromImage ( _img ); }
void SlidePlaybackWidget::slotPlayButtonToggled() { if (m_playButton->isChecked()) { m_canHide = false; KIconLoader* loader = KIconLoader::global(); m_playButton->setIcon(loader->loadIcon("media-playback-start", KIconLoader::NoGroup, 22)); emit signalPause(); } else { m_canHide = true; KIconLoader* loader = KIconLoader::global(); m_playButton->setIcon(loader->loadIcon("media-playback-pause", KIconLoader::NoGroup, 22)); emit signalPlay(); } }
QString MainWindow::introductionString() { KIconLoader *iconloader = KGlobal::iconLoader(); int iconSize = iconloader->currentSize( KIcon::Desktop ); QString handbook_icon_path = iconloader->iconPath( "contents2", KIcon::Desktop ); QString html_icon_path = iconloader->iconPath( "html", KIcon::Desktop ); QString wizard_icon_path = iconloader->iconPath( "wizard", KIcon::Desktop ); QString info = i18n( "<h2 style='text-align:center; margin-top: 0px;'>Welcome to Kontact %1</h2>" "<p>%1</p>" "<table align=\"center\">" "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>" "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>" "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>" "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>" "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>" "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>" "</table>" "<p style=\"margin-bottom: 0px\"> <a href=\"%1\">Skip this introduction</a></p>" ) .arg( kapp->aboutData()->version() ) .arg( i18n( "Kontact handles your e-mail, addressbook, calendar, to-do list and more." ) ) .arg( "help:/kontact" ) .arg( iconSize ) .arg( iconSize ) .arg( handbook_icon_path ) .arg( "help:/kontact" ) .arg( i18n( "Read Manual" ) ) .arg( i18n( "Learn more about Kontact and its components" ) ) .arg( "http://kontact.org" ) .arg( iconSize ) .arg( iconSize ) .arg( html_icon_path ) .arg( "http://kontact.org" ) .arg( i18n( "Visit Kontact Website" ) ) .arg( i18n( "Access online resources and tutorials" ) ) .arg( "exec:/gwwizard" ) .arg( iconSize ) .arg( iconSize ) .arg( wizard_icon_path ) .arg( "exec:/gwwizard" ) .arg( i18n( "Configure Kontact as Groupware Client" ) ) .arg( i18n( "Prepare Kontact for use in corporate networks" ) ) .arg( "exec:/switch" ); return info; }
void KFFWin_Flightplan::showFavoriteContextMenu( const QPoint &pos ) { KIconLoader loader; QPixmap pixmap; QIcon icon; QAction* remove; QAction* clear; QAction* edit; QAction* moveup; QAction* movedown; QAction* calc; KMenu menu( this ); pixmap = loader.loadIcon( "edit-delete", KIconLoader::Small ); icon.addPixmap( pixmap ); remove = new QAction( icon, i18n( "&Remove waypoint" ), this ); remove->setStatusTip( i18n( "Remove this waypoint" ) ); connect( remove, SIGNAL( triggered() ), this, SLOT( removeNavaids() ) ); pixmap = loader.loadIcon( "edit-clear-list", KIconLoader::Small ); icon.addPixmap( pixmap ); clear = new QAction( icon, i18n( "&Clear all waypoints" ), this ); clear->setStatusTip( i18n( "Clear waypoint list" ) ); connect( clear, SIGNAL( triggered() ), ui_widget.treewidget_navaids, SLOT( clear() ) ); pixmap = loader.loadIcon( "edit-rename", KIconLoader::Small ); icon.addPixmap( pixmap ); edit = new QAction( icon, i18n( "&Edit waypoint altitude" ), this ); edit->setStatusTip( i18n( "Edit this waypoint" ) ); connect( edit, SIGNAL( triggered() ), this, SLOT( edit() ) ); pixmap = loader.loadIcon( "arrow-up", KIconLoader::Small ); icon.addPixmap( pixmap ); moveup = new QAction( icon, i18n( "&Move waypoint up" ), this ); moveup->setStatusTip( i18n( "Move this waypoint up" ) ); connect( moveup, SIGNAL( triggered() ), this, SLOT( moveItemUp() ) ); pixmap = loader.loadIcon( "arrow-down", KIconLoader::Small ); icon.addPixmap( pixmap ); movedown = new QAction( icon, i18n( "&Move waypoint down" ), this ); movedown->setStatusTip( i18n( "Move this waypoint down" ) ); connect( movedown, SIGNAL( triggered() ), this, SLOT( moveItemDown() ) ); pixmap = loader.loadIcon( "view-refresh", KIconLoader::Small ); icon.addPixmap( pixmap ); calc = new QAction( icon, i18n( "&Recalculate Distance" ), this ); calc->setStatusTip( i18n( "Force recalculate distance between all waypoints" ) ); connect( calc, SIGNAL( triggered() ), this, SLOT( recalculate() ) ); menu.addAction( remove ); menu.addAction( edit ); menu.addSeparator(); menu.addAction( clear ); menu.addSeparator(); menu.addAction( moveup ); menu.addAction( movedown ); menu.addSeparator(); menu.addAction( calc ); menu.exec( mapToGlobal( pos + ui_widget.treewidget_navaids->pos() ) ); }
/** * Construct the popup * Add extra widgets to the passive popup & connect buttons to mainwindow signals. */ OSUpdaterPopup::OSUpdaterPopup(QWidget * parent,MainWindow * mainWindow) : KPassivePopup(parent) { setTimeout(30000); _popupLayout = new QVBoxLayout(this, 11, 20, "popupLayout"); _titleLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"titleLayout"); _title = new QLabel("<b>openSUSE updater.</b>",this); _title->setTextFormat(Qt::RichText); _title->setAlignment(Qt::SingleLine); _closeButton = new QPushButton("x",this,"closebutton"); _closeButton->setMinimumSize(QSize(20,20)); _closeButton->setMaximumSize(QSize(20,20)); connect(_closeButton, SIGNAL(clicked()),this, SLOT(hide())); _titleLayout->addWidget(_title); _titleLayout->addStretch(); _titleLayout->addWidget(_closeButton); _description = new QLabel(this); KIconLoader *loader = KGlobal::iconLoader(); QPixmap icon = loader->loadIcon("msg_warning",KIcon::Panel); _iconLabel = new QLabel(this); _iconLabel->setPixmap(icon); _descriptionLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"descriptionlayout"); _descriptionLayout->addWidget(_iconLabel); _descriptionLayout->addWidget(_description); _buttonLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"buttonLayout"); _installButton = new QPushButton(i18n("Install"),this,"installbutton"); _cancelButton = new QPushButton(i18n("Ignore"),this,"ignorebutton"); connect(_cancelButton, SIGNAL(clicked()),this, SLOT(hide())); connect(_installButton, SIGNAL(clicked()),mainWindow, SIGNAL(startInstall())); connect(_installButton, SIGNAL(clicked()),this, SLOT(hide())); _buttonLayout->addStretch(); _buttonLayout->addWidget(_installButton); _buttonLayout->addWidget(_cancelButton); _buttonLayout->addStretch(); }
KFFOpt_scenery::KFFOpt_scenery( QWidget *parent ) : KFFOpt_skeleton( parent ) { KIconLoader loader; ui_widget.setupUi ( this ); m_aircraftIcon = loader.loadIcon( "kffplane", KIconLoader::Small ); m_weatherIcon = loader.loadIcon( "kffweather", KIconLoader::Small ); m_shipIcon = loader.loadIcon( "kffboat", KIconLoader::Small ); m_trainIcon = loader.loadIcon( "kfftrain", KIconLoader::Small ); m_unknowIcon = KIconLoader::unknown(); connect( ui_widget.btn_refresh, SIGNAL( clicked() ), SLOT( reload() ) ); }
void setState(enum STATE state) { m_state = state; KIconLoader *loader = KIconLoader::global(); switch (state) { case InitialState: setIcon(0, QIcon()); break; case SaveOKState: setIcon(0, loader->loadIcon("dialog-ok", KIconLoader::NoGroup,/*height()*/16)); // "ok" icon should probably be "dialog-success", but we don't have that icon in KDE 4.0 break; case SaveFailedState: setIcon(0, loader->loadIcon("dialog-error", KIconLoader::NoGroup,/*height()*/16)); break; } }
void InformationPanelContent::showItems(const KFileItemList& items) { m_pendingPreview = false; KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("dialog-information", KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count())); if (m_metaDataWidget) { m_metaDataWidget->setItems(items); } m_phononWidget->hide(); m_item = KFileItem(); }
void insertLibraryCataloguesAndIcons() { static const char * const catalogs[] = { "libkdepim", "libksieve", "libkleopatra", "libkpgp", "libkmime", "libmessagelist", "libmessagecore" }; KLocale * l = KGlobal::locale(); KIconLoader * il = KIconLoader::global(); for ( unsigned int i = 0 ; i < sizeof catalogs / sizeof *catalogs ; ++i ) { l->insertCatalog( catalogs[i] ); il->addAppDir( catalogs[i] ); } }
void SummaryWidget::createDiskMaps() { DiskList disks; const QCString free = i18n( "Free" ).local8Bit(); const QCString used = i18n( "Used" ).local8Bit(); KIconLoader loader; oldScheme = Config::scheme; Config::scheme = (Filelight::MapScheme)2000; for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it) { Disk const &disk = *it; if (disk.free == 0 && disk.used == 0) continue; QWidget *box = new QVBox( this ); RadialMap::Widget *map = new MyRadialMap( box ); QString text; QTextOStream( &text ) << "<img src='" << loader.iconPath( disk.icon, KIcon::Toolbar ) << "'>" << " " << disk.mount << " " << "<i>(" << disk.device << ")</i>"; QLabel *label = new QLabel( text, box ); label->setAlignment( Qt::AlignCenter ); label->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum ); box->show(); // will show its children too Directory *tree = new Directory( disk.mount.local8Bit() ); tree->append( free, disk.free ); tree->append( used, disk.used ); map->create( tree ); //must be done when visible connect( map, SIGNAL(activated( const KURL& )), SIGNAL(activated( const KURL& )) ); } }
void kthememanager::queryLNFModules() { /*KServiceGroup::Ptr settings = KServiceGroup::group( "Settings/LookNFeel/" ); if ( !settings || !settings->isValid() ) return; KServiceGroup::List list = settings->entries(); // Iterate over all entries in the group for( KServiceGroup::List::ConstIterator it = list.begin(); it != list.end(); it++ ) { KSycocaEntry *p = ( *it ); if ( p->isType( KST_KService ) ) { KService *s = static_cast<KService *>( p ); ( void ) new KThemeDetailsItem( dlg->lvDetails, s->name(), s->pixmap( KIcon::Desktop ), s->exec() ); } } dlg->lvDetails->sort();*/ // For now use a static list KIconLoader * il = KGlobal::iconLoader(); dlg->btnBackground->setIconSet( il->loadIconSet( "background", KIcon::Desktop, 32 ) ); dlg->btnColors->setIconSet( il->loadIconSet( "colorscm", KIcon::Desktop, 32 ) ); dlg->btnStyle->setIconSet( il->loadIconSet( "style", KIcon::Desktop, 32 ) ); dlg->btnIcons->setIconSet( il->loadIconSet( "icons", KIcon::Desktop, 32 ) ); dlg->btnFonts->setIconSet( il->loadIconSet( "fonts", KIcon::Desktop, 32 ) ); dlg->btnSaver->setIconSet( il->loadIconSet( "kscreensaver", KIcon::Desktop, 32 ) ); }
const QIconSet *Icons::getBigIcon(const char *name) { PIXMAP_MAP::iterator it = bigIcons.find(name); if (it == bigIcons.end()){ if (!strcmp(name, "online")){ const QIconSet *icon = BigIcon("licq"); if (icon) return addBigIcon("online", *icon, false); } if (!strcmp(name, "offline")){ const QIconSet *icon = BigIcon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Large, QIconSet::Normal); pict = swapRG(pict); QIconSet offline(pict); return addBigIcon("offline", offline, false); } } if (!strcmp(name, "inactive")){ const QIconSet *icon = BigIcon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Large, QIconSet::Normal); pict = setGB(pict); QIconSet inactive(pict); return addBigIcon("inactive", inactive, false); } } return NULL; } PictDef &p = (*it).second; #ifdef USE_KDE if (p.bSystem){ KIconLoader iconLoader; QPixmap pict = iconLoader.loadIcon(name, KIcon::Desktop, -64, KIcon::DefaultState, NULL, true); if (!pict.isNull()) p.icon = QIconSet(pict); } #endif return &p.icon; }
void testLoadMimeTypeIcon() { QFETCH(QString, iconName); QFETCH(QString, expectedFileName); KIconLoader iconLoader; QString path; QPixmap pix = iconLoader.loadMimeTypeIcon(iconName, KIconLoader::Desktop, 24, KIconLoader::DefaultState, QStringList(), &path ); QVERIFY(!pix.isNull()); QCOMPARE(path.section('/', -1), expectedFileName); // do the same test using a global iconloader, so that // we get into the final return statement, which can only happen // if d->extraDesktopIconsLoaded becomes true first.... QString path2; pix = KIconLoader::global()->loadMimeTypeIcon(iconName, KIconLoader::Desktop, 24, KIconLoader::DefaultState, QStringList(), &path2 ); QVERIFY(!pix.isNull()); QCOMPARE(path2, path); }
void InformationPanelContent::showItem(const KFileItem& item) { m_pendingPreview = false; const KUrl itemUrl = item.url(); const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty(); if (!applyPlace(itemUrl)) { setNameLabelText(item.text()); if (isSearchUrl) { // in the case of a search-URL the URL is not readable for humans // (at least not useful to show in the Information Panel) KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("nepomuk", KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); } else { // try to get a preview pixmap from the item... m_pendingPreview = true; // Mark the currently shown preview as outdated. This is done // with a small delay to prevent a flickering when the next preview // can be shown within a short timeframe. This timer is not started // for directories, as directory previews might fail and return the // same icon. if (!item.isDir()) { m_outdatedPreviewTimer->start(); } KIO::PreviewJob* job = KIO::filePreview(KFileItemList() << item, QSize(m_preview->width(), m_preview->height())); job->setScaleType(KIO::PreviewJob::Unscaled); connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)), this, SLOT(showPreview(const KFileItem&, const QPixmap&))); connect(job, SIGNAL(failed(const KFileItem&)), this, SLOT(showIcon(const KFileItem&))); } }
SearchBar::SearchBar(QWidget* parent) : SearchBarBase(parent) { m_searchFoward = false; m_matchCase = false; m_wholeWords = false; m_fromCursor = false; setFocusProxy(m_searchEdit); KIconLoader* iconLoader = kapp->iconLoader(); m_closeButton->setIconSet(iconLoader->loadIconSet("fileclose", KIcon::Toolbar, 16)); m_findNextButton->setIconSet(iconLoader->loadIconSet("up", KIcon::Toolbar, 16)); m_findPreviousButton->setIconSet(iconLoader->loadIconSet("down", KIcon::Toolbar, 16)); m_statusPixLabel->hide(); m_statusTextLabel->hide(); m_timer = new QTimer(this); QAccel* accel = new QAccel(this); accel->connectItem( accel->insertItem(Qt::Key_Escape), this, SLOT(hide())); connect(m_timer, SIGNAL(timeout()), SLOT(slotFind())); connect(m_searchEdit, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged())); connect(m_searchEdit, SIGNAL(returnPressed()), SLOT(slotFindNext())); connect(m_findNextButton, SIGNAL(clicked()), SLOT(slotFindNext())); connect(m_findPreviousButton, SIGNAL(clicked()), SLOT(slotFindPrevious())); connect(m_closeButton, SIGNAL(clicked()), SLOT(hide())); connect(m_optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsMenu())); m_optionsMenu = new QPopupMenu(m_optionsButton, "options_menu"); m_optionsMenu->setCheckable(true); m_optionsMenu->insertItem(i18n("Find Forward"), this, SLOT(toggleSearchFoward()), 0, SEARCH_FORWARD_MENU); m_optionsMenu->insertItem(i18n("Case Sensitive"), this, SLOT(toggleMatchCase()), 0, MATCH_CASE_MENU); m_optionsMenu->insertItem(i18n("Whole Words Only"), this, SLOT(toggleWholeWords()), 0, WHOLE_WORDS_ONLY_MENU); m_optionsMenu->insertItem(i18n("From Cursor"), this, SLOT(toggleFromCursor()), 0, FROM_CURSOR_MENU); m_optionsButton->setPopup(m_optionsMenu); }
void InformationPanelContent::showItems(const KFileItemList& items) { // If there is a preview job, kill it to prevent that we have jobs for // multiple items running, and thus a race condition (bug 250787). if (m_previewJob) { m_previewJob->kill(); } KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon(QStringLiteral("dialog-information"), KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count())); if (m_metaDataWidget) { m_metaDataWidget->setItems(items); } m_phononWidget->hide(); m_item = KFileItem(); }
void KFFWin_Flightplan::createRestoreWidget( QString what ) { QPoint pos; QSize size, parentsize; QIcon icon; KIconLoader loader; QPixmap pixmap; int width = 500, height = 300; m_chooser = new KFFWin_Chooser( 0 ); if ( what == "save" ) { pixmap = loader.loadIcon( "document-save", KIconLoader::Small ); icon.addPixmap( pixmap ); m_chooser->setTitle( i18n( "Choose a name for this flight plan" ) ); m_chooser->setButtonText( i18n( "Save" ) ); m_chooser->setWindowTitle( i18n( "Save Flightplan" ) ); m_chooser->setType( KFFWin_Chooser::KFFDLG_SAVE ); connect( m_chooser, SIGNAL( selected( const QString & ) ), this, SLOT( saveFlightplan( const QString & ) ) ); }
AppletWidget::AppletWidget(const AppletInfo& info, bool odd, QWidget *parent) : AppletItem(parent), m_appletInfo(info), m_odd(odd), m_selected(false) { setFocusPolicy(QWidget::StrongFocus); setSelected(m_selected); itemTitle->setText("<h3>" + info.name() + "</h3>"); itemTitle->installEventFilter(this); if (info.comment() != info.name()) { itemDescription->setText(info.comment()); } itemDescription->installEventFilter(this); KIconLoader * ldr = KGlobal::iconLoader(); QPixmap icon = ldr->loadIcon(info.icon(), KIcon::Panel, KIcon::SizeLarge); itemPixmap->setPixmap(icon); itemPixmap->installEventFilter(this); }
/** * Initialize this object. * @param scanner A copy of this scanner will be kept * to retrieve detailed package info. */ PakooPackageListView::PakooPackageListView( QWidget* parent, const char* name, PackageScanner* scanner ) : KListView( parent, name ) { this->addColumn( i18n("Package") ); this->addColumn( i18n("Description") ); this->setRootIsDecorated( true ); this->setFullWidth( true ); packageScanner = new PackageScanner( scanner ); parallelScanning = true; // you may set this to false when debugging packageCategoryScanner = new PackageScanner( scanner ); packageInstalledScanner = new PackageScanner( scanner ); if( parallelScanning == true ) { packageCategoryScanner->setFilterInstalled( true, false ); packageInstalledScanner->setFilterInstalled( true, true ); } portageTree = NULL; currentPackage = NULL; loadedPackages = 0; installedPackages = 0; totalPackages = 0; // Load root and category item icons KIconLoader* iconLoader = KGlobal::iconLoader(); pxCategoryItem = iconLoader->loadIcon( CATEGORYICON, KIcon::Small ); pxPackageItem = iconLoader->loadIcon( PACKAGEICON, KIcon::Small ); pxPackageItemInstalled = iconLoader->loadIcon( PACKAGEICON_INSTALLED, KIcon::Small ); pxPackageItemUpdatable = iconLoader->loadIcon( PACKAGEICON_UPDATABLE, KIcon::Small ); pxVersionItem = iconLoader->loadIcon( VERSIONICON, KIcon::Small ); pxVersionItemInstalled = iconLoader->loadIcon( VERSIONICON_INSTALLED, KIcon::Small ); pxVersionItemNotAvailable = iconLoader->loadIcon( VERSIONICON_NOTAVAILABLE, KIcon::Small ); // Translate item selections into package[,version] selection signal. connect( this, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( emitSelectionChanged(QListViewItem*) ) ); // Add the versions only when the user wants to see them, which brings // a) slightly better performance, and b) better column auto-resizing. connect( this, SIGNAL( expanded(QListViewItem*) ), this, SLOT( insertVersionItems(QListViewItem*) ) ); }
void testLoadIconCanReturnNull() { // This is a test for the "canReturnNull" argument of KIconLoader::loadIcon(). // We try to load an icon that doesn't exist, first with canReturnNull=false (the default) // then with canReturnNull=true. KIconLoader iconLoader; // We expect a warning here... This doesn't work though, due to the extended debug //QTest::ignoreMessage(QtWarningMsg, "KIconLoader::loadIcon: No such icon \"this-icon-does-not-exist\""); QPixmap pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Try it again, to see if the cache interfers pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // And now set canReturnNull to true pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16, KIconLoader::DefaultState, QStringList(), 0, true); QVERIFY(pix.isNull()); // Try getting the "unknown" icon again, to see if the above call didn't put a null icon into the cache... pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Another one, to clear "last" cache pix = iconLoader.loadIcon("this-icon-does-not-exist-either", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Now load the initial one again - do we get the warning again? pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); pix = iconLoader.loadIcon("#crazyname", KIconLoader::NoGroup, 1600); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(1600, 1600)); }
QueueDialog::QueueDialog(bt::QueueManager* qm, QWidget *parent, const char *name) :QueueDlg(parent, name) { KIconLoader* iload = KGlobal::iconLoader(); m_tabs->setTabIconSet(m_tabs->page(0), iload->loadIconSet("down", KIcon::Small)); m_tabs->setTabIconSet(m_tabs->page(1), iload->loadIconSet("up", KIcon::Small)); logo->setPixmap(iload->loadIcon("ktqueuemanager", KIcon::Desktop)); connect(downloadList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(downloadList_currentChanged( QListViewItem* ))); connect(seedList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(seedList_currentChanged( QListViewItem* ))); if(downloadList->firstChild()) downloadList->setCurrentItem(downloadList->firstChild()); if(seedList->firstChild()) seedList->setCurrentItem(seedList->firstChild()); btnMoveUp->setPixmap(iload->loadIcon("up", KIcon::Small)); btnMoveDown->setPixmap(iload->loadIcon("down", KIcon::Small)); this->qman = qm; QPtrList<kt::TorrentInterface>::iterator it = qman->begin(); for( ; it != qman->end(); ++it) { TorrentInterface* tc = *it; TorrentStatus ts = tc->getStats().status; if(ts == kt::SEEDING || ts == kt::DOWNLOAD_COMPLETE || ts == kt::SEEDING_COMPLETE || tc->getStats().completed) { QueueItem* item = new QueueItem(tc, seedList); seedList->insertItem(item); } else { QueueItem* item = new QueueItem(tc, downloadList); downloadList->insertItem(item); } } }
void KonsoleApplet::init() { KIconLoader il; _icon = il.loadIcon("konsole", KIcon::Small, 0, KIcon::DefaultState); }
KBBGame::KBBGame() : KTopLevelWidget() { int i; setCaption(QString("KBlackBox ")+KBVERSION); menu = new KMenuBar(this, "menu"); QPopupMenu *game = new QPopupMenu; QPopupMenu *file = new QPopupMenu; sizesm = new QPopupMenu; ballsm = new QPopupMenu; QPopupMenu *help = new QPopupMenu; options = new QPopupMenu; CHECK_PTR( file ); CHECK_PTR( game ); CHECK_PTR( help ); CHECK_PTR( sizesm ); CHECK_PTR( ballsm ); CHECK_PTR( options ); CHECK_PTR( menu ); help->insertItem( trans->translate("&Help"), ID_HELP ); help->setAccel( CTRL+Key_H, ID_HELP ); help->insertSeparator(); help->insertItem( trans->translate("&About KBlackBox"), ID_ABOUT ); help->setAccel( CTRL+Key_A, ID_ABOUT ); help->insertItem( trans->translate("About &Qt"), ID_ABOUT_QT ); file->insertItem( trans->translate("&Quit"), ID_QUIT ); file->setAccel( CTRL+Key_Q, ID_QUIT ); game->insertItem( trans->translate("&New"), ID_NEW ); game->insertItem( trans->translate("&Give up"), ID_GIVEUP ); game->insertItem( trans->translate("&Done"), ID_DONE ); game->insertSeparator(); game->insertItem( trans->translate("&Resize"), ID_RESIZE ); sizes1id = sizesm->insertItem( " 8 x 8 ", this, SLOT(size1()) ); sizes2id = sizesm->insertItem( " 10 x 10 ", this, SLOT(size2()) ); sizes3id = sizesm->insertItem( " 12 x 12 ", this, SLOT(size3()) ); sizesm->setCheckable( TRUE ); balls1id = ballsm->insertItem( " 4 ", this, SLOT(balls1()) ); balls2id = ballsm->insertItem( " 6 ", this, SLOT(balls2()) ); balls3id = ballsm->insertItem( " 8 ", this, SLOT(balls3()) ); ballsm->setCheckable( TRUE ); options->insertItem( trans->translate("&Size"), sizesm ); options->insertItem( trans->translate("&Balls"), ballsm ); tut1id = options->insertItem( trans->translate("&Tutorial"), this, SLOT(tutorialSwitch()) ); options->setCheckable( TRUE ); connect( file, SIGNAL(activated(int)), SLOT(callBack(int)) ); connect( help, SIGNAL(activated(int)), SLOT(callBack(int)) ); connect( game, SIGNAL(activated(int)), SLOT(callBack(int)) ); menu->insertItem( trans->translate("&File"), file ); menu->insertItem( trans->translate("&Game"), game ); menu->insertItem( trans->translate("&Options"), options ); menu->insertSeparator(); menu->insertItem( trans->translate("&Help"), help ); menu->show(); setMenu( menu ); KIconLoader *loader = kapp->getIconLoader(); QPixmap **pix = new QPixmap*[NROFTYPES]; pix[0] = new QPixmap(); *pix[0] = loader->loadIcon( pFNames[0] ); if (!pix[0]->isNull()) { debug( "Pixmap \"%s\" loaded.", pFNames[0] ); for (i = 1; i < NROFTYPES; i++) { pix[i] = new QPixmap; *pix[i] = loader->loadIcon( pFNames[i] ); if (!pix[i]->isNull()) { debug( "Pixmap \"%s\" loaded.", pFNames[i] ); } else { pix[i] = pix[i-1]; pix[i]->detach(); debug( "Cannot find pixmap \"%s\". Using previous one.", pFNames[i] ); } } } else { debug( "Cannot find pixmap \"%s\". Pixmaps will not be loaded.", pFNames[0] ); delete pix[0]; delete pix; pix = NULL; } gr = new KBBGraphic( pix, this ); connect( gr, SIGNAL(inputAt(int,int,int)), this, SLOT(gotInputAt(int,int,int)) ); connect( this, SIGNAL(gameRuns(bool)), gr, SLOT(setInputAccepted(bool)) ); connect( gr, SIGNAL(endMouseClicked()), this, SLOT(gameFinished()) ); /* QToolTip::add( doneButton, trans->translate( "Click here when you think you placed all the balls.") ); */ QString tmps; stat = new KStatusBar( this ); tmps.sprintf( "aaaaaaaa" ); stat->insertItem( (const char *) tmps, SSCORE ); tmps.sprintf( "aaaaaaaaaaa" ); stat->insertItem( (const char *) tmps, SBALLS ); tmps.sprintf( "aaaaaaa" ); stat->insertItem( (const char *) tmps, SRUN ); tmps.sprintf( "aaaaaaaaaa" ); stat->insertItem( (const char *) tmps, SSIZE ); setStatusBar( stat ); tool = new KToolBar( this ); tool->insertButton( loader->loadIcon("exit.xpm"), ID_QUIT, TRUE, trans->translate("Quit") ); tool->insertButton( loader->loadIcon("reload.xpm"), ID_NEW, TRUE, trans->translate("New") ); tool->insertButton( loader->loadIcon("giveup.xpm"), ID_GIVEUP, TRUE, trans->translate("Give up") ); tool->insertButton( loader->loadIcon("done.xpm"), ID_DONE, TRUE, trans->translate("Done") ); tool->insertSeparator(); tool->insertButton( loader->loadIcon("help.xpm"), ID_HELP, TRUE, trans->translate("Help") ); connect( tool, SIGNAL(clicked(int)), SLOT(callBack(int)) ); addToolBar( tool ); tool->setBarPos( KToolBar::Top ); tool->show(); /* Game initializations */ running = FALSE; gameBoard = NULL; KConfig *kConf; int j; kConf = KApplication::getKApplication()->getConfig(); kConf->setGroup( "KBlackBox Setup" ); if (kConf->hasKey( "Balls" )) { i = kConf->readNumEntry( "Balls" ); balls = i; switch (i) { case 4: ballsm->setItemChecked( balls1id, TRUE ); break; case 6: ballsm->setItemChecked( balls2id, TRUE ); break; case 8: ballsm->setItemChecked( balls3id, TRUE ); break; } } else { balls = 4; ballsm->setItemChecked( balls1id, TRUE ); } if ((kConf->hasKey( "Width" )) && (kConf->hasKey( "Balls" ))) { i = kConf->readNumEntry( "Width" ); j = kConf->readNumEntry( "Height" ); gr->setSize( i+4, j+4 ); // +4 is the space for "lasers" and an edge... gameBoard = new RectOnArray( gr->numC(), gr->numR() ); switch (i) { case 8: sizesm->setItemChecked( sizes1id, TRUE ); break; case 10: sizesm->setItemChecked( sizes2id, TRUE ); break; case 12: sizesm->setItemChecked( sizes3id, TRUE ); break; } } else { gr->setSize( 8+4, 8+4 ); // +4 is the space for "lasers" and an edge... gameBoard = new RectOnArray( gr->numC(), gr->numR() ); sizesm->setItemChecked( sizes1id, TRUE ); } if (kConf->hasKey( "tutorial" )) { tutorial = (bool) kConf->readNumEntry( "tutorial" ); } else tutorial = FALSE; options->setItemChecked( tut1id, tutorial ); QString s, s1; int pos; setMinSize(); gameResize(); if (kConf->hasKey( "appsize" )) { s = kConf->readEntry( "appsize" ); debug("%s", (const char *) s); pos = s.find( 'x' ); s1 = s.right( s.length() - pos - 1 ); s.truncate( pos - 1 ); // debug("%s", (const char *) s); // debug("%s", (const char *) s1); resize( s.toInt(), s1.toInt() ); } setScore( 0 ); ballsPlaced = 0; updateStats(); setView( gr ); newGame(); }
void SourceItem::updateCost() { _pure = SubCost(0); _pure2 = SubCost(0); if (!_line) return; if (_lineJump) return; ProfileCostArray* lineCost = _lineCall ? (ProfileCostArray*)_lineCall : (ProfileCostArray*)_line; // do not show any cost inside of cycles if (_lineCall && ((_lineCall->call()->inCycle()>0) || (_lineCall->call()->isRecursion()))) { QString str; QPixmap p; QString icon = "edit-undo"; #if 0 // TODO KIconLoader* loader = KIconLoader::global(); p= loader->loadIcon(icon, KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(), 0, true); #endif if (p.isNull()) str = QObject::tr("(cycle)"); setText(1, str); setIcon(1, p); setText(2, str); setIcon(2, p); return; } ProfileCostArray* totalCost; if (GlobalConfig::showExpanded()) totalCost = _line->functionSource()->function()->inclusive(); else totalCost = _line->functionSource()->function()->data(); EventType* ct = _view->eventType(); _pure = ct ? lineCost->subCost(ct) : SubCost(0); if (_pure == 0) { setText(1, QString()); setIcon(1, QPixmap()); } else { double total = totalCost->subCost(ct); double pure = 100.0 * _pure / total; if (GlobalConfig::showPercentage()) setText(1, QString("%1") .arg(pure, 0, 'f', GlobalConfig::percentPrecision())); else setText(1, _pure.pretty()); setIcon(1, costPixmap(ct, lineCost, total, false)); } EventType* ct2 = _view->eventType2(); _pure2 = ct2 ? lineCost->subCost(ct2) : SubCost(0); if (_pure2 == 0) { setText(2, QString()); setIcon(2, QPixmap()); } else { double total = totalCost->subCost(ct2); double pure2 = 100.0 * _pure2 / total; if (GlobalConfig::showPercentage()) setText(2, QString("%1") .arg(pure2, 0, 'f', GlobalConfig::percentPrecision())); else setText(2, _pure2.pretty()); setIcon(2, costPixmap(ct2, lineCost, total, false)); } }
int HexWidget::initMenu() { windowList.append(this); CurrentFile=new HexFile(this); unsaved( false ); connect(CurrentFile, SIGNAL( unsaved(bool) ), SLOT( unsaved(bool) )); QPopupMenu *file = new QPopupMenu; file->insertItem( i18n("&New Window..."), ID_FILE_NEWWIN); file->insertSeparator(); file->insertItem( i18n("&Open..."), ID_FILE_OPEN ); file->insertItem( i18n("&Save"), ID_FILE_SAVE); file->insertItem( i18n("Save &As..."), ID_FILE_SAVEAS); file->insertItem( i18n("&Close"), ID_FILE_CLOSE); file->insertSeparator(); file->insertItem( i18n("&Quit"), ID_FILE_QUIT); QPopupMenu *edit = new QPopupMenu; edit->insertItem( i18n("&Copy"), ID_EDIT_COPY); edit->insertItem( i18n("&Paste"), ID_EDIT_PASTE); edit->insertItem( i18n("C&ut"), ID_EDIT_CUT); QPopupMenu *view = new QPopupMenu; view->insertItem( i18n("&Toggle Toolbar"), ID_VIEW_TOOLBAR); // view->insertItem( "Toggle Statusbar", ID_VIEW_STATUSBAR); QPopupMenu *help = kapp->getHelpMenu(true, QString(i18n("Hex Editor")) + " " + KHEXDIT_VERSION + i18n("\n\nby Stephan Kulow") + " ([email protected])"); connect (file, SIGNAL (activated (int)), SLOT (menuCallback (int))); connect (edit, SIGNAL (activated (int)), SLOT (menuCallback (int))); connect (help, SIGNAL (activated (int)), SLOT (menuCallback (int))); connect (view, SIGNAL (activated (int)), SLOT (menuCallback (int))); menu = new KMenuBar( this ); CHECK_PTR( menu ); menu->insertItem( i18n("&File"), file ); menu->insertItem( i18n("&Edit"), edit); menu->insertItem( i18n("&View"), view ); menu->insertSeparator(); menu->insertItem( i18n("&Help"), help ); menu->show(); setMenu(menu); KIconLoader *loader = kapp->getIconLoader(); toolbar = new KToolBar(this); toolbar->insertButton(loader->loadIcon("filenew.xpm"), ID_FILE_NEWWIN, true, i18n("New Window")); toolbar->insertButton(loader->loadIcon("fileopen.xpm"),ID_FILE_OPEN, true, i18n("Open a file")); toolbar->insertButton(loader->loadIcon("filefloppy.xpm"), ID_FILE_SAVE, true, i18n("Save the file")); toolbar->insertSeparator(); toolbar->insertButton(loader->loadIcon("editcut.xpm"),ID_EDIT_CUT, false, i18n("Not implemented")); toolbar->insertButton(loader->loadIcon("editcopy.xpm"),ID_EDIT_COPY, false, i18n("Not implemented")); toolbar->insertButton(loader->loadIcon("editpaste.xpm"),ID_EDIT_PASTE, false, i18n("Not implemented")); toolbar->insertSeparator(); toolbar->insertButton(loader->loadIcon("fileprint.xpm"),ID_FILE_PRINT, false, i18n("Not implemented")); addToolBar(toolbar); toolbar->setBarPos(KToolBar::Top); toolbar->show(); connect(toolbar, SIGNAL(clicked(int)), SLOT(menuCallback(int))); // KStatusBar *stat = new KStatusBar(this); // stat->show(); // setStatusBar(stat); kfm = 0L; setView(CurrentFile); dropZone = new KDNDDropZone( this , DndURL); connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ), SLOT( slotDropEvent( KDNDDropZone *) ) ); show(); return 0; }