static QIcon themedMessageBoxIcon(QMessageBox::Icon icon) { const char *icon_name = 0; switch (icon) { case QMessageBox::NoIcon: return QIcon(); break; case QMessageBox::Information: icon_name = koIconNameCStr("dialog-information"); break; case QMessageBox::Warning: icon_name = koIconNameCStr("dialog-warning"); break; case QMessageBox::Critical: icon_name = koIconNameCStr("dialog-error"); break; default: break; } QIcon ret = KIconLoader::global()->loadIcon(QLatin1String(icon_name), KIconLoader::NoGroup, KIconLoader::SizeHuge, KIconLoader::DefaultState, QStringList(), 0, true); if (ret.isNull()) { return QMessageBox::standardIcon(icon); } else { return ret; } }
KarbonPatternToolFactory::KarbonPatternToolFactory() : KoToolFactoryBase("KarbonPatternTool") { setToolTip(i18n("Pattern editing")); setSection(mainToolType()); setIconName(koIconNameCStr("pattern")); setPriority(8); }
SpiralShapeFactory::SpiralShapeFactory() : KoShapeFactoryBase(SpiralShapeId, QObject::tr("Spiral")) { setToolTip(QObject::tr("A spiral shape")); setIconName(koIconNameCStr("spiral-shape")); setFamily("geometric"); setLoadingPriority(1); }
KarbonFilterEffectsToolFactory::KarbonFilterEffectsToolFactory() : KoToolFactoryBase("KarbonFilterEffectsTool") { setToolTip(i18n("Filter effects editing")); setToolType("karbon,krita"); setIconName(koIconNameCStr("tool_imageeffects")); // TODO: better icon, e.g. black Fx bad on dark UI setPriority(3); }
ArtisticTextShapeFactory::ArtisticTextShapeFactory() : KoShapeFactoryBase(ArtisticTextShapeID, i18n("ArtisticTextShape")) { setToolTip(i18n("A shape which shows a single text line")); setIconName(koIconNameCStr("x-shape-text")); setLoadingPriority( 5 ); setXmlElementNames(KoXmlNS::svg, QStringList("text")); }
WebToolFactory::WebToolFactory() : KoToolFactoryBase("WebToolFactoryID") { setToolTip(i18n("Web shape editing")); setToolType(dynamicToolType()); setIconName(koIconNameCStr("applications-internet")); setPriority(1); setActivationShapeId(WEBSHAPEID); }
KoConnectionShapeFactory::KoConnectionShapeFactory() : KoShapeFactoryBase(KOCONNECTIONSHAPEID, i18n("Tie")) { setToolTip(i18n("A connection between two other shapes")); setIconName(koIconNameCStr("x-shape-connection")); setXmlElementNames(KoXmlNS::draw, QStringList("connector")); setLoadingPriority(1); setHidden(true); // Don't show this shape in collections. Only ConnectionTool should create }
KoPathToolFactory::KoPathToolFactory() : KoToolFactoryBase("PathToolFactoryId") { setToolTip(i18n("Path editing")); setToolType(dynamicToolType()); setIconName(koIconNameCStr("editpath")); setPriority(2); setActivationShapeId(KoPathShapeId); }
StateToolFactory::StateToolFactory() : KoToolFactoryBase("StateToolFactoryID") { setToolTip(i18n("State Tool")); setToolType(dynamicToolType()); setIconName(koIconNameCStr("statetool")); setPriority(1); setActivationShapeId(STATESHAPEID); }
KoCreatePathToolFactory::KoCreatePathToolFactory() : KoToolFactoryBase(KoCreatePathTool_ID) { setToolTip(QObject::tr("Create Path")); setToolType(mainToolType()); setPriority(2); setIconName(koIconNameCStr("createpath")); setActivationShapeId("flake/edit"); }
SimpleEntryToolFactory::SimpleEntryToolFactory() : KoToolFactoryBase("SimpleEntryToolFactoryId") { setToolTip( i18n( "Music editing" ) ); setIconName(koIconNameCStr("music-note-16th")); setToolType( dynamicToolType() ); setPriority( 1 ); setActivationShapeId( MusicShapeId ); }
KoZoomToolFactory::KoZoomToolFactory() : KoToolFactoryBase("ZoomTool") { setToolTip(i18n("Zoom")); setSection(navigationToolType()); setPriority(0); setIconName(koIconNameCStr("tool_zoom")); setActivationShapeId("flake/always"); }
KoPanToolFactory::KoPanToolFactory() : KoToolFactoryBase(KoPanTool_ID) { setToolTip(QObject::tr("Pan")); setToolType(navigationToolType()); setPriority(5); setIconName(koIconNameCStr("hand")); setActivationShapeId("flake/always"); }
KexiRelationDesignFactory::KexiRelationDesignFactory() : KoShapeFactoryBase("KexiRelationDesignShape", i18n("Kexi Relation Design")) { setToolTip(i18n("A kexi relation design shape")); setIconName(koIconNameCStr("calligrakexi")); setXmlElementNames("http://www.calligra.org/kexirelationdesign", QStringList("shape")); setLoadingPriority(1); }
KarbonCalligraphyToolFactory::KarbonCalligraphyToolFactory() : KoToolFactoryBase("KarbonCalligraphyTool") { setToolTip(i18n("Calligraphy")); setToolType("karbon,krita"); setIconName(koIconNameCStr("calligraphy")); setPriority(3); setActivationShapeId("flake/edit"); }
TextToolFactory::TextToolFactory() : KoToolFactoryBase("TextTool") { setToolTip(i18n("Text editing")); setToolType(dynamicToolType()+",calligrawords,calligraauthor"); setIconName(koIconNameCStr("tool-text")); setPriority(1); setActivationShapeId(TextShape_SHAPEID "," AnnotationShape_SHAPEID); }
KWPageToolFactory::KWPageToolFactory() : KoToolFactoryBase("PageToolFactory_ID") { setToolTip(i18n("Page layout")); setToolType(dynamicToolType()+",calligrawords, calligraauthor"); setIconName(koIconNameCStr("tool_pagelayout")); setPriority(25); setActivationShapeId("flake/always"); }
KoPanToolFactory::KoPanToolFactory() : KoToolFactoryBase(KoPanTool_ID) { setToolTip(i18n("Pan")); setSection(navigationToolType()); setPriority(1); setIconName(koIconNameCStr("tool_pan")); setActivationShapeId("flake/always"); }
ArtisticTextToolFactory::ArtisticTextToolFactory() : KoToolFactoryBase("ArtisticTextTool") { setToolTip(i18n("Artistic text editing")); setToolType(dynamicToolType()); setIconName(koIconNameCStr("artistic_text")); setPriority(1); setActivationShapeId(ArtisticTextShapeID); }
KPrAnimationToolFactory::KPrAnimationToolFactory() : KoToolFactoryBase("Animation Tool") { setToolTip(i18n("Animation")); setToolType("calligrastage"); setPriority(40); setIconName(koIconNameCStr("animation-stage")); setActivationShapeId("flake/edit"); }
ReferencesToolFactory::ReferencesToolFactory() : KoToolFactoryBase("ReferencesToolFactory_ID") { setToolTip(i18n("References")); setToolType("calligrawords"); setIconName(koIconNameCStr("tool_references")); setPriority(20); setActivationShapeId(TextShape_SHAPEID); }
KoPencilToolFactory::KoPencilToolFactory() : KoToolFactoryBase("KoPencilTool") { setToolTip(i18n("Freehand path")); setToolType("karbon, krita"); setIconName(koIconNameCStr("draw-freehand")); setPriority(3); setActivationShapeId("flake/edit"); }
KoPathShapeFactory::KoPathShapeFactory(const QStringList&) : KoShapeFactoryBase(KoPathShapeId, i18n("Simple path shape")) { setToolTip(i18n("A simple path shape")); setIconName(koIconNameCStr("pathshape")); QStringList elementNames; elementNames << "path" << "line" << "polyline" << "polygon"; setXmlElementNames(KoXmlNS::draw, elementNames); setLoadingPriority(0); }
PictureShapeFactory::PictureShapeFactory() : KoShapeFactoryBase(PICTURESHAPEID, i18n("Image")) { setToolTip(i18n("Image shape that can display jpg, png etc.")); setIconName(koIconNameCStr("x-shape-image")); setLoadingPriority(1); QList<QPair<QString, QStringList> > elementNamesList; elementNamesList.append(qMakePair(QString(KoXmlNS::draw), QStringList("image"))); elementNamesList.append(qMakePair(QString(KoXmlNS::svg), QStringList("image"))); setXmlElements(elementNamesList); }
EllipseShapeFactory::EllipseShapeFactory() : KoShapeFactoryBase(EllipseShapeId, QObject::tr("Ellipse")) { setToolTip(QObject::tr("An ellipse")); setIconName(koIconNameCStr("ellipse-shape")); setFamily("geometric"); setLoadingPriority(1); QList<QPair<QString, QStringList> > elementNamesList; elementNamesList.append(qMakePair(QString(KoXmlNS::draw), QStringList("circle"))); elementNamesList.append(qMakePair(QString(KoXmlNS::draw), QStringList("ellipse"))); elementNamesList.append(qMakePair(QString(KoXmlNS::svg), QStringList("circle"))); elementNamesList.append(qMakePair(QString(KoXmlNS::svg), QStringList("ellipse"))); setXmlElements(elementNamesList); }
void KexiDBImageBox::updatePixmap() { if (!(designMode() && pixmap().isNull())) return; if (!KexiDBImageBox_static->pixmap) { const QString fname(KStandardDirs::locate("data", QLatin1String("kexi/pics/imagebox.png"))); QPixmap pm( KIconLoader::global()->loadMimeTypeIcon( koIconNameCStr("image-x-generic"), KIconLoader::NoGroup, KIconLoader::SizeLarge, KIconLoader::DisabledState) ); if (!pm.isNull()) { KIconEffect::semiTransparent(pm); KIconEffect::semiTransparent(pm); } KexiDBImageBox_static->pixmap = new QPixmap(pm); KexiDBImageBox_static->small = new QPixmap( KexiDBImageBox_static->pixmap->scaled( KexiDBImageBox_static->pixmap->width() / 2, KexiDBImageBox_static->pixmap->height() / 2, Qt::KeepAspectRatio, Qt::SmoothTransformation) ); } }
struct Info { StandardAction id; KShortcut shortcut; const char* psName; const char* psText; const char* psToolTip; const char* psWhatsThis; const char* psIconName; }; //! @internal static const Info g_rgActionInfo[] = { { SortAscending, KShortcut(), "data_sort_az", I18N_NOOP("&Ascending"), I18N_NOOP("Sort data in ascending order"), I18N_NOOP("Sorts data in ascending order (from A to Z and from 0 to 9). Data from selected column is used for sorting."), koIconNameCStr("view-sort-ascending") }, { SortDescending, KShortcut(), "data_sort_za", I18N_NOOP("&Descending"), I18N_NOOP("Sort data in descending order"), I18N_NOOP("Sorts data in descending (from Z to A and from 9 to 0). Data from selected column is used for sorting."), koIconNameCStr("view-sort-descending") }, { ActionNone, KShortcut(), 0, 0, 0, 0, 0 } }; //! @internal class ActionsInfoHash : public QHash<StandardAction, const Info*> { public: ActionsInfoHash() { const Info* actionInfo = g_rgActionInfo;
KoPageNavigator::KoPageNavigator(KoPAView *view) : QStackedWidget(view) , d(new Private(view)) { const bool isSlideType = (d->view->kopaDocument()->pageType() == KoPageApp::Slide); #ifdef Q_WS_MAC setAttribute(Qt::WA_MacMiniSize, true); #endif // normal display d->displayLabel = new QLabel(this); d->displayLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); addWidget(d->displayLabel); // add interactive variant QWidget* controlWidget = new QWidget(this); QHBoxLayout* layout = new QHBoxLayout(controlWidget); layout->setSpacing(0); layout->setMargin(0); // the original go-*-view-page icons as set for the actions are not reused, // because they look too complex, at least with the Oxygen icons // also installing an event filter for all buttons, to get wheel events even // for disabled buttons d->gotoFirstPageButton = new KoPageNavigatorButton(koIconNameCStr("go-first-view"), this); d->gotoFirstPageButton->installEventFilter(this); d->gotoPreviousPageButton = new KoPageNavigatorButton(koIconNameCStr("go-previous-view"), this); d->gotoPreviousPageButton->installEventFilter(this); d->gotoNextPageButton = new KoPageNavigatorButton(koIconNameCStr("go-next-view"), this); d->gotoNextPageButton->installEventFilter(this); d->gotoLastPageButton = new KoPageNavigatorButton(koIconNameCStr("go-last-view"), this); d->gotoLastPageButton->installEventFilter(this); d->pageNumberEdit = new QLineEdit(this); d->pageNumberEdit->installEventFilter(this); d->pageNumberEditValidator = new QIntValidator(d->pageNumberEdit); d->pageNumberEditValidator->setBottom(1); d->pageNumberEdit->setValidator(d->pageNumberEditValidator); d->pageNumberEdit->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); connect(d->pageNumberEdit, SIGNAL(returnPressed()), SLOT(onPageNumberEntered())); layout->addWidget(d->gotoFirstPageButton); layout->addWidget(d->gotoPreviousPageButton); layout->addWidget(d->pageNumberEdit); layout->addWidget(d->gotoNextPageButton); layout->addWidget(d->gotoLastPageButton); addWidget(controlWidget); KoPADocument *const kopaDocument = d->view->kopaDocument(); connect(kopaDocument, SIGNAL(pageAdded(KoPAPageBase*)), SLOT(updateDisplayLabel())); connect(kopaDocument, SIGNAL(pageRemoved(KoPAPageBase*)), SLOT(updateDisplayLabel())); connect(d->view->proxyObject, SIGNAL(activePageChanged()), SLOT(updateDisplayLabel())); // Fix width by the largest needed QFontMetrics fontMetrics(font()); d->pageNumberEdit->setMinimumWidth(fontMetrics.width(QString::number(maxPageCountPattern*10))); //one more const int editWidth = widget(Edit)->minimumWidth(); const int normalWidth = fontMetrics.width(displayText(false, isSlideType, maxPageCountPattern, maxPageCountPattern)); const int masterWidth = fontMetrics.width(displayText(true, isSlideType, maxPageCountPattern, maxPageCountPattern)); setFixedWidth(qMax(editWidth, qMax(normalWidth, masterWidth))); updateDisplayLabel(); }
StarShapeFactory::StarShapeFactory() : KoShapeFactoryBase(StarShapeId, i18n("A star shape")) { setToolTip(i18n("A star")); setIconName(koIconNameCStr("star-shape")); QStringList elementNames; elementNames << "regular-polygon" << "custom-shape"; setXmlElementNames(KoXmlNS::draw, elementNames); setLoadingPriority(5); KoShapeTemplate t; t.id = KoPathShapeId; t.templateId = "star"; t.name = i18n("Star"); t.family = "geometric"; t.toolTip = i18n("A star"); t.iconName = koIconName("star-shape"); KoProperties *props = new KoProperties(); props->setProperty("corners", 5); QVariant v; v.setValue(QColor(Qt::yellow)); props->setProperty("background", v); t.properties = props; addTemplate(t); t.id = KoPathShapeId; t.templateId = "flower"; t.name = i18n("Flower"); t.family = "funny"; t.toolTip = i18n("A flower"); t.iconName = koIconName("flower-shape"); props = new KoProperties(); props->setProperty("corners", 5); props->setProperty("baseRadius", 10.0); props->setProperty("tipRadius", 50.0); props->setProperty("baseRoundness", 0.0); props->setProperty("tipRoundness", 40.0); v.setValue(QColor(Qt::magenta)); props->setProperty("background", v); t.properties = props; addTemplate(t); t.id = KoPathShapeId; t.templateId = "pentagon"; t.name = i18n("Pentagon"); t.family = "geometric"; t.toolTip = i18n("A pentagon"); t.iconName = koIconName("pentagon-shape"); props = new KoProperties(); props->setProperty("corners", 5); props->setProperty("convex", true); props->setProperty("tipRadius", 50.0); props->setProperty("tipRoundness", 0.0); v.setValue(QColor(Qt::blue)); props->setProperty("background", v); t.properties = props; addTemplate(t); t.id = KoPathShapeId; t.templateId = "hexagon"; t.name = i18n("Hexagon"); t.family = "geometric"; t.toolTip = i18n("A hexagon"); t.iconName = koIconName("hexagon-shape"); props = new KoProperties(); props->setProperty("corners", 6); props->setProperty("convex", true); props->setProperty("tipRadius", 50.0); props->setProperty("tipRoundness", 0.0); v.setValue(QColor(Qt::blue)); props->setProperty("background", v); t.properties = props; addTemplate(t); }