void TrayIcon::setState(int state, const QString &description ) { kdDebug() << "Set applet status to: " << state << endl; QToolTip::remove(this); appletState = state; switch (state) { case APPLET_CHECKING: setPixmap(loadIcon(TRAY_ICON_CHECKING)); QToolTip::add(this, i18n("Checking for updates...")); break; case APPLET_PROBLEM: setPixmap(loadIcon(TRAY_ICON_PROBLEM)); QToolTip::add(this, i18n("Error:\n" + description )); break; case APPLET_NO_UPDATES: setPixmap(loadIcon(TRAY_ICON_GREEN)); QToolTip::add(this, i18n("No Updates Available")); break; case APPLET_UPDATES: setPixmap(loadIcon(TRAY_ICON_YELLOW)); QToolTip::add(this, i18n("1 Update Available", "%n Updates Available", updateCount) ); break; case APPLET_CRITICAL_UPDATES: setPixmap(loadIcon(TRAY_ICON_RED)); QToolTip::add(this, i18n("1 Important Update Available", "%n Important Updates Available", updateCount) ); break; } }
Prefs_Hyphenator::Prefs_Hyphenator(QWidget* parent, ScribusDoc* doc) : Prefs_Pane(parent) { setupUi(this); QStringList languageList; LanguageManager::instance()->fillInstalledHyphStringList(&languageList); languageList.sort(); hyphLanguageComboBox->addItems( languageList ); exceptionAddButton->setIcon(QIcon(loadIcon("16/list-add.png"))); exceptionEditButton->setEnabled(false); exceptionRemoveButton->setIcon(QIcon(loadIcon("16/list-remove.png"))); exceptionRemoveButton->setEnabled(false); ignoreAddButton->setIcon(QIcon(loadIcon("16/list-add.png"))); ignoreEditButton->setEnabled(false); ignoreRemoveButton->setIcon(QIcon(loadIcon("16/list-remove.png"))); ignoreRemoveButton->setEnabled(false); connect(ignoreAddButton, SIGNAL(clicked()), this, SLOT(addToIgnoreList())); connect(ignoreEditButton, SIGNAL(clicked()), this, SLOT(editIgnoreListEntry())); connect(ignoreRemoveButton, SIGNAL(clicked()), this, SLOT(removeIgnoreListEntry())); connect(ignoreListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(enableIgnoreButtons())); connect(exceptionAddButton, SIGNAL(clicked()), this, SLOT(addToExceptList())); connect(exceptionEditButton, SIGNAL(clicked()), this, SLOT(editExceptListEntry())); connect(exceptionRemoveButton, SIGNAL(clicked()), this, SLOT(removeExceptListEntry())); connect(exceptionListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(enableExceptButtons())); }
CharSelect::CharSelect(QWidget* parent) : ScrPaletteBase(parent, "CharSelect"), m_doc(0), m_enhanced(0), m_Item(0) { setupUi(this); paletteFileMask = tr("Scribus Char Palette (*.ucp);;All Files (*)"); hideButton->setIcon(loadIcon("22/insert-table.png")); unicodeButton->setIcon(loadIcon("find.png")); uniLoadButton->setIcon(loadIcon("22/document-open.png")); uniSaveButton->setIcon(loadIcon("22/document-save.png")); uniClearButton->setIcon(loadIcon("22/document-new.png")); m_userTableModel = new CharTableModel(this, 6, m_doc, PrefsManager::instance()->appPrefs.itemToolPrefs.textFont); loadUserContent(ScPaths::getApplicationDataDir() + "charpalette.ucp"); m_userTable->setModel(m_userTableModel); m_userTable->setAcceptDrops(true); // signals and slots connections connect(m_userTable, SIGNAL(selectChar(uint, QString)), this, SLOT(userNewChar(uint, QString))); connect(m_userTableModel, SIGNAL(selectionChanged(QItemSelectionModel*)), m_userTable, SLOT(modelSelectionChanged(QItemSelectionModel*))); connect(m_userTableModel, SIGNAL(rowAppended()), m_userTable, SLOT(resizeLastRow())); connect(unicodeButton, SIGNAL(chosenUnicode(const QString &)), m_userTableModel, SLOT(appendUnicode(const QString &))); connect(hideButton, SIGNAL(toggled(bool)), this, SLOT(hideButton_toggled(bool))); connect(this, SIGNAL(insertUserSpecialChar(QChar, QString)), this, SLOT(slot_insertUserSpecialChar(QChar, QString))); connect(uniLoadButton, SIGNAL(clicked()), this, SLOT(uniLoadButton_clicked())); connect(uniSaveButton, SIGNAL(clicked()), this, SLOT(uniSaveButton_clicked())); connect(uniClearButton, SIGNAL(clicked()), this, SLOT(uniClearButton_clicked())); }
void PathCutPlugin::languageChange() { // Note that we leave the unused members unset. They'll be initialised // with their default ctors during construction. // Action name m_actionInfo.name = "PathCutter"; // Action text for menu, including accel m_actionInfo.text = tr("Cut Polygon"); // Menu m_actionInfo.icon1 = loadIcon("transform-crop-and-resize.png"); m_actionInfo.icon2 = loadIcon("transform-crop-and-resize.png"); m_actionInfo.menu = "ItemPathOps"; m_actionInfo.parentMenu = "Item"; m_actionInfo.subMenuName = tr("Path Tools"); m_actionInfo.enabledOnStartup = false; m_actionInfo.notSuitableFor.append(PageItem::Line); m_actionInfo.notSuitableFor.append(PageItem::TextFrame); m_actionInfo.notSuitableFor.append(PageItem::ImageFrame); m_actionInfo.notSuitableFor.append(PageItem::PathText); m_actionInfo.notSuitableFor.append(PageItem::LatexFrame); m_actionInfo.forAppMode.append(modeNormal); m_actionInfo.needsNumObjects = 2; m_actionInfo.firstObjectType.append(PageItem::PolyLine); m_actionInfo.secondObjectType.append(PageItem::Polygon); }
nftdialog::nftdialog(QWidget* parent, QString lang, QString templateDir) : QDialog(parent) { setupUi(this); setModal(true); settings = new nftsettings(lang, templateDir); setWindowIcon(loadIcon("AppIcon.png")); // context menu removeAction = new QAction(tr("&Remove"), tnailGrid); openAction = new QAction(tr("&Open"), tnailGrid); tnailGrid->addAction(removeAction); tnailGrid->addAction(openAction); setupAbout(); toolBox->setItemIcon(0, loadIcon("16/information.png")); toolBox->setItemIcon(1, loadIcon("16/image-x-generic.png")); toolBox->setItemIcon(2, loadIcon("16/help-browser.png")); tnailGrid->setIconSize(QSize(60, 60)); // Signals and Slots Connections connect(categoryList, SIGNAL(itemSelectionChanged()), this, SLOT(setTNails())); connect(tnailGrid, SIGNAL(itemSelectionChanged()), this, SLOT(setInfo())); connect(tnailGrid, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeTemplate())); connect(openAction, SIGNAL(triggered()), this, SLOT(accept())); setupListItems(); setupCategories(); }
SMPStyleWidget::SMPStyleWidget() : QWidget() { setupUi(this); //Not used yet // optMarginCheckLeftProtruding->setVisible(false); lineSpacingLabel->setPixmap(loadIcon("linespacing2.png")); spaceAboveLabel->setPixmap( loadIcon("above.png") ); spaceBelowLabel->setPixmap( loadIcon("below.png") ); lineSpacingMode_->addItem( tr("Fixed Linespacing")); lineSpacingMode_->addItem( tr("Automatic Linespacing")); lineSpacingMode_->addItem( tr("Align to Baseline Grid")); connect(lineSpacingMode_, SIGNAL(highlighted(int)), this, SLOT(slotLineSpacingModeChanged(int))); lineSpacing_->setSuffix(unitGetSuffixFromIndex(0)); spaceAbove_->setSuffix(unitGetSuffixFromIndex(0)); spaceBelow_->setSuffix(unitGetSuffixFromIndex(0)); // optMarginCombo->addItem(tr("None"), ParagraphStyle::OM_None); // optMarginCombo->addItem(tr("Left Protruding"), ParagraphStyle::OM_LeftProtruding); // optMarginCombo->addItem(tr("Right Protruding"), ParagraphStyle::OM_RightProtruding); // optMarginCombo->addItem(tr("Left Hanging Punctuation"), ParagraphStyle::OM_LeftHangingPunct); // optMarginCombo->addItem(tr("Right Hanging Punctuation"), ParagraphStyle::OM_RightHangingPunct); // optMarginCombo->addItem(tr("Default"), ParagraphStyle::OM_Default); dropCapOffset_->setSuffix(unitGetSuffixFromIndex(0)); minSpaceSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); minGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); maxGlyphExtSpin->setSuffix(unitGetSuffixFromIndex(SC_PERCENT)); connect(optMarginDefaultButton, SIGNAL(clicked()), this, SLOT(slotDefaultOpticalMargins())); }
void MpdClientDialog::onStateChanged(QMpdStatus::State state) { QIcon icon; QSize icon_size; state_ = state; if (state == QMpdStatus::StatePlay) { icon = loadIcon(":/images/pause.png", icon_size); timer_->start(); } else { icon = loadIcon(":/images/play.png", icon_size); timer_->stop(); } updateButtonIcon(play_button_, icon, icon_size); if (state == QMpdStatus::StateStop) { icon = loadIcon(":/images/clear_playlist.png", icon_size); } else { icon = loadIcon(":/images/stop.png", icon_size); } updateButtonIcon(stop_button_, icon, icon_size); onyx::screen::instance().flush(&play_button_, onyx::screen::ScreenProxy::GU); onyx::screen::instance().flush(&stop_button_, onyx::screen::ScreenProxy::GU); }
void SystemTray::updateToolTip() { // return; ///////////////////////////////////////////////////// Basket *basket = Global::bnpView->currentBasket(); if (!basket) return; if (basket->icon().isEmpty() || basket->icon() == "basket" || ! Settings::showIconInSystray()) setPixmap(basket->isLocked() ? m_lockedIconPixmap : m_iconPixmap); else { // Code that comes from JuK: QPixmap bgPix = loadIcon("basket"); QPixmap fgPix = SmallIcon(basket->icon()); QImage bgImage = bgPix.convertToImage(); // Probably 22x22 QImage fgImage = fgPix.convertToImage(); // Should be 16x16 QImage lockOverlayImage = loadIcon("lockoverlay").convertToImage(); KIconEffect::semiTransparent(bgImage); copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2, (bgImage.height() - fgImage.height()) / 2); if (basket->isLocked()) KIconEffect::overlay(bgImage, lockOverlayImage); bgPix.convertFromImage(bgImage); setPixmap(bgPix); } //QTimer::singleShot( Container::c_delayTooltipTime, this, SLOT(updateToolTipDelayed()) ); // No need to delay: it's be called when notes are changed: updateToolTipDelayed(); }
void KMixDockWidget::updatePixmap() { MixDevice *md = 0; if ( _dockAreaPopup != 0 ) { md = _dockAreaPopup->dockDevice(); } char newPixmapType; if ( md == 0 ) { newPixmapType = 'e'; } else if ( md->isMuted() ) { newPixmapType = 'm'; } else { newPixmapType = 'd'; } if ( newPixmapType != _oldPixmapType ) { // Pixmap must be changed => do so switch ( newPixmapType ) { case 'e': setPixmap( loadIcon( "kmixdocked_error" ) ); break; case 'm': setPixmap( loadIcon( "kmixdocked_mute" ) ); break; case 'd': setPixmap( loadIcon( "kmixdocked" ) ); break; } } _oldPixmapType = newPixmapType; }
void CanvasMode_Magnifier::mouseReleaseEvent(QMouseEvent *m) { #ifdef GESTURE_FRAME_PREVIEW clearPixmapCache(); #endif // GESTURE_FRAME_PREVIEW const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos()); m_canvas->m_viewMode.m_MouseButtonPressed = false; m_canvas->resetRenderMode(); m->accept(); // m_view->stopDragTimer(); if (m_doc->appMode == modeMagnifier) { double sc = m_canvas->scale(); if (m_view->HaveSelRect) { QRect geom = m_view->redrawMarker->geometry().normalized(); FPoint nx = m_canvas->globalToCanvas(QPoint(geom.x() + geom.width() / 2, geom.y() + geom.height() / 2)); double scaleH = m_view->visibleWidth() / static_cast<double>(qMax(geom.width(), 1)); double scaleV = m_view->visibleHeight() / static_cast<double>(qMax(geom.height(), 1)); double scaleAdjust = qMax(0.5, qMin(scaleH, scaleV)); m_view->zoom(nx.x(), nx.y(), m_canvas->scale() * scaleAdjust, false); if (sc == m_canvas->scale()) { m_view->HaveSelRect = false; m_view->redrawMarker->hide(); m_view->requestMode(submodePaintingDone); } m_view->redrawMarker->hide(); } else { FPoint nx = mousePointDoc; int mx = qRound(nx.x()); int my = qRound(nx.y()); m_view->Magnify ? m_view->slotZoomIn(mx,my) : m_view->slotZoomOut(mx,my); if (sc == m_canvas->scale()) { m_view->HaveSelRect = false; m_view->requestMode(submodePaintingDone); } else { if (m->modifiers() & Qt::ShiftModifier) qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm"))); else qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm"))); } } } m_canvas->setRenderModeUseBuffer(false); m_doc->DragP = false; m_doc->leaveDrag = false; m_canvas->m_viewMode.operItemMoving = false; m_canvas->m_viewMode.operItemResizing = false; m_view->MidButt = false; //Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas m_view->zoomSpinBox->clearFocus(); m_view->pageSelector->clearFocus(); }
/* Der Muelleimer */ TrashBin::TrashBin(QWidget * parent) : QLabel(parent) { Normal = loadIcon("trashcan.png"); Offen = loadIcon("trashcan2.png"); setPixmap(Normal); setScaledContents(false); setAcceptDrops(true); }
SMCellStyleWidget::SMCellStyleWidget(QWidget *parent) : QWidget() { setupUi(this); fillColorIcon->setPixmap(loadIcon("16/color-fill.png")); fillColor->addItem(CommonStrings::tr_NoneColor); fillShadeLabel->setPixmap( loadIcon("shade.png") ); fillShade->setToolTip( tr("Fill Shade")); }
Prefs_PageSizes::Prefs_PageSizes(QWidget* parent, ScribusDoc* doc) : Prefs_Pane(parent) { setupUi(this); languageChange(); toActiveButton->setIcon(QIcon(loadIcon("22/go-next.png"))); fromActiveButton->setIcon(QIcon(loadIcon("22/go-previous.png"))); connect(toActiveButton, SIGNAL(clicked()), this, SLOT(moveToActive())); connect(fromActiveButton, SIGNAL(clicked()), this, SLOT(moveFromActive())); }
QIcon StyleHelper::listViewBadge(int type) { if (type == BadgeNormal) { return loadIcon("document_badge"); } else if (type == BadgeEncryted){ return loadIcon("document_badge_encrypted"); } Q_ASSERT(0); return QIcon(); }
/** Constructor */ SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent) { // Create pixmaps for the icon: m_iconSize = QSize(geometry().width(), geometry().height()); m_icon = loadIcon("basket"); QImage lockedIconImage = m_icon.pixmap(m_iconSize).toImage(); QImage lockOverlay = loadIcon("lockoverlay").pixmap(m_iconSize).toImage(); KIconEffect::overlay(lockedIconImage, lockOverlay); m_lockedIcon = QIcon(QPixmap::fromImage(lockedIconImage)); updateDisplay(); }
DragWidget::DragWidget(QWidget* parent) : QFrame(parent) { setMinimumSize(200, 200); setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); // Этот объект принимает // "перетащенные" в него объекты" setAcceptDrops(true); loadIcon(":/images/boat.png", 10, 10); loadIcon(":/images/car.png", 100, 10); loadIcon(":/images/house.png", 10, 80); }
void ColorFancyItemDelegate::redraw(const QVariant& data) const { static QPixmap smallPix(15, 15); static QPixmap alertIcon; static QPixmap cmykIcon; static QPixmap rgbIcon; static QPixmap spotIcon; static QPixmap regIcon; static bool iconsInitialized = false; if ( !iconsInitialized ) { alertIcon = loadIcon("alert.png", true); cmykIcon = loadIcon("cmyk.png", true); rgbIcon = loadIcon("rgb.png", true); spotIcon = loadIcon("spot.png", true); regIcon = loadIcon("register.png", true); iconsInitialized = true; } QPixmap* pPixmap = ScListBoxPixmap<60,15>::pmap.get(); pPixmap->fill(Qt::transparent); if (data.canConvert<ColorPixmapValue>()) { ColorPixmapValue item(data.value<ColorPixmapValue>()); QColor rgb = ScColorEngine::getDisplayColor(item.m_color, item.m_doc); smallPix.fill(rgb); QPainter painter(&smallPix); painter.setBrush(Qt::NoBrush); QPen b(Qt::black, 1); painter.setPen(b); painter.drawRect(0, 0, 15, 15); painter.end(); paintAlert(smallPix, *pPixmap, 0, 0); bool isOutOfGamut = ScColorEngine::isOutOfGamut(item.m_color, item.m_doc); if (isOutOfGamut) paintAlert(alertIcon, *pPixmap, 15, 0); if (item.m_color.getColorModel() == colorModelCMYK) paintAlert(cmykIcon, *pPixmap, 30, 0); else paintAlert(rgbIcon, *pPixmap, 30, 0); if (item.m_color.isSpotColor()) paintAlert(spotIcon, *pPixmap, 45, 0); if (item.m_color.isRegistrationColor()) paintAlert(regIcon, *pPixmap, 46, 0); } }
PropertiesPalette_Table::PropertiesPalette_Table(QWidget* parent) : QWidget(parent), m_mainWindow(0), m_doc(0), m_item(0), m_previousItem(0) { setupUi(this); setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); addBorderLineButton->setIcon(QIcon(loadIcon("penciladd.png"))); removeBorderLineButton->setIcon(QIcon(loadIcon("pencilsub.png"))); labelTable->setBuddy(tableStyleCombo); buttonClearTableStyle->setIcon(loadIcon("16/edit-clear.png")); labelCells->setBuddy(cellStyleCombo); buttonClearCellStyle->setIcon(loadIcon("16/edit-clear.png")); connect(tableStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setTableStyle(const QString&))); connect(cellStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setCellStyle(const QString&))); }
UndoPalette::UndoPalette(QWidget* parent, const char* name) : UndoGui(parent, name) { currentSelection = 0; redoItems = 0; QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(5); layout->setSpacing(5); objectBox = new QCheckBox(this); layout->addWidget(objectBox); // objectBox->setEnabled(false); undoList = new QListWidget(this); // undoList->setMultiSelection(false); // undoList->setSelectionMode(QListWidget::Single); undoList->setSelectionMode(QAbstractItemView::SingleSelection); undoList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); layout->addWidget(undoList); QHBoxLayout* buttonLayout = new QHBoxLayout; buttonLayout->setMargin(0); buttonLayout->setSpacing(5); undoButton = new QPushButton(loadIcon("16/edit-undo.png"), "", this); buttonLayout->addWidget(undoButton); redoButton = new QPushButton(loadIcon("16/edit-redo.png"), "", this); buttonLayout->addWidget(redoButton); //Save the translated key sequence - hopefully we get the translated one here! initialUndoKS = undoButton->shortcut(); initialRedoKS = redoButton->shortcut(); layout->addLayout(buttonLayout); updateFromPrefs(); languageChange(); connect(PrefsManager::instance(), SIGNAL(prefsChanged()), this, SLOT(updateFromPrefs())); connect(undoButton, SIGNAL(clicked()), this, SLOT(undoClicked())); connect(redoButton, SIGNAL(clicked()), this, SLOT(redoClicked())); // connect(undoList, SIGNAL(highlighted(int)), this, SLOT(undoListClicked(int))); connect(undoList, SIGNAL(currentRowChanged(int)), this, SLOT(undoListClicked(int))); // connect(undoList, SIGNAL(onItem(Q3ListBoxItem*)), this, SLOT(showToolTip(Q3ListBoxItem*))); connect(undoList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(showToolTip(QListWidgetItem*))); // connect(undoList, SIGNAL(onViewport()), this, SLOT(removeToolTip())); connect(undoList, SIGNAL(viewportEntered()), this, SLOT(removeToolTip())); connect(objectBox, SIGNAL(toggled(bool)), this, SLOT(objectCheckBoxClicked(bool))); connect(ScCore->primaryMainWindow()->scrActions["editActionMode"], SIGNAL(toggled(bool)), objectBox, SLOT(setChecked(bool))); connect(objectBox, SIGNAL(toggled(bool)), ScCore->primaryMainWindow()->scrActions["editActionMode"], SLOT(setChecked(bool))); }
void GradientPreview::mouseMoveEvent(QMouseEvent *m) { QRect insideRect = QRect(10, 43, width()-20, 13); if (isEditable) { QRect fpo; qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); if ((!Mpressed) && (m->y() < height()) && (m->y() > 43) && (m->x() > 9) && (m->x() < width()-9)) { setCursor(QCursor(loadIcon("AddPoint.png"), 1, 1)); for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg) { fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13); if (fpo.contains(m->pos())) { setCursor(QCursor(Qt::SizeHorCursor)); return; } } } if (m->buttons() & Qt::LeftButton) { if ((Mpressed) && (m->y() < height()) && (m->y() > 43) && (m->x() > 9) && (m->x() < width()-9) && (ActStop != -1)) { qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor)); double newStop = static_cast<double>((m->x() - 10)) / (static_cast<double>(width())-20); if (ActStop > 1) { if (StopM[ActStop-1]+2 >= m->x()) return; } if (ActStop < static_cast<int>(StopM.count()-2)) { if (StopM[ActStop+1]-2 < m->x()) return; } StopM[ActStop] = m->x(); QList<VColorStop*> cstops = fill_gradient.colorStops(); cstops.at(ActStop)->rampPoint = newStop; qSort(cstops.begin(), cstops.end()); onlyselect = false; repaint(); } if ((Mpressed) && (outside || !insideRect.contains(m->pos())) && (ActStop > 0) && (ActStop != static_cast<int>(StopM.count()-1))) qApp->changeOverrideCursor(QCursor(loadIcon("DelPoint.png"), 1, 1)); } } }
void AdapterWidget::mousePressEvent ( QMouseEvent* event ) { switch ( event->button() ) { case Qt::LeftButton: qApp->setOverrideCursor(QCursor(Qt::OpenHandCursor)); button = 1; break; case Qt::MidButton: qApp->setOverrideCursor(QCursor(Qt::SizeAllCursor)); button = 2; break; case Qt::RightButton: qApp->setOverrideCursor(QCursor(loadIcon("LupeZ.xpm"))); button = 3; break; case Qt::NoButton: qApp->setOverrideCursor(QCursor(Qt::ArrowCursor)); button = 0; break; default: qApp->setOverrideCursor(QCursor(Qt::ArrowCursor)); button = 0; break; } _gw->getEventQueue()->mouseButtonPress ( event->x(), event->y(), button ); }
PrefsDialogBase::PrefsDialogBase( QWidget* parent ) : QDialog( parent ) { setModal(true); counter = 0; setWindowIcon(QIcon(loadIcon("AppIcon.png"))); setSizeGripEnabled( true ); prefsLayout = new QVBoxLayout( this ); prefsLayout->setMargin(10); prefsLayout->setSpacing(5); layout3 = new QHBoxLayout; layout3->setMargin(0); layout3->setSpacing(5); prefsSelection = new OptionListWidget( this ); layout3->addWidget( prefsSelection ); layout5 = new QVBoxLayout; layout5->setMargin(0); layout5->setSpacing(5); tabNameLabel = new QLabel( this ); QFont f(tabNameLabel->font()); f.setPointSize(f.pointSize()+4); f.setBold(true); tabNameLabel->setFont(f); tabNameLabel->setText(""); layout5->addWidget( tabNameLabel ); prefsWidgets = new QStackedWidget( this); layout5->addWidget( prefsWidgets ); layout3->addLayout(layout5); prefsLayout->addLayout( layout3 ); layout4 = new QHBoxLayout; layout4->setMargin(0); layout4->setSpacing(5); saveButton = new QPushButton(this ); saveButton->setAutoDefault( false ); saveButton->setDefault( false ); layout4->addWidget(saveButton); QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout4->addItem( spacer ); backToDefaults = new QPushButton( this ); backToDefaults->setAutoDefault( false ); backToDefaults->setDefault( false ); layout4->addWidget( backToDefaults ); applyChangesButton = new QPushButton( this ); applyChangesButton->setAutoDefault( false ); applyChangesButton->setDefault( false ); layout4->addWidget( applyChangesButton ); buttonOk = new QPushButton( this ); buttonOk->setAutoDefault( false ); buttonOk->setDefault( false ); layout4->addWidget( buttonOk ); buttonCancel = new QPushButton( this ); buttonCancel->setAutoDefault( false ); buttonCancel->setDefault( false ); layout4->addWidget( buttonCancel ); prefsLayout->addLayout( layout4 ); languageChange(); connect(prefsSelection, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(itemSelected(QListWidgetItem* ))); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveButton_clicked())); }
static int findGames(Game *games, int max) { Dir *dirs = new Dir[MAX_DIR]; int curr_game = 0, curr_dir = 0, num_dirs = 1; dirs[0].node = Common::FSNode(""); while (curr_game < max && curr_dir < num_dirs) { strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252); dirs[curr_dir].name[251] = '\0'; dirs[curr_dir].deficon[0] = '\0'; Common::FSList files, fslist; dirs[curr_dir++].node.getChildren(fslist, Common::FSNode::kListAll); for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end(); ++entry) { if (entry->isDirectory()) { if (num_dirs < MAX_DIR && strcasecmp(entry->getDisplayName().c_str(), "install")) { dirs[num_dirs].node = *entry; num_dirs++; } } else if (isIcon(*entry)) strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str()); else files.push_back(*entry); } GameList candidates = EngineMan.detectGames(files); for (GameList::const_iterator ge = candidates.begin(); ge != candidates.end(); ++ge) if (curr_game < max) { strcpy(games[curr_game].filename_base, ge->gameid().c_str()); strcpy(games[curr_game].dir, dirs[curr_dir-1].name); games[curr_game].language = ge->language(); games[curr_game].platform = ge->platform(); if (uniqueGame(games[curr_game].filename_base, games[curr_game].dir, games[curr_game].language, games[curr_game].platform, games, curr_game)) { strcpy(games[curr_game].text, ge->description().c_str()); #if 0 printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n", games[curr_game].text, (int)games[curr_game].language, (int)games[curr_game].platform, games[curr_game].dir, games[curr_game].filename_base, dirs[curr_dir-1].name); #endif curr_game++; } } } for (int i=0; i<curr_game; i++) if (!loadIcon(games[i], dirs, num_dirs)) makeDefIcon(games[i].icon); delete[] dirs; return curr_game; }
/*private*/ NamedIcon* SignalHeadIconXml::loadSignalIcon(QString aspect, int rotation, SignalHeadIcon* l, QDomElement element, QString name, Editor* ed) { QString msg = "SignalHead \""+name+"\": icon \""+aspect+"\" "; NamedIcon* icon = loadIcon(l, aspect, element, msg, ed); if (icon==NULL) { if (element.attribute(aspect) != NULL) { QString iconName = element.attribute(aspect); icon = NamedIcon::getIconByName(iconName); if (icon==NULL) { icon = ed->loadFailed(msg, iconName); if (icon==NULL) { log->info(msg+" removed for url= "+iconName); } } if (icon!=NULL) { icon->setRotation(rotation, (QObject*)l); } } else log->info("did not load file aspect "+aspect+" for SignalHead "+name); } if (icon==NULL) { log->info("SignalHead Icon \""+name+"\": icon \""+aspect+"\" removed"); } return icon; }
void PicSearch::createPreview() { QPixmap pm(200, 200); QFileInfo fi = QFileInfo(currentImage); int w = 200; int h = 200; bool mode = false; QString ext = fi.suffix().toLower(); if (ext.isEmpty()) ext = getImageType(currentImage); ScImage im; //No doc to send data anyway, so no doc to get into scimage. CMSettings cms(0, "", Intent_Perceptual); cms.allowColorManagement(false); if (im.loadPicture(currentImage, 1, cms, ScImage::Thumbnail, 72, &mode)) { int ix,iy; if ((im.imgInfo.exifDataValid) && (!im.imgInfo.exifInfo.thumbnail.isNull())) { ix = im.imgInfo.exifInfo.width; iy = im.imgInfo.exifInfo.height; } else { ix = im.width(); iy = im.height(); } int xres = im.imgInfo.xres; int yres = im.imgInfo.yres; QString tmp = ""; QString tmp2 = ""; QImage im2; if ((ix > w-5) || (iy > h-44)) { double sx = im.width() / static_cast<double>(w-5); double sy = im.height() / static_cast<double>(h-44); im2 = sy < sx ? im.scaled(qRound(im.width() / sx), qRound(im.height() / sx), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) : im.scaled(qRound(im.width() / sy), qRound(im.height() / sy), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } else im2 = im.qImage(); // no need to copy QPainter p; QBrush b(QColor(205,205,205), loadIcon("testfill.png")); p.begin(&pm); p.fillRect(0, 0, w, h-44, b); p.fillRect(0, h-44, w, 44, QColor(255, 255, 255)); p.drawImage((w - im2.width()) / 2, (h - 44 - im2.height()) / 2, im2); p.drawText(2, h-29, tr("Size:")+" "+tmp.setNum(ix)+" x "+tmp2.setNum(iy)); p.drawText(2, h-17, tr("Resolution:")+" "+tmp.setNum(xres)+" x "+tmp2.setNum(yres)+" "+ tr("DPI")); QString cSpace; if ((extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext)) && (im.imgInfo.type != ImageType7)) cSpace = tr("Unknown"); else cSpace=colorSpaceText(im.imgInfo.colorspace); p.drawText(2, h-5, tr("Colorspace:")+" "+cSpace); p.end(); repaint(); } previewLabel->setPixmap(pm); }
bool ViewerWindow::onCreate(LPCREATESTRUCT lps) { m_control.setWindow(m_hWnd); setClassCursor(LoadCursor(NULL, IDC_ARROW)); loadIcon(IDI_APPICON); m_toolbar.loadToolBarfromRes(IDB_TOOLBAR); m_toolbar.setButtonsRange(IDS_TB_NEWCONNECTION); m_toolbar.setViewAutoButtons(5, ToolBar::TB_Style_sep); m_toolbar.setViewAutoButtons(7, ToolBar::TB_Style_sep); m_toolbar.setViewAutoButtons(11, ToolBar::TB_Style_sep); m_toolbar.setViewAutoButtons(12, ToolBar::TB_Style_sep); m_toolbar.setViewAutoButtons(16, ToolBar::TB_Style_sep); m_toolbar.attachToolBar(getHWnd()); m_menu.getSystemMenu(getHWnd()); m_menu.loadMenu(); applySettings(); ViewerConfig *config = ViewerConfig::getInstance(); bool bShowToolbar = config->isToolbarShown(); if (!bShowToolbar) { m_toolbar.hide(); m_bToolBar = false; } m_menu.checkedMenuItem(IDS_TB_TOOLBAR, bShowToolbar); return true; }
AdjustCmsDialog::AdjustCmsDialog( QWidget* parent, ScribusDoc* doc ) : QDialog( parent ) { setWindowTitle( tr("CMS Settings") ); setWindowIcon(loadIcon("AppIcon.png")); setModal(true); queryLayout = new QVBoxLayout( this ); queryLayout->setMargin(5); queryLayout->setSpacing(10); tabColorManagement = new CMSPrefs(this, &doc->cmsSettings(), &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles); queryLayout->addWidget( tabColorManagement ); okCancelLayout = new QHBoxLayout; okCancelLayout->setSpacing( 5 ); okCancelLayout->setMargin( 0 ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); okCancelLayout->addItem( spacer ); okButton = new QPushButton( CommonStrings::tr_OK, this); okButton->setDefault( true ); okCancelLayout->addWidget( okButton ); cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); okCancelLayout->addWidget( cancelButton ); queryLayout->addLayout( okCancelLayout ); setMaximumSize(minimumSizeHint()); resize( minimumSizeHint() ); // signals and slots connections connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); }
void SeView::mouseMoveEvent(QMouseEvent* e) { if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4)) { Mpressed = false; int a = rowAt(e->pos().y()); int b = columnAt(e->pos().x()); if ((a != -1) && (b != -1)) { QTableWidgetItem* ite = item(a, b); if (ite != 0) { if (ite->type() == 1002) { SeItem* it = (SeItem*)ite; QString str(it->pageName); bool dummy; int p = GetPage(a, b, &dummy); QString tmp; QMimeData *mimeData = new QMimeData; mimeData->setData("page/magic", "2 "+tmp.setNum(p).toLocal8Bit()+" "+str.toLocal8Bit()); mimeData->setText("2 "+tmp.setNum(p)+" "+str); QDrag *dr = new QDrag(this); dr->setMimeData(mimeData); const QPixmap& pm = loadIcon("doc.png"); dr->setDragCursor(pm, Qt::CopyAction); dr->setDragCursor(pm, Qt::MoveAction); dr->exec(Qt::CopyAction | Qt::MoveAction); QApplication::setOverrideCursor(Qt::ArrowCursor); } } } } QTableWidget::mouseMoveEvent(e); }
void RulerT::leaveEvent(QEvent*) { if ((mousePressed) && (rulerCode == 3)) qApp->changeOverrideCursor(QCursor(loadIcon("DelPoint.png"), 1, 1)); else qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); }
PolygonProps::PolygonProps(QWidget* parent, int polyC, int polyFd, double polyF, bool polyS, double polyR, double polyCurvature) : QDialog( parent ) { setModal(true); setWindowTitle( tr( "Polygon Properties" ) ); setWindowIcon(QIcon(loadIcon ( "AppIcon.png" ))); PolygonPropsLayout = new QVBoxLayout( this ); PolygonPropsLayout->setMargin(10); PolygonPropsLayout->setSpacing(5); polyWidget = new PolygonWidget(this, polyC, polyFd, polyF, polyS, polyR, polyCurvature); PolygonPropsLayout->addWidget( polyWidget ); Layout1 = new QHBoxLayout; Layout1->setMargin(0); Layout1->setSpacing(5); QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout1->addItem( spacer_2 ); okButton = new QPushButton(this); okButton->setText( CommonStrings::tr_OK ); okButton->setDefault( true ); Layout1->addWidget( okButton ); cancelButton = new QPushButton(this); cancelButton->setText( CommonStrings::tr_Cancel ); Layout1->addWidget( cancelButton ); PolygonPropsLayout->addLayout( Layout1 ); // signals and slots connections connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); }