예제 #1
0
QIconSet menuIconSet(const QString& icon)
{
    QIconSet iconset;
    int iconSize = KickerSettings::menuEntryHeight();

    if (iconSize < 0)
    {
        return iconset;
    }

    if (icon != "unknown")
    {
        if (iconSize > 0)
        {
            iconset = KGlobal::iconLoader()->loadIconSet(icon,
                                                     KIcon::NoGroup,
                                                     iconSize, true);
        }
        else if (iconSize == 0)
        {
            QPixmap normal = KGlobal::iconLoader()->loadIcon(icon,
                                                         KIcon::Small,
                                                         0,
                                                         KIcon::DefaultState,
                                                         0,
                                                         true);

            QPixmap active = KGlobal::iconLoader()->loadIcon(icon,
                                                         KIcon::Small,
                                                         0,
                                                         KIcon::ActiveState,
                                                         0,
                                                         true);

            // make sure they are not larger than 20x20
            if (normal.width() > 20 || normal.height() > 20)
            {
                normal.convertFromImage(normal.convertToImage().smoothScale(20,20));
            }

            if (active.width() > 20 || active.height() > 20)
            {
                active.convertFromImage(active.convertToImage().smoothScale(20,20));
            }

            iconset.setPixmap(normal, QIconSet::Small, QIconSet::Normal);
            iconset.setPixmap(active, QIconSet::Small, QIconSet::Active);
        }
    }

    if (iconset.isNull())
    {
        QPixmap pix(iconSize, iconSize);
        QBitmap map(iconSize, iconSize, true);
        pix.setMask(map);
        iconset = QIconSet(pix, pix);
    }

    return iconset;
}
예제 #2
0
KReferDialog::KReferDialog( KPhoneView * phv,int kcwn,QString uPrefix,QWidget *parent, const char *name )
	: QDialog( parent, name, true )
{
	phoneView=phv;
	kcwNumber= kcwn;
	userPrefix=uPrefix;
	
	phoneBook = 0;
	
	QVBox *vbox = new QVBox( this );
	vbox->setMargin( 3 );
	vbox->setSpacing( 3 );
	QVBoxLayout *vboxl = new QVBoxLayout( this, 5 );
	vboxl->addWidget( vbox );

	(void) new QLabel( tr("Refer-to URI:"), vbox );
	touri = new QLineEdit( vbox );
	touri->setMinimumWidth( fontMetrics().maxWidth() * 20 );
	
	
	QHBoxLayout *buttonBox;
	buttonBox = new QHBoxLayout( vboxl, 6 );
	
	loadUri = new QPushButton( "", this );	
	QIconSet icon;
	icon.setPixmap(SHARE_DIR "/icons/phonebook.png", QIconSet::Automatic );
	loadUri->setIconSet( icon );
	loadUri->setFixedWidth( loadUri->fontMetrics().maxWidth() * 2 );
	buttonBox->addWidget( loadUri );
	
	helpPushButton = new QPushButton( this, tr("help button") );
	helpPushButton->setText( tr("&help...") );
	helpPushButton->setEnabled( FALSE );
	buttonBox->addWidget( helpPushButton );
	
	QSpacerItem *spacer = new QSpacerItem(
		0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
	buttonBox->addItem( spacer );
	okPushButton = new QPushButton( this, tr("ok button") );
	okPushButton->setText( "OK" );
	okPushButton->setDefault( TRUE );
	buttonBox->addWidget( okPushButton );
	
	cancelPushButton = new QPushButton( this,tr( "cancel button") );
	cancelPushButton->setText( tr("Cancel") );
	cancelPushButton->setAccel( Key_Escape );
	buttonBox->addWidget( cancelPushButton );
	
	connect( loadUri, SIGNAL( clicked() ), 
		this, SLOT( getUri() ) );
	connect( okPushButton, SIGNAL( clicked() ),
		this, SLOT( slotOk() ) );
	connect( cancelPushButton, SIGNAL( clicked() ),
		this, SLOT( slotCancel() ) );
}
예제 #3
0
CToolButton::CToolButton( const QIconSet & pOff, const QPixmap & pOn, const QString & textLabel,
                          const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent,
                          const char * name)
        : QToolButton(pOff, textLabel, grouptext, receiver, slot, parent, name)
{
    popup = NULL;
#if QT_VERSION < 300
    setOnIconSet(pOn);
#else
    QIconSet icon = pOff;
    icon.setPixmap(pOn, QIconSet::Small, QIconSet::Normal, QIconSet::On);
    setIconSet(icon);
#endif
}
예제 #4
0
///// getIconSet //////////////////////////////////////////////////////////////
QIconSet IconSets::getIconSet(const IconSetID id)
/// Returns the icon set associated with the given id.
{
  initialize();
  QIconSet result;

  if(id == Open)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenNormal)), QIconSet::Automatic);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }
  else if(id == Save)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveNormal)), QIconSet::Automatic, QIconSet::Normal);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveDisabled)), QIconSet::Automatic, QIconSet::Disabled);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }
  else if(id == Prefs)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsNormal)), QIconSet::Automatic);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }
  else if(id == Image)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageNormal)), QIconSet::Automatic, QIconSet::Normal);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageDisabled)), QIconSet::Automatic, QIconSet::Disabled);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }
  else if(id == Help)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpNormal)), QIconSet::Automatic);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }
  else if(id == WhatsThis)
  {
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisNormal)), QIconSet::Automatic);
    result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisActive)), QIconSet::Large, QIconSet::Active);
    result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active);
  }

  return result;
}
예제 #5
0
void Kooka::setupActions()
{

    KStdAction::print(this, SLOT(filePrint()), actionCollection());
    KStdAction::quit(this , SLOT(close()), actionCollection());

    KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), 
actionCollection());
    KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()),
				  actionCollection());
    KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());

    m_view->createDockMenu(actionCollection(), this, "settings_show_docks" );

    /* Image Viewer action Toolbar - OCR, Scaling etc. */
    (void) new KAction(i18n("&OCR Image..."), "ocr", CTRL+Key_O,
		       m_view, SLOT(doOCR()),
		       actionCollection(), "ocrImage" );

    (void) new KAction(i18n("O&CR on Selection..."), "ocr-select", CTRL+Key_C,
		       m_view, SLOT(doOCRonSelection()),
		       actionCollection(), "ocrImageSelect" );

    KAction *act;
    act =  new KAction(i18n("Scale to W&idth"), "scaletowidth", CTRL+Key_I,
		       m_view, SLOT( slIVScaleToWidth()),
		       actionCollection(), "scaleToWidth" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Scale to &Height"), "scaletoheight", CTRL+Key_H,
		       m_view, SLOT( slIVScaleToHeight()),
		       actionCollection(), "scaleToHeight" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Original &Size"), "scaleorig", CTRL+Key_S,
                      m_view, SLOT( slIVScaleOriginal()),
                      actionCollection(), "scaleOriginal" );
    m_view->connectViewerAction( act );

#ifdef QICONSET_HONOUR_ON_OFF
    /* The Toggleaction does not seem to handle the on/off icon from QIconSet */
    QIconSet lockSet;
    lockSet.setPixmap(BarIcon("lock")  , QIconSet::Automatic, QIconSet::Normal, QIconSet::On );
    lockSet.setPixmap(BarIcon("unlock"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
    act = new KToggleAction ( i18n("Keep &Zoom Setting"), lockSet, CTRL+Key_Z,
                              actionCollection(), "keepZoom" );
#else
    act = new KToggleAction( i18n("Keep &Zoom Setting"), BarIcon("lockzoom"), CTRL+Key_Z,
                             actionCollection(), "keepZoom" );
#endif

    connect( act, SIGNAL( toggled( bool ) ), m_view->getImageViewer(),
             SLOT(setKeepZoom(bool)));

    m_view->connectViewerAction( act );

    /* thumbview and gallery actions */
    act = new KAction(i18n("Set Zoom..."), "viewmag", 0,
		       m_view, SLOT( slIVShowZoomDialog()),
		       actionCollection(), "showZoomDialog" );
    m_view->connectViewerAction( act );

    (void) new KAction(i18n("Create From Selectio&n"), "crop", CTRL+Key_N,
		       m_view, SLOT( slCreateNewImgFromSelection() ),
		       actionCollection(), "createFromSelection" );

    (void) new KAction(i18n("Mirror Image &Vertically"), "mirror-vert", CTRL+Key_V,
		       this, SLOT( slMirrorVertical() ),
		       actionCollection(), "mirrorVertical" );

    (void) new KAction(i18n("&Mirror Image Horizontally"), "mirror-horiz", CTRL+Key_M,
		       this, SLOT( slMirrorHorizontal() ),
		       actionCollection(), "mirrorHorizontal" );

    (void) new KAction(i18n("Mirror Image &Both Directions"), "mirror-both", CTRL+Key_B,
		       this, SLOT( slMirrorBoth() ),
		       actionCollection(), "mirrorBoth" );

    (void) new KAction(i18n("Open Image in &Graphic Application..."), "fileopen", CTRL+Key_G,
		       m_view, SLOT( slOpenCurrInGraphApp() ),
		       actionCollection(), "openInGraphApp" );

    act = new KAction(i18n("&Rotate Image Clockwise"), "rotate_cw", CTRL+Key_R,
		      this, SLOT( slRotateClockWise() ),
		       actionCollection(), "rotateClockwise" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Rotate Image Counter-Clock&wise"), "rotate_ccw", CTRL+Key_W,
		       this, SLOT( slRotateCounterClockWise() ),
		       actionCollection(), "rotateCounterClockwise" );
    m_view->connectViewerAction( act );

    act = new KAction(i18n("Rotate Image 180 &Degrees"), "rotate", CTRL+Key_D,
		       this, SLOT( slRotate180() ),
		       actionCollection(), "upsitedown" );
    m_view->connectViewerAction( act );

    /* Gallery actions */
    act = new KAction(i18n("&Create Folder..."), "folder_new", 0,
		      m_view->gallery(), SLOT( slotCreateFolder() ),
		       actionCollection(), "foldernew" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Save Image..."), "filesave", 0,
		      m_view->gallery(), SLOT( slotExportFile() ),
		       actionCollection(), "saveImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Import Image..."), "inline_image", 0,
		      m_view->gallery(), SLOT( slotImportFile() ),
		       actionCollection(), "importImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Delete Image"), "edittrash", 0,
		      m_view->gallery(), SLOT( slotDeleteItems() ),
		       actionCollection(), "deleteImage" );
    m_view->connectGalleryAction( act );

    act = new KAction(i18n("&Unload Image"), "fileclose", 0,
		      m_view->gallery(), SLOT( slotUnloadItems() ),
		       actionCollection(), "unloadImage" );
    m_view->connectGalleryAction( act );

#if 0
    /* not yet supported actions - coming post 3.1 */
    (void) new KAction(i18n("&Load Scan Parameters"), "bookmark_add", CTRL+Key_L,
                       m_view, SLOT(slLoadScanParams()),
                       actionCollection(), "loadscanparam" );

    (void) new KAction(i18n("Save &Scan Parameters"), "bookmark_add", CTRL+Key_S,
		       m_view, SLOT(slSaveScanParams()),
		       actionCollection(), "savescanparam" );
#endif

    (void) new KAction(i18n("Select Scan Device"), "scanner", 0,
		       m_view, SLOT( slSelectDevice()),
		       actionCollection(), "selectsource" );

    (void) new KAction( i18n("Enable All Warnings && Messages"), 0,
			this,  SLOT(slEnableWarnings()),
			actionCollection(), "enable_msgs");


    m_saveOCRTextAction = new KAction( i18n("Save OCR Res&ult Text"), "filesaveas", CTRL+Key_U,
                                       m_view, SLOT(slSaveOCRResult()),
                                       actionCollection(), "saveOCRResult");
}