本文整理汇总了C++中KIcon函数的典型用法代码示例。如果您正苦于以下问题:C++ KIcon函数的具体用法?C++ KIcon怎么用?C++ KIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KIcon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QRect
//.........这里部分代码省略.........
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;
}
示例2: info
//.........这里部分代码省略.........
// check for cdrecord clone image
// try both path and path.toc as tocfiles
K3b::CloneTocReader cr;
if( path.right(4) == ".toc" ) {
cr.openFile( path );
if( cr.isValid() ) {
d->tocFile = path;
d->imageFile = cr.imageFilename();
}
}
if( d->imageFile.isEmpty() ) {
cr.openFile( path + ".toc" );
if( cr.isValid() ) {
d->tocFile = cr.filename();
d->imageFile = cr.imageFilename();
}
}
if( !d->imageFile.isEmpty() ) {
// we have a cdrecord clone image
d->createCdrecordCloneItems( d->tocFile, d->imageFile );
calculateMd5Sum( d->imageFile );
d->foundImageType = IMAGE_CDRECORD_CLONE;
}
}
if( d->foundImageType == IMAGE_UNKNOWN ) {
// check for cue/bin stuff
// once again we try both path and path.cue
K3b::CueFileParser cp;
if( path.right(4).toLower() == ".cue" )
cp.openFile( path );
else if( path.right(4).toLower() == ".bin" )
cp.openFile( path.left( path.length()-3) + "cue" );
if( cp.isValid() ) {
d->tocFile = cp.filename();
d->imageFile = cp.imageFilename();
}
if( d->imageFile.isEmpty() ) {
cp.openFile( path + ".cue" );
if( cp.isValid() ) {
d->tocFile = cp.filename();
d->imageFile = cp.imageFilename();
}
}
if( !d->imageFile.isEmpty() ) {
// we have a cue file
if( cp.toc().contentType() == K3b::Device::AUDIO ) {
d->foundImageType = IMAGE_AUDIO_CUE;
d->createAudioCueItems( cp );
}
else {
d->foundImageType = IMAGE_CUE_BIN; // we cannot be sure if writing will work... :(
d->createCueBinItems( d->tocFile, d->imageFile );
calculateMd5Sum( d->imageFile );
}
}
}
if( d->foundImageType == IMAGE_UNKNOWN ) {
// TODO: check for cdrdao tocfile
}
if( d->foundImageType == IMAGE_UNKNOWN ) {
QTreeWidgetItem* item = new QTreeWidgetItem( d->infoView );
if ( !info.isReadable() ) {
item->setText( 0, i18n("Unable to read image file") );
} else {
item->setText( 0, i18n("Seems not to be a usable image") );
}
item->setForeground( 0, d->negativeTextColor );
item->setIcon( 0, KIcon( "dialog-error") );
}
else {
// remember as recent image
int i = 0;
while ( i < d->comboRecentImages->count() && d->comboRecentImages->itemText(i) != path )
++i;
if ( i == d->comboRecentImages->count() )
d->comboRecentImages->insertItem( 0, path );
}
}
else {
QTreeWidgetItem* item = new QTreeWidgetItem( d->infoView );
item->setText( 0, i18n("File not found") );
item->setForeground( 0, d->negativeTextColor );
item->setIcon( 0, KIcon( "dialog-error") );
}
slotToggleAll();
}
示例3: setPopupIcon
void Paste::resetIcon()
{
setPopupIcon("edit-paste");
m_list->icon->setPixmap(KIcon("edit-paste").pixmap(KIconLoader::SizeSmall,
KIconLoader::SizeSmall));
}
示例4: QGraphicsWidget
UpcomingEventsWidget::UpcomingEventsWidget( const LastFmEventPtr &event,
QGraphicsItem *parent,
Qt::WindowFlags wFlags )
: QGraphicsWidget( parent, wFlags )
, m_mapButton( 0 )
, m_urlButton( 0 )
, m_image( new QLabel )
, m_event( event )
{
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum );
m_image->setText( i18n("Loading picture...") );
m_image->setAttribute( Qt::WA_NoSystemBackground );
m_image->setAlignment( Qt::AlignCenter );
m_image->setFixedSize( 128, 128 );
QGraphicsProxyWidget *imageProxy = new QGraphicsProxyWidget( this );
imageProxy->setWidget( m_image );
m_attendance = createLabel();
m_date = createLabel();
m_location = createLabel();
m_name = createLabel();
m_participants = createLabel();
m_tags = createLabel();
m_venue = createLabel();
QGraphicsLinearLayout *buttonsLayout = new QGraphicsLinearLayout( Qt::Horizontal );
buttonsLayout->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
if( event && event->venue() && event->venue()->location )
{
QPointF geo( event->venue()->location->longitude, event->venue()->location->latitude );
if( !geo.isNull() )
{
m_mapButton = new Plasma::PushButton( this );
m_mapButton->setMaximumSize( QSizeF( 22, 22 ) );
m_mapButton->setIcon( KIcon("edit-find") ); // TODO: a map icon would be nice
m_mapButton->setToolTip( i18n( "View map" ) );
buttonsLayout->addItem( m_mapButton );
}
}
if( event && event->url().isValid() )
{
m_urlButton = new Plasma::PushButton( this );
m_urlButton->setMaximumSize( QSizeF( 22, 22 ) );
m_urlButton->setIcon( KIcon("applications-internet") );
m_urlButton->setToolTip( i18n( "Open Last.fm webpage for this event" ) );
connect( m_urlButton, SIGNAL(clicked()), this, SLOT(openUrl()) );
buttonsLayout->addItem( m_urlButton );
}
QSizePolicy::Policy minPol = QSizePolicy::Minimum;
QGraphicsWidget *supportLabel, *venueLabel, *locationLabel, *dateLabel, *attendLabel, *tagsLabel;
supportLabel = createLabel( i18nc("@label:textbox Supporing acts for an event", "Supporting:"), minPol );
venueLabel = createLabel( i18nc("@label:textbox", "Venue:"), minPol );
locationLabel = createLabel( i18nc("@label:textbox", "Location:"), minPol );
dateLabel = createLabel( i18nc("@label:textbox", "Date:"), minPol );
attendLabel = createLabel( i18nc("@label:textbox", "Attending:"), minPol );
tagsLabel = createLabel( i18nc("@label:textbox", "Tags:"), minPol );
QGraphicsGridLayout *infoLayout = new QGraphicsGridLayout;
infoLayout->addItem( supportLabel, 0, 0 );
infoLayout->addItem( venueLabel, 1, 0 );
infoLayout->addItem( locationLabel, 2, 0 );
infoLayout->addItem( dateLabel, 3, 0 );
infoLayout->addItem( attendLabel, 4, 0 );
infoLayout->addItem( tagsLabel, 5, 0 );
infoLayout->addItem( m_participants, 0, 1 );
infoLayout->addItem( m_venue, 1, 1 );
infoLayout->addItem( m_location, 2, 1 );
infoLayout->addItem( m_date, 3, 1 );
infoLayout->addItem( m_attendance, 4, 1 );
infoLayout->addItem( m_tags, 5, 1 );
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
layout->addItem( imageProxy, 0, 0, 2, 1, Qt::AlignCenter );
layout->addItem( m_name, 0, 1 );
layout->addItem( buttonsLayout, 0, 2, Qt::AlignRight );
layout->addItem( infoLayout, 1, 1, 1, 2 );
setLayout( layout );
QString name = event->name();
if( event->isCancelled() )
name = i18nc( "@label:textbox Title for a canceled upcoming event", "<s>%1</s> (Canceled)", name );
setName( name );
setDate( event->date() );
setLocation( event->venue()->location );
setVenue( event->venue() );
setAttendance( event->attendance() );
setParticipants( event->participants() );
setTags( event->tags() );
setImage( event->imageUrl(LastFmEvent::Large) );
}
示例5: QWidget
soundKonverterView::soundKonverterView( Logger *_logger, Config *_config, CDManager *_cdManager, QWidget *parent )
: QWidget( parent ),
config( _config ),
logger( _logger ),
cdManager( _cdManager )
{
setAcceptDrops( true );
const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height();
// the grid for all widgets in the main window
QGridLayout* gridLayout = new QGridLayout( this );
fileList = new FileList( logger, config, this );
gridLayout->addWidget( fileList, 1, 0 );
gridLayout->setRowStretch( 1, 1 );
connect( fileList, SIGNAL(fileCountChanged(int)), this, SLOT(fileCountChanged(int)) );
connect( fileList, SIGNAL(conversionStarted()), this, SLOT(conversionStarted()) );
connect( fileList, SIGNAL(conversionStopped(bool)), this, SLOT(conversionStopped(bool)) );
connect( fileList, SIGNAL(queueModeChanged(bool)), this, SLOT(queueModeChanged(bool)) );
connect( fileList, SIGNAL(showLog(int)), this, SIGNAL(showLog(int)) );
optionsLayer = new OptionsLayer( config, this );
fileList->setOptionsLayer( optionsLayer );
optionsLayer->hide();
gridLayout->addWidget( optionsLayer, 1, 0 );
connect( optionsLayer, SIGNAL(done(const KUrl::List&,ConversionOptions*,const QString&)), fileList, SLOT(addFiles(const KUrl::List&,ConversionOptions*,const QString&)) );
connect( optionsLayer, SIGNAL(saveFileList()), fileList, SLOT(save()) );
// add a horizontal box layout for the add combobutton to the grid
QHBoxLayout *addBox = new QHBoxLayout();
addBox->setContentsMargins( 1, 0, 1, 0 ); // extra margin - determined by experiments
gridLayout->addLayout( addBox, 3, 0 );
// create the combobutton for adding files to the file list
cAdd = new ComboButton( this );
QFont font = cAdd->font();
//font.setWeight( QFont::DemiBold );
font.setPointSize( font.pointSize() + 3 );
cAdd->setFont( font );
cAdd->insertItem( KIcon("audio-x-generic"), i18n("Add files...") );
cAdd->insertItem( KIcon("folder"), i18n("Add folder...") );
cAdd->insertItem( KIcon("media-optical-audio"), i18n("Add CD tracks...") );
cAdd->insertItem( KIcon("network-workgroup"), i18n("Add url...") );
cAdd->insertItem( KIcon("view-media-playlist"), i18n("Add playlist...") );
cAdd->increaseHeight( 0.6*fontHeight );
addBox->addWidget( cAdd, 0, Qt::AlignVCenter );
connect( cAdd, SIGNAL(clicked(int)), this, SLOT(addClicked(int)) );
cAdd->setFocus();
addBox->addSpacing( fontHeight );
startAction = new KAction( KIcon("system-run"), i18n("Start"), this );
connect( startAction, SIGNAL(triggered()), fileList, SLOT(startConversion()) );
pStart = new KPushButton( KIcon("system-run"), i18n("Start"), this );
pStart->setFixedHeight( pStart->size().height() );
pStart->setEnabled( false );
startAction->setEnabled( false );
addBox->addWidget( pStart, 0, Qt::AlignVCenter );
connect( pStart, SIGNAL(clicked()), fileList, SLOT(startConversion()) );
stopActionMenu = new KActionMenu( KIcon("process-stop"), i18n("Stop"), this );
stopActionMenu->setDelayed( false );
killAction = new KAction( KIcon("flag-red"), i18n("Stop immediatelly"), this );
stopActionMenu->addAction( killAction );
connect( killAction, SIGNAL(triggered()), fileList, SLOT(killConversion()) );
stopAction = new KAction( KIcon("flag-yellow"), i18n("Stop after current conversions are completed"), this );
stopActionMenu->addAction( stopAction );
connect( stopAction, SIGNAL(triggered()), fileList, SLOT(stopConversion()) );
continueAction = new KAction( KIcon("flag-green"), i18n("Continue after current conversions are completed"), this );
stopActionMenu->addAction( continueAction );
connect( continueAction, SIGNAL(triggered()), fileList, SLOT(continueConversion()) );
queueModeChanged( true );
pStop = new KPushButton( KIcon("process-stop"), i18n("Stop"), this );
pStop->setFixedHeight( pStop->size().height() );
pStop->hide();
stopActionMenu->setEnabled( false );
pStop->setMenu( stopActionMenu->menu() );
addBox->addWidget( pStop, 0, Qt::AlignVCenter );
addBox->addSpacing( fontHeight );
progressIndicator = new ProgressIndicator( this, ProgressIndicator::Feature( ProgressIndicator::FeatureSpeed | ProgressIndicator::FeatureTime ) );
addBox->addWidget( progressIndicator, 0, Qt::AlignVCenter );
connect( progressIndicator, SIGNAL(progressChanged(const QString&)), this, SIGNAL(progressChanged(const QString&)) );
connect( fileList, SIGNAL(timeChanged(float)), progressIndicator, SLOT(timeChanged(float)) );
connect( fileList, SIGNAL(finished(bool)), progressIndicator, SLOT(finished(bool)) );
Convert *convert = new Convert( config, fileList, logger, this );
connect( fileList, SIGNAL(convertItem(FileListItem*)), convert, SLOT(add(FileListItem*)) );
connect( fileList, SIGNAL(killItem(FileListItem*)), convert, SLOT(kill(FileListItem*)) );
connect( fileList, SIGNAL(itemRemoved(FileListItem*)), convert, SLOT(itemRemoved(FileListItem*)) );
connect( convert, SIGNAL(finished(FileListItem*,FileListItem::ReturnCode,bool)), fileList, SLOT(itemFinished(FileListItem*,FileListItem::ReturnCode,bool)) );
connect( convert, SIGNAL(rippingFinished(const QString&)), fileList, SLOT(rippingFinished(const QString&)) );
connect( convert, SIGNAL(finishedProcess(int,bool,bool)), logger, SLOT(processCompleted(int,bool,bool)) );
//.........这里部分代码省略.........
示例6: QGraphicsWidget
RaptorGraphicsWidget::RaptorGraphicsWidget(QGraphicsItem *parent, const KConfigGroup &appletconfig)
: QGraphicsWidget(parent),
d(new Private(this))
{
setAcceptHoverEvents(true);
// d->model = new Kickoff::ApplicationModel(this);
// d->model->init();
if (!Nepomuk::ResourceManager::instance()->init()) {
kDebug() << "fucking nepomuk never dies";
d->model = new Raptor::NepomukModel(this);
} else {
KNotification::event(KNotification::Error, i18n("Nepomuk is not running. Falling back to useless mode!!!"));
d->model = new Kickoff::ApplicationModel(this);
qobject_cast<Kickoff::ApplicationModel*>(d->model)->init();
}
d->searchModel = new Kickoff::SearchModel();
d->favoritesModel = new Kickoff::FavoritesModel(this);
d->view = new RaptorGraphicsView(this);//Initialize the view as first element, some depend on it
d->view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
d->view->setModel(d->model);
// d->view = new RaptorItemsView();
// RaptorItemDelegate *delegate = new RaptorItemDelegate();
d->breadCrumb = new Breadcrumb(d->view, this);
d->searchLine = new Plasma::LineEdit(this);
d->favoritesIcon = new Plasma::IconWidget(this);
d->favoritesIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
d->favoritesIcon->setIcon(KIcon("rating"));
//d->searchLine->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
d->appletConfig = appletconfig;
QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);
QGraphicsLinearLayout *horizontalLayout = new QGraphicsLinearLayout();
horizontalLayout->addItem(d->breadCrumb);
horizontalLayout->addStretch();
horizontalLayout->addItem(d->favoritesIcon);
horizontalLayout->addItem(d->searchLine);
horizontalLayout->setMaximumHeight(Plasma::Theme::defaultTheme()->fontMetrics().height() + 2 * 2);//Set height to font height + some more spaces
verticalLayout->addItem(horizontalLayout);
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
layout->setOrientation(Qt::Horizontal);
layout->addItem(d->view);
verticalLayout->addItem(layout);
setLayout(verticalLayout);
//
// delegate->setTextColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
//
// // let's make the view nicer in the applet
// d->view->setAttribute(Qt::WA_NoSystemBackground);
// d->view->viewport()->setAutoFillBackground(true);
// QPalette p = d->view->viewport()->palette();
// p.setColor(QPalette::Base, Qt::transparent);
// d->view->viewport()->setPalette(p);
//
// d->view->setModel(d->model);
// d->view->setItemDelegate(delegate);
//
// d->view->hideScrollBars();
//
KConfigGroup config(&d->appletConfig, "PlasmaRunnerManager");
KConfigGroup conf(&config, "Plugins");
conf.writeEntry("servicesEnabled", true);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Runner");
foreach (const KService::Ptr &service, offers) {
KPluginInfo description(service);
QString runnerName = description.pluginName();
if (runnerName != "services")
{
conf.writeEntry(QString(runnerName + "Enabled"), false);
}
}
示例7: QWidget
NCSAFindBar::NCSAFindBar( Okular::Document * document, QWidget * parent )
: QWidget( parent )
, m_active( false )
{
doc = document;
if(NULL != doc)
{
doc->addObserver(this);
}
QVBoxLayout * vlay = new QVBoxLayout( this );
QHBoxLayout * displayRow = new QHBoxLayout();
vlay->addLayout( displayRow );
display = new QLabel("");
displayRow->addWidget(display);
displayRow->insertStretch(1);
resultComboBox = new QComboBox();
//resultComboBox->addItems(fonts);
displayRow->addWidget(resultComboBox);
QHBoxLayout * lay = new QHBoxLayout();
vlay->setMargin( 2 );
vlay->addLayout(lay);
QPushButton * optionsBtn = new QPushButton( this );
optionsBtn->setText( i18n( "NCSA Options" ) );
optionsBtn->setToolTip( i18n( "Modify search behavior" ) );
QMenu * optionsMenu = new QMenu( optionsBtn );
m_buildFontAct = optionsMenu->addAction( i18n( "Create custom font" ) );
connect( m_buildFontAct, SIGNAL(triggered(bool)), this, SLOT(buildFontAct(bool)) );
optionsBtn->setMenu( optionsMenu );
lay->addWidget( optionsBtn );
QStringList fonts = QFontDatabase().families();
fontComboBox = new QComboBox();
fontComboBox->addItems(fonts);
lay->addWidget(fontComboBox);
connect( fontComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFont(int)) );
connect( resultComboBox, SIGNAL(highlighted(int)), this, SLOT(resultComboBoxIndexChanged(int)) );
QPalette p(palette());
p.setColor(QPalette::Background, Qt::white);
display->setAutoFillBackground(true);
display->setPalette(p);
display->setText("Lalala");
QFont font;
font.setPointSize(32);
font.setBold(true);
font.setFamily(fonts.at(16));
display->setFont(font);
searchLine = new QLineEdit();
lay->addWidget(searchLine);
connect(searchLine,SIGNAL(textChanged(QString)),this,SLOT(searchLineTextChanged(QString)));
hide();
QPushButton * searchBtn = new QPushButton( KIcon( "Search" ), i18nc( "Search using word spotting technique", "search" ), this );
searchBtn->setToolTip( i18n( "Search using word spotting technique" ) );
lay->addWidget( searchBtn );
connect( searchBtn, SIGNAL(clicked()), this, SLOT(performSearch()) );
// "activate" it only at th very end
m_active = true;
wordSpottingUtil = NULL;
}
示例8: DockIcon
DockTaskIcon::DockTaskIcon(DockApp *app, QGraphicsItem *parent)
: DockIcon(parent), m_app(app)
{
setDragable(true);
setIcon(KIcon(app->icon()));
}
示例9: setBackgroundHints
void JobViewServer::setupUi() {
// Paar allgemeine Parameter
setBackgroundHints(DefaultBackground);
setHasConfigurationInterface(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
resize(400, 80);
// Rahmen, der das Hauptlayout enthält
Plasma::Frame* frame = new Plasma::Frame();
frame->setFrameShadow(Plasma::Frame::Sunken);
QGraphicsLinearLayout* fullSpaceLayout = new QGraphicsLinearLayout();
fullSpaceLayout->setContentsMargins(0,0,0,0);
setLayout(fullSpaceLayout);
fullSpaceLayout->addItem(frame);
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout();
layout->setContentsMargins(0,0,0,0);
frame->setLayout(layout);
// Icon mit History und Queue Indicator
iconWidget = new Plasma::IconWidget();
iconWidget->setPreferredWidth(25);
iconWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
iconWidget->setIcon(KIcon("arrow-down"));
layout->addItem(iconWidget);
// Layout mit Progressbars
meterContainer = new Plasma::Label();
meterContainer->nativeWidget()->setWordWrap(true);
meterLayout = new QGraphicsLinearLayout();
meterContainer->setLayout(meterLayout);
layout->addItem(meterContainer);
// Popup erzeugen
popup = new Plasma::Dialog();
QVBoxLayout* popupLayout = new QVBoxLayout();
popupLayout->setContentsMargins(0,0,0,0);
popup->setLayout(popupLayout);
popup->setWindowFlags(Qt::Popup);
popup->resize(400, 300);
// GraphicsView und GraphicsScene erzeugen
QGraphicsScene* popupScene = new QGraphicsScene();
QGraphicsView* popupView = new QGraphicsView();
popupView->setScene(popupScene);
popupView->setFrameStyle(QFrame::NoFrame);
popupView->setStyleSheet("background-color: transparent;");
popupView->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
popupView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
popupView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
popupLayout->addWidget(popupView);
// Container mit dem GridLayout zur Scene hinzufügen
jobViewContainer = new QGraphicsWidget();
jobViewLayout = new QGraphicsLinearLayout(Qt::Vertical);
jobViewLayout->setContentsMargins(5,5,5,5);
jobViewContainer->setLayout(jobViewLayout);
popupScene->addItem(jobViewContainer);
// Überschrift-/Nachrichtenbereich
popupHeadline = new Plasma::Label();
popupHeadline->nativeWidget()->setAlignment(Qt::AlignCenter);
jobViewLayout->addItem(popupHeadline);
QObject::connect(iconWidget, SIGNAL(clicked()), this, SLOT(showPopup()));
}
示例10: Q_ASSERT
void KonqPopupMenuPrivate::init(KonqPopupMenu::Flags kpf, KParts::BrowserExtension::PopupFlags flags)
{
m_itemFlags = flags;
q->setFont(KGlobalSettings::menuFont());
Q_ASSERT(m_popupItemProperties.items().count() >= 1);
bool bTrashIncluded = false;
const KFileItemList lstItems = m_popupItemProperties.items();
KFileItemList::const_iterator it = lstItems.constBegin();
const KFileItemList::const_iterator kend = lstItems.constEnd();
for ( ; it != kend; ++it )
{
const KUrl url = (*it).url();
if ( !bTrashIncluded && (
( url.protocol() == "trash" && url.path().length() <= 1 ) ) ) {
bTrashIncluded = true;
}
}
const bool isDirectory = m_popupItemProperties.isDirectory();
const bool sReading = m_popupItemProperties.supportsReading();
bool sDeleting = (m_itemFlags & KParts::BrowserExtension::NoDeletion) == 0
&& m_popupItemProperties.supportsDeleting();
const bool sWriting = m_popupItemProperties.supportsWriting();
const bool sMoving = sDeleting && m_popupItemProperties.supportsMoving();
const bool isLocal = m_popupItemProperties.isLocal();
KUrl url = m_sViewURL;
url.cleanPath();
bool isTrashLink = false;
bool isCurrentTrash = false;
bool currentDir = false;
bool isSymLink = false;
bool isSymLinkInSameDir = false; // true for "ln -s foo bar", false for links to foo/sub or /foo
//check if url is current directory
if ( lstItems.count() == 1 )
{
KFileItem firstPopupItem( lstItems.first() );
if (firstPopupItem.isLink()) {
isSymLink = true;
isSymLinkInSameDir = !firstPopupItem.linkDest().contains('/');
}
KUrl firstPopupURL( firstPopupItem.url() );
firstPopupURL.cleanPath();
//kDebug(1203) << "View path is " << url.url();
//kDebug(1203) << "First popup path is " << firstPopupURL.url();
currentDir = firstPopupURL.equals( url, KUrl::CompareWithoutTrailingSlash );
if ( firstPopupItem.isDesktopFile() ) {
KDesktopFile desktopFile( firstPopupItem.localPath() );
const KConfigGroup cfg = desktopFile.desktopGroup();
isTrashLink = ( cfg.readEntry("Type") == "Link" && cfg.readEntry("URL") == "trash:/" );
}
if (isTrashLink) {
sDeleting = false;
}
// isCurrentTrash: popup on trash:/ itself, or on the trash.desktop link
isCurrentTrash = (firstPopupURL.protocol() == "trash" && firstPopupURL.path().length() <= 1)
|| isTrashLink;
}
const bool isIntoTrash = (url.protocol() == "trash") && !isCurrentTrash; // trashed file, not trash:/ itself
const bool bIsLink = (m_itemFlags & KParts::BrowserExtension::IsLink);
//kDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " bTrashIncluded=" << bTrashIncluded;
//////////////////////////////////////////////////////////////////////////
addGroup( "topactions" ); // used e.g. for ShowMenuBar. includes a separator at the end
KAction * act;
KAction *actNewWindow = 0;
#if 0 // TODO in the desktop code itself.
if (( flags & KParts::BrowserExtension::ShowProperties ) && isOnDesktop &&
!KAuthorized::authorizeKAction("editable_desktop_icons"))
{
flags &= ~KParts::BrowserExtension::ShowProperties; // remove flag
}
#endif
// Either 'newview' is in the actions we're given (probably in the tabhandling group)
// or we need to insert it ourselves (e.g. for the desktop).
// In the first case, actNewWindow must remain 0.
if ( ((kpf & KonqPopupMenu::ShowNewWindow) != 0) && sReading )
{
const QString openStr = i18n("&Open");
actNewWindow = new KAction(m_parentWidget /*for status tips*/);
m_ownActions.append(actNewWindow);
actNewWindow->setIcon( KIcon("window-new") );
actNewWindow->setText( openStr );
QObject::connect(actNewWindow, SIGNAL(triggered()), q, SLOT(slotPopupNewView()));
}
//.........这里部分代码省略.........
示例11: KIcon
/*!
Returns an icon to be used in the project explorer.
*/
QIcon Datapicker::icon() const {
return KIcon("color-picker-black");
}
示例12: kScreenSaverMain
int kScreenSaverMain( int argc, char** argv, KScreenSaverInterface& screenSaverInterface )
{
KLocale::setMainCatalog("libkscreensaver");
KCmdLineArgs::init(argc, argv, screenSaverInterface.aboutData());
KCmdLineOptions options;
options.add("setup", ki18n("Setup screen saver"));
options.add("window-id wid", ki18n("Run in the specified XWindow"));
options.add("root", ki18n("Run in the root XWindow"));
options.add("demo", ki18n("Start screen saver in demo mode"), "default");
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// Set a useful default icon.
app.setWindowIcon(KIcon("preferences-desktop-screensaver"));
if (!pipe(termPipe))
{
#ifndef Q_WS_WIN
struct sigaction sa;
sa.sa_handler = termHandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGTERM, &sa, 0);
#endif
QSocketNotifier *sn = new QSocketNotifier(termPipe[0], QSocketNotifier::Read, &app);
QObject::connect(sn, SIGNAL(activated(int)), &app, SLOT(quit()));
}
#ifdef Q_WS_X11
oldXErrorHandler = XSetErrorHandler(xErrorHandler);
#endif
KCrash::setCrashHandler( crashHandler );
KGlobal::locale()->insertCatalog("klock");
KGlobal::locale()->insertCatalog("kscreensaver");
DemoWindow *demoWidget = 0;
Window saveWin = 0;
KScreenSaver *target;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("setup"))
{
QDialog *dlg = screenSaverInterface.setup();
args->clear();
dlg->exec();
delete dlg;
return 0;
}
if (args->isSet("window-id"))
{
#ifdef Q_WS_WIN
saveWin = (HWND)(args->getOption("window-id").toULong());
#else
saveWin = args->getOption("window-id").toInt();
#endif
}
#ifdef Q_WS_X11 //FIXME
if (args->isSet("root"))
{
QX11Info inf;
saveWin = RootWindow(QX11Info::display(), inf.screen());
}
#endif
if (args->isSet("demo"))
{
saveWin = 0;
}
if (saveWin == 0)
{
demoWidget = new DemoWindow();
demoWidget->setAttribute(Qt::WA_NoSystemBackground);
demoWidget->setAttribute(Qt::WA_PaintOnScreen);
demoWidget->show();
app.processEvents();
saveWin = demoWidget->winId();
}
target = screenSaverInterface.create( saveWin );
target->setAttribute(Qt::WA_PaintOnScreen);
target->show();
if (demoWidget)
{
target->installEventFilter( demoWidget );
}
//.........这里部分代码省略.........
示例13: sep
//.........这里部分代码省略.........
QTreeWidgetItem *fitem; //nuovo elemento da allocare in lista
QTreeWidgetItem *tmpItem; //puntatore a elemento temporaneo
bool foldFound = false; //se ho trovato l'elemento...
bool itemFound = false;
for ( int j = 0; j < singleItem.size(); j++ ) {//per ogni cartella ramifico...
itemFound = false;
foldFound = false;
//-------------------queste operazioni avvengono solo ed esclusivamente al primo ciclo---------------------//
if ( j == 0 ) { //se e' il primo ciclo limitiamo la ricerca ai top level items
for ( int c = 0; c < listv -> topLevelItemCount(); c++ ) { //se trovo l'elemento tra i top level setto il current
if ( ( listv -> topLevelItem ( c ) ) -> text ( 0 ) == singleItem[j] ) {
tmpItem = listv -> topLevelItem ( c );
foldFound = true;
break; //se ho trovato l'elemento è inutile continuare il ciclo
}
}
if ( foldFound == false ) { //altrimenti alloco in lista in topLevel.. Questo accade anche se non è stato eseguito nessun ciclo
fitem = new QTreeWidgetItem ( listv );
fitem -> setText ( 0, singleItem[j] );
tmpItem = fitem;
}
}
else { //------------------queste operazioni avvengono per tutti gli altri cicli-------------------//
//cerco ciò che mi interessa tra i child dell currentItem() attuale
for ( int c=0; c < tmpItem -> childCount(); c++ ) {
if ( tmpItem->child ( c ) -> text ( 0 ) == singleItem[j] ) {
tmpItem = tmpItem->child ( c ); //se lo trovo setto il current item
itemFound = true;
break; //se ho trovato l'elemento è inutile continuare il ciclo
}
}
if (( itemFound == false ) && (!singleItem[j].isEmpty())) { //altrimenti alloco e setto il currentItem
fitem = new QTreeWidgetItem ( tmpItem );
fitem -> setText ( 0, singleItem[j] );
tmpItem = fitem;
}
}
}
//flist[i].remove(62, flist[i].size());
QStringList dlist = (flist.at(i)).split(" ", QString::SkipEmptyParts ); // generiamo una lista contenente i parametri dei file
//puts(dlist[4].toAscii() + dlist[6].toAscii());
//if (!((dlist[6] == "stor") && (dlist[4] == "bx"))) { //è inutile scrivere gli attributi della cartella
// provo a vedere se basta leggere la "d" dai permessi per individuare una cartella invece di un controllo
// fatto nella riga precedente.
if (dlist[0][0] != QChar('d')) {
fitem -> setText(4, dlist[7] + " " + dlist[8]); // modified
QString size = KLocale( QString() ).formatByteSize(dlist[3].toDouble()); // 3 -> dimensione originale del file
fitem -> setText(1, size);
size = KLocale( QString() ).formatByteSize(dlist[5].toDouble()); // 5 -> dimensione packed del file
fitem -> setText(2, size);
fitem -> setText(5, dlist[0]); // attributi
fitem -> setText(7, dlist[4] + " " + dlist[6]); // metodo
if ((dlist[4][0] == QChar('B')) || (dlist[4][0] == QChar('T'))) crypted = true;
else crypted = false;
fitem -> setText(8, dlist[1] + " " + dlist[2]); // version and so
// calcolo il ratio
float ratio = 0;
if (dlist[3].toInt() != 0) {
ratio = (100.0 * dlist[5].toFloat() / dlist[3].toFloat());
ratio = abs(ratio - 100);
}
fitem -> setText(3, QString().setNum(ratio) + "%");
// // akuRatioWidget *ratioWidget = new akuRatioWidget(ratio);
// // listv -> setItemWidget(fitem, 3, ratioWidget);
//
fitem -> setTextAlignment ( 1, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 2, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 3, Qt::AlignHCenter | Qt::AlignVCenter );
fitem -> setTextAlignment ( 5, Qt::AlignHCenter | Qt::AlignVCenter );
fitem -> setTextAlignment ( 7, Qt::AlignRight | Qt::AlignVCenter );
fitem -> setTextAlignment ( 8, Qt::AlignCenter | Qt::AlignVCenter );
KMimeType::Ptr mimePtr = KMimeType::findByUrl(KUrl(singleItem[numeroPezziPercorso]));
KIcon icon(mimePtr -> iconName());
fitem -> setIcon (0, icon);
fitem -> setText(9, mimePtr->name());
}
if (crypted == true) {
fitem -> setIcon(10, KIcon("dialog-password"));
fileswithpass = true;
}
}
QStringList archinfo;
archinfo = lastline.split ( " ", QString::SkipEmptyParts );
archiveDetails << archinfo[0] << KLocale(archinfo[2] ).formatByteSize(archinfo[2].toULong()) << KLocale(archinfo[5] ).formatByteSize(archinfo[5].toULong());
QString ratio = archinfo.at (8);
ratio.remove (ratio.length() - 1, 1);
ratioBar -> setRatio (int(ratio.toFloat() + 0.5f));
return fileswithpass;
}
示例14: load
void ContactsKopete::updateContactData(const QString & contact)
{
if (d->noOnlineContacts) {
load(true);
return;
}
// Retrieving contact name
QDBusReply < QString > contactName = d->interface->getDisplayName(contact);
if (!contactName.isValid()) {
return;
}
QDBusReply < QVariantMap > contactProperties = d->interface->contactProperties(contact);
if (!contactProperties.isValid() || contactProperties.value().size() == 0) {
return;
}
QDBusReply < bool > contactOnline = d->interface->isContactOnline(contact);
if (!contactOnline.isValid()) {
return;
}
QString avatarPath = contactProperties.value().value("picture").toString();
avatarPath = KUrl(avatarPath).toLocalFile();
if (avatarPath.isEmpty()) {
avatarPath = "user-online";
}
kDebug() << "avatarPath" << avatarPath;
QString status = contactProperties.value().value("status_message").toString();
if (status.isEmpty()) {
status = contactProperties.value().value("status").toString();
}
int index;
for (index = 0; index < size(); index++) {
if (itemAt(index).data == contact) {
break;
}
}
if (index >= size()) {
// we don't have this contact in the list
if (contactOnline.value()) {
add(
contactProperties.value().value("display_name").toString(),
status,
KIcon(avatarPath),
contact);
}
} else {
// we already have this contact
if (contactOnline.value()) {
// we are updating the contact
set(index,
contactProperties.value().value("display_name").toString(),
status,
KIcon(avatarPath),
contact);
} else {
// we are removing the contact from the list
removeAt(index);
if (size() == 0) {
d->noOnlineContacts = true;
add(i18n("No online contacts"), "", KIcon("user-offline"), QVariant());
}
}
}
}
示例15: actionCollection
void MainWindow::setupActions()
{
KAction *newDownloadAction = actionCollection()->addAction("new_download");
newDownloadAction->setText(i18n("&New Download..."));
newDownloadAction->setIcon(KIcon("document-new"));
newDownloadAction->setShortcuts(KShortcut("Ctrl+N"));
newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the list"));
connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer()));
KAction *openAction = actionCollection()->addAction("import_transfers");
openAction->setText(i18n("&Import Transfers..."));
openAction->setIcon(KIcon("document-open"));
openAction->setShortcuts(KShortcut("Ctrl+I"));
openAction->setHelpText(i18n("Imports a list of transfers"));
connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers()));
KAction *exportAction = actionCollection()->addAction("export_transfers");
exportAction->setText(i18n("&Export Transfers List..."));
exportAction->setIcon(KIcon("document-export"));
exportAction->setShortcuts(KShortcut("Ctrl+E"));
exportAction->setHelpText(i18n("Exports the current transfers into a file"));
connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers()));
KAction *createMetalinkAction = actionCollection()->addAction("create_metalink");
createMetalinkAction->setText(i18n("&Create a Metalink..."));
createMetalinkAction->setIcon(KIcon("journal-new"));
createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves it on disk"));
connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink()));
KAction *priorityTop = actionCollection()->addAction("priority_top");
priorityTop->setText(i18n("Top Priority"));
priorityTop->setIcon(KIcon("arrow-up-double"));
priorityTop->setShortcuts(KShortcut("Ctrl+PgUp"));
priorityTop->setHelpText(i18n("Download selected transfer first"));
connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop()));
KAction *priorityBottom = actionCollection()->addAction("priority_bottom");
priorityBottom->setText(i18n("Least Priority"));
priorityBottom->setIcon(KIcon("arrow-down-double"));
priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown"));
priorityBottom->setHelpText(i18n("Download selected transfer last"));
connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom()));
KAction *priorityUp = actionCollection()->addAction("priority_up");
priorityUp->setText(i18n("Increase Priority"));
priorityUp->setIcon(KIcon("arrow-up"));
priorityUp->setShortcuts(KShortcut("Ctrl+Up"));
priorityUp->setHelpText(i18n("Increase priority for selected transfer"));
connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp()));
KAction *priorityDown = actionCollection()->addAction("priority_down");
priorityDown->setText(i18n("Decrease Priority"));
priorityDown->setIcon(KIcon("arrow-down"));
priorityDown->setShortcuts(KShortcut("Ctrl+Down"));
priorityDown->setHelpText(i18n("Decrease priority for selected transfer"));
connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown()));
//FIXME: Not needed maybe because the normal delete already deletes groups?
KAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
deleteGroupAction->setText(i18n("Delete Group"));
deleteGroupAction->setIcon(KIcon("edit-delete"));
deleteGroupAction->setHelpText(i18n("Delete selected group"));
connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup()));
KAction *renameGroupAction = actionCollection()->addAction("rename_groups");
renameGroupAction->setText(i18n("Rename Group..."));
renameGroupAction->setIcon(KIcon("edit-rename"));
connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup()));
KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups");
setIconGroupAction->setText(i18n("Set Icon..."));
setIconGroupAction->setIcon(KIcon("preferences-desktop-icons"));
setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected group"));
connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup()));
m_autoPasteAction = new KToggleAction(KIcon("edit-paste"),
i18n("Auto-Paste Mode"), actionCollection());
actionCollection()->addAction("auto_paste", m_autoPasteAction);
m_autoPasteAction->setChecked(Settings::autoPaste());
m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode "
"on and off.\nWhen set, KGet will periodically scan "
"the clipboard for URLs and paste them automatically."));
connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste()));
m_konquerorIntegration = new KToggleAction(KIcon("konqueror"),
i18n("Use KGet as Konqueror Download Manager"), actionCollection());
actionCollection()->addAction("konqueror_integration", m_konquerorIntegration);
connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool)));
m_konquerorIntegration->setChecked(Settings::konquerorIntegration());
// local - Destroys all sub-windows and exits
KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
// local - Standard configure actions
KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection());
KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection());
m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection());
m_menubarAction->setChecked(!menuBar()->isHidden());
// Transfer related actions
//.........这里部分代码省略.........