ReplacePart::ReplacePart(QObject *parent, const char *name, const QStringList& ) : KDevPlugin( &data, parent, name ? name : "ReplacePart" ) { setInstance(ReplaceFactory::instance()); setXMLFile("kdevpart_replace.rc"); m_widget = new ReplaceWidget(this); m_widget->setIcon( SmallIcon("filefind") ); m_widget->setCaption(i18n("Replace")); QWhatsThis::add (m_widget, i18n("<b>Replace</b><p>" "This window shows a preview of a string replace " "operation. Uncheck a line to exclude that replacement. " "Uncheck a file to exclude the whole file from the " "operation. " "Clicking on a line in the list will automatically " "open the corresponding source file and set the " "cursor to the line with the match." )); mainWindow()->embedOutputView( m_widget, i18n("Replace"), i18n("Project wide string replacement") ); mainWindow()->setViewAvailable( m_widget, false ); KAction * action = new KAction(i18n("Find-Select-Replace..."), 0, CTRL+SHIFT+Key_R, this, SLOT(slotReplace()), actionCollection(), "edit_replace_across"); action->setToolTip( i18n("Project wide string replacement") ); action->setWhatsThis( i18n("<b>Find-Select-Replace</b><p>" "Opens the project wide string replacement dialog. There you " "can enter a string or a regular expression which is then " "searched for within all files in the locations " "you specify. Matches will be displayed in the <b>Replace</b> window, you " "can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") ); connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); }
void ScriptEditorWidget::contextMenuEvent(QContextMenuEvent * e) { QMenu * pMenu = createStandardContextMenu(); pMenu->addAction(__tr2qs_ctx("Context Sensitive Help","editor"),this,SLOT(slotHelp()),Qt::CTRL+Qt::Key_H); pMenu->addAction(__tr2qs_ctx("&Replace","editor"),this,SLOT(slotReplace()),Qt::CTRL+Qt::Key_R); pMenu->exec(e->globalPos()); delete pMenu; }
void ReplacePart::contextMenu(QPopupMenu *popup, const Context *context) { if (!context->hasType( Context::EditorContext )) return; const EditorContext *econtext = static_cast<const EditorContext*>(context); QString ident = econtext->currentWord(); if (!ident.isEmpty()) { m_popupstr = ident; QString squeezed = KStringHandler::csqueeze(ident, 30); int id = popup->insertItem( i18n("Replace Project Wide: %1").arg(squeezed), this, SLOT(slotReplace()) ); popup->setWhatsThis(id, i18n("<b>Replace Project Wide</b><p>Opens the find in files dialog " "and sets the pattern to the text under the cursor.")); popup->insertSeparator(); } }
SpellerDialog::SpellerDialog(QWidget *parent,SpellerUtility *utility) :QDialog( parent) { ui.setupUi(this); setModal(true); m_speller=utility; connect(ui.pushButtonIgnore, SIGNAL(clicked()), this, SLOT(slotIgnore())); connect(ui.pushButtonAlwaysIgnore, SIGNAL(clicked()), this, SLOT(slotAlwaysIgnore())); connect(ui.pushButtonReplace, SIGNAL(clicked()), this, SLOT(slotReplace())); connect(ui.listWidget, SIGNAL(itemSelectionChanged()),this, SLOT(updateItem())); ui.listWidget->setEnabled(false); ui.lineEditNew->setEnabled(false); ui.pushButtonIgnore->setEnabled(false); ui.pushButtonAlwaysIgnore->setEnabled(false); ui.pushButtonReplace->setEnabled(false); ui.lineEditOriginal->setEnabled(false); }
void JuffEd::initActions() { CommandStorageInt* st = Juff::Utils::commandStorage(); st->addAction(FILE_NEW, tr("&New"), this, SLOT(slotFileNew())); st->addAction(FILE_OPEN, tr("&Open"), this, SLOT(slotFileOpen())); st->addAction(FILE_SAVE, tr("&Save"), this, SLOT(slotFileSave())); st->addAction(FILE_SAVE_AS, tr("Save as"), this, SLOT(slotFileSaveAs())); st->addAction(FILE_SAVE_ALL, tr("Save all"), this, SLOT(slotFileSaveAll())); st->addAction(FILE_RELOAD, tr("&Reload"), this, SLOT(slotFileReload())); st->addAction(FILE_RENAME, tr("Rename"), this, SLOT(slotFileRename())); st->addAction(FILE_CLOSE, tr("Close"), this, SLOT(slotFileClose())); st->addAction(FILE_CLOSE_ALL, tr("Close All"), this, SLOT(slotFileCloseAll())); st->addAction(FILE_PRINT, tr("&Print"), this, SLOT(slotFilePrint())); st->addAction(FILE_EXIT, tr("Exit"), this, SLOT(slotFileExit())); st->addAction(SESSION_NEW, tr("New session"), this, SLOT(slotSessionNew())); st->addAction(SESSION_OPEN, tr("Open session"), this, SLOT(slotSessionOpen())); st->addAction(SESSION_SAVE, tr("Save session as..."), this, SLOT(slotSessionSaveAs())); st->addAction(EDIT_UNDO, tr("Undo"), this, SLOT(slotEditUndo())); st->addAction(EDIT_REDO, tr("Redo"), this, SLOT(slotEditRedo())); st->addAction(EDIT_CUT, tr("Cut"), this, SLOT(slotEditCut())); st->addAction(EDIT_COPY, tr("Copy"), this, SLOT(slotEditCopy())); st->addAction(EDIT_PASTE, tr("Paste"), this, SLOT(slotEditPaste())); st->addAction(SEARCH_FIND, tr("Find"), this, SLOT(slotFind())); st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext())); st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev())); st->addAction(SEARCH_REPLACE, tr("Replace"), this, SLOT(slotReplace())); st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine())); st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile())); st->addAction(VIEW_ZOOM_IN, tr("Zoom In"), this, SLOT(slotZoomIn())); st->addAction(VIEW_ZOOM_OUT, tr("Zoom Out"), this, SLOT(slotZoomOut())); st->addAction(VIEW_ZOOM_100, tr("Zoom 100%"), this, SLOT(slotZoom100())); st->addAction(VIEW_FULLSCREEN, tr("Fullscreen"), this, SLOT(slotFullscreen())); st->addAction(TOOLS_SETTINGS, tr("Settings"), this, SLOT(slotSettings())); st->addAction(HELP_ABOUT, tr("About"), mw_, SLOT(slotAbout())); st->addAction(HELP_ABOUT_QT, tr("About Qt"), mw_, SLOT(slotAboutQt())); }
ClsQGroupStateManip::ClsQGroupStateManip ( const char * _name = 0,string _strGroupID = ""): QFrame( 0, _name, Qt::WDestructiveClose), strGroupID(_strGroupID) { bApplied = false; clsQStateArrayView = NULL; iInterval = 1; iLoops = 1; iStepSize = 1; string strGroupName = ClsFESystemManager::Instance()->getGroupName(strGroupID).c_str(); string strTitle = "State Manipulation Panel for \"" + strGroupName + "\""; this->setCaption(strTitle.c_str()); QBitmap qbmEraser( eraser_cursor_width, eraser_cursor_height, eraser_cursor_bits, TRUE ); QBitmap qbmEraserMask( eraser_cursor_mask_width, eraser_cursor_mask_height, eraser_cursor_mask_bits, TRUE ); qcursorEraser = new QCursor( qbmEraser, qbmEraserMask,0 ,0 ); QBitmap qbmPencil( pencil_cursor_width, pencil_cursor_height, pencil_cursor_bits, TRUE ); QBitmap qbmPencilMask( pencil_cursor_mask_width, pencil_cursor_mask_height, pencil_cursor_mask_bits, TRUE ); qcursorPencil = new QCursor( qbmPencil, qbmPencilMask, 0, 0 ); QSplitter *qsplitter = new QSplitter(this); QFrame *qfmLeftPane = new QFrame(qsplitter); QBoxLayout * layoutMain = new QHBoxLayout( this); layoutMain->setResizeMode (QLayout::Fixed); layoutMain->addWidget(qsplitter); QBoxLayout * layoutLeftPane = new QVBoxLayout( qfmLeftPane, 5, -1, "mainL"); qlblCaption = new QLabel(qfmLeftPane); qlblCaption->setText(strGroupName.c_str()); layoutLeftPane->addWidget(qlblCaption); qfmStateArray = new QFrame(qfmLeftPane);; QHBoxLayout *qlayoutQfm = new QHBoxLayout( qfmStateArray); qlayoutQfm->setAutoAdd ( true); createStateArray(strGroupID); layoutLeftPane->addWidget(qfmStateArray, 0, Qt::AlignHCenter); qfmStateArray->show(); clsQStateArrayView->show(); clsQStateArrayView->setValue(DEFAULTVALUE); QHBoxLayout *qlayoutGradient = new QHBoxLayout( layoutLeftPane); QString qstr; QLabel* qlblMin = new QLabel(qfmLeftPane); qstr.setNum(fMinVal()); qlblMin->setText(qstr); qlayoutGradient->addWidget(qlblMin, 0, Qt::AlignRight); qlblGradientPixmap = new QLabel(qfmLeftPane);; qlayoutGradient->addWidget(qlblGradientPixmap, 1, Qt::AlignHCenter); qstr.setNum(fMaxVal()); QLabel* qlblMax = new QLabel(qfmLeftPane); qlblMax->setText(qstr); qlayoutGradient->addWidget(qlblMax); int iImgWidth = clsQStateArrayView->width() - qlblMin->minimumWidth() - qlblMax->minimumWidth() - 30; int iImgHeight = 13; qlblGradientPixmap->setFixedSize(iImgWidth,iImgHeight); qlblGradientPixmap->setPixmap(clsQStateArrayView->getGradientPixmap(iImgWidth, iImgHeight)); /* -------------------------------- */ qgrpbxTools = new QGroupBox( ); QLabel *lblValue = new QLabel(); lblValue->setText("Value:"); qdblspnbx = new QDoubleSpinBox( qgrpbxTools ); qdblspnbx->setMinimum(fMinVal()); qdblspnbx->setMaximum(fMaxVal()); qdblspnbx->setDecimals(3); qdblspnbx->setSingleStep ( 0.01); qdblspnbx->setValue(DEFAULTVALUE); connect(qdblspnbx, SIGNAL(valueChanged(double)), this, SLOT(slotChangeValue(double))); QPushButton* qpbtnPen = new QPushButton (QIcon(QPixmap(pencil)), ""); qpbtnPen->setToggleButton ( true); qpbtnPen->setFlat(true); qpbtnPen->setChecked(true); slotSelectTool(TOOL_PENCIL); QPushButton* qpbtnEraser = new QPushButton (QIcon(QPixmap(eraser)), ""); qpbtnEraser->setToggleButton ( true); qpbtnEraser->setFlat(true); QHBoxLayout *qlayoutTools = new QHBoxLayout; qlayoutTools->addWidget(lblValue); qlayoutTools->addWidget(qdblspnbx); qlayoutTools->addWidget(qpbtnPen); qlayoutTools->addWidget(qpbtnEraser); qgrpbxTools->setLayout(qlayoutTools); qbtngrpTools = new QButtonGroup(); connect(qbtngrpTools, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectTool(int))); qbtngrpTools->addButton(qpbtnPen, TOOL_PENCIL); qbtngrpTools->addButton(qpbtnEraser, TOOL_ERASER); layoutLeftPane->addWidget(qgrpbxTools); /* ------------------------------------ */ QHBoxLayout *layout2 = new QHBoxLayout( layoutLeftPane); QPushButton *qpbtnClear = new QPushButton ("Clear", qfmLeftPane); connect(qpbtnClear, SIGNAL(clicked()), this, SLOT(slotClear())); layout2->addWidget(qpbtnClear, Qt::AlignTop); QPushButton *qpbtnAdd = new QPushButton ("Add", qfmLeftPane); connect(qpbtnAdd, SIGNAL(clicked()), this, SLOT(slotAdd())); layout2->addWidget(qpbtnAdd, Qt::AlignTop); QPushButton *qpbtnReplace = new QPushButton ("Replace", qfmLeftPane); connect(qpbtnReplace, SIGNAL(clicked()), this, SLOT(slotReplace())); layout2->addWidget(qpbtnReplace, Qt::AlignTop); /* ------------------------------------ */ QGroupBox *qgrpbxMode = new QGroupBox("Mode", qfmLeftPane); QRadioButton *qrbClamp = new QRadioButton ("Clamp", qgrpbxMode ); qrbClamp->setChecked( TRUE ); slotSetMode(ClsGroupManipPattern::MODE_CLAMP); QRadioButton *qrbAddPattern = new QRadioButton ("Add", qgrpbxMode ); QRadioButton *qrbMultiplyPattern = new QRadioButton ("Multiply", qgrpbxMode ); QHBoxLayout *qlayoutMode = new QHBoxLayout; qlayoutMode->addWidget(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qlayoutMode->addWidget(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qlayoutMode->addWidget(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); qgrpbxMode->setLayout(qlayoutMode); QButtonGroup *qbtngrpMode = new QButtonGroup(); connect(qbtngrpMode, SIGNAL(buttonClicked(int)), SLOT(slotSetMode(int)) ); qbtngrpMode->addButton(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qbtngrpMode->addButton(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qbtngrpMode->addButton(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); layoutLeftPane->addWidget(qgrpbxMode); /* ------------------------------------ */ /* ------------------------------------ */ QGroupBox *qgrpbxPlayBack = new QGroupBox("Play Back", qfmLeftPane); QRadioButton *qrbPersist = new QRadioButton( "For ever" ); qrbPersist->setChecked( TRUE ); slotSetPlayback(ClsGroupManipPattern::PLAYBACK_LOOP); QRadioButton *qrbIterations = new QRadioButton( "Times"); QButtonGroup *qbtngrpPlayBack = new QButtonGroup(); connect(qbtngrpPlayBack, SIGNAL(buttonClicked(int)), SLOT(slotSetPlayback(int)) ); qbtngrpPlayBack->addButton(qrbPersist, ClsGroupManipPattern::PLAYBACK_LOOP); qbtngrpPlayBack->addButton(qrbIterations, ClsGroupManipPattern::PLAYBACK_ITERATIONS); qspnbxIterations = new QSpinBox( ); qspnbxIterations->setMinimum(1); qspnbxIterations->setMaximum(INT_MAX); qspnbxIterations->setMaximumWidth(50); connect(qspnbxIterations, SIGNAL(valueChanged(int)), this, SLOT(slotSetLoops(int))); QLabel *qlblInterval = new QLabel(); qlblInterval->setText("Interval"); qspnbxInterval = new QSpinBox( ); qspnbxInterval->setMinimum(1); qspnbxInterval->setMaximum(INT_MAX); qspnbxInterval->setMaximumWidth(50); connect(qspnbxInterval, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QLabel *qlblStepSize = new QLabel(); qlblStepSize->setText("StepSize"); qspnbxStepSize = new QSpinBox(); qspnbxStepSize->setMinimum(1); qspnbxStepSize->setMaximum(INT_MAX); qspnbxStepSize->setMaximumWidth(50); connect(qspnbxStepSize, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QGridLayout* qglayoutPlayBack = new QGridLayout (); qglayoutPlayBack->addWidget(qrbPersist, 1,1); qglayoutPlayBack->addWidget(qrbIterations, 1, 2); qglayoutPlayBack->addWidget(qspnbxIterations, 1, 3); qglayoutPlayBack->addWidget(qlblInterval, 2, 2); qglayoutPlayBack->addWidget(qspnbxInterval, 2, 3); qglayoutPlayBack->addWidget(qlblStepSize, 3,2); qglayoutPlayBack->addWidget(qspnbxStepSize, 3, 3); qgrpbxPlayBack->setLayout(qglayoutPlayBack); layoutLeftPane->addWidget(qgrpbxPlayBack); /* ------------------------------------ */ QHBoxLayout *qlayoutCmdButtons = new QHBoxLayout( layoutLeftPane, 5); QPushButton *qpbtnApply = new QPushButton ("Send", qfmLeftPane); connect(qpbtnApply, SIGNAL(clicked()), this, SLOT(slotApply())); qpbtnRevoke = new QPushButton ("Revoke", qfmLeftPane); qpbtnRevoke->setEnabled(false); connect(qpbtnRevoke, SIGNAL(clicked()), this, SLOT(slotRevoke())); QPushButton *qpbtnClose = new QPushButton ("Close", qfmLeftPane); connect(qpbtnClose, SIGNAL(clicked()), this, SLOT(close())); qlayoutCmdButtons->addWidget(qpbtnApply); qlayoutCmdButtons->addWidget(qpbtnRevoke); qlayoutCmdButtons->addWidget(qpbtnClose); QToolTip::add(qpbtnPen, "Pencil"); QToolTip::add(qpbtnEraser, "Eraser"); QToolTip::add(qpbtnClear, "Clear"); QToolTip::add(qpbtnAdd, "Add"); QToolTip::add(qrbClamp, "Repace Value"); QToolTip::add(qrbAddPattern, "Add Values"); QToolTip::add(qrbMultiplyPattern, "Mutliply with Values"); QToolTip::add(qrbPersist, "Apply for ever"); QToolTip::add(qspnbxIterations, "Apply for selected timesteps"); QToolTip::add(qspnbxInterval, "Apply every X timestep"); QToolTip::add(qspnbxStepSize, "Apply step by X"); clsQSAList = new ClsQSAList(qsplitter, this); connect(clsQSAList, SIGNAL(sigChangeMatrix(vector <vector<double> >)), this, SLOT(slotMatrixChanged(vector <vector<double> >))); clsQSAList->show(); qsplitter->setResizeMode(clsQSAList, QSplitter::FollowSizeHint); };
SearchReplace::SearchReplace( QWidget* parent, ScribusDoc *doc, PageItem* ite, bool mode ) : QDialog( parent ), matchesFound(0) { m_item = ite; m_doc = doc; m_notFound = false; m_itemMode = mode; m_firstMatchPosition = -1; setModal(true); setWindowTitle( tr( "Search/Replace" ) ); setWindowIcon(IconManager::instance()->loadIcon("AppIcon.png")); SearchReplaceLayout = new QVBoxLayout( this ); SearchReplaceLayout->setMargin(10); SearchReplaceLayout->setSpacing(5); SelLayout = new QHBoxLayout; SelLayout->setMargin(0); SelLayout->setSpacing(5); Search = new QGroupBox( this ); Search->setTitle( tr( "Search for:" ) ); SearchLayout = new QGridLayout( Search ); SearchLayout->setMargin(5); SearchLayout->setSpacing(2); SearchLayout->setAlignment( Qt::AlignTop ); SText = new QCheckBox( Search ); SText->setText( tr( "Text" ) ); SearchLayout->addWidget( SText, 0, 0 ); SStyle = new QCheckBox( Search ); SStyle->setText( tr( "Style" ) ); SearchLayout->addWidget( SStyle, 1, 0 ); SAlign = new QCheckBox( Search ); SAlign->setText( tr( "Alignment" ) ); SearchLayout->addWidget( SAlign, 2, 0 ); SFont = new QCheckBox( Search ); SFont->setText( tr( "Font" ) ); SearchLayout->addWidget( SFont, 3, 0 ); SSize = new QCheckBox( Search ); SSize->setText( tr( "Font Size" ) ); SearchLayout->addWidget( SSize, 4, 0 ); SEffect = new QCheckBox( Search ); SEffect->setText( tr( "Font Effects" ) ); SearchLayout->addWidget( SEffect, 5, 0 ); SFill = new QCheckBox( Search); SFill->setText( tr( "Fill Color" ) ); SearchLayout->addWidget( SFill, 6, 0 ); SFillS = new QCheckBox( Search ); SFillS->setText( tr( "Fill Shade" ) ); SearchLayout->addWidget( SFillS, 7, 0 ); SStroke = new QCheckBox( Search ); SStroke->setText( tr( "Stroke Color" ) ); SearchLayout->addWidget( SStroke, 8, 0 ); SStrokeS = new QCheckBox( Search ); SStrokeS->setText( tr( "Stroke Shade" ) ); SearchLayout->addWidget( SStrokeS, 9, 0 ); STextVal = new QLineEdit( Search ); STextVal->setEnabled(false); SearchLayout->addWidget( STextVal, 0, 1 ); SStyleVal = new QComboBox( Search ); SStyleVal->setEditable(false); for (int x = 0; x < doc->paragraphStyles().count(); ++x) SStyleVal->addItem(doc->paragraphStyles()[x].name()); QListView *tmpView = dynamic_cast<QListView*>(SStyleVal->view()); Q_ASSERT(tmpView); int tmpWidth = tmpView->sizeHintForColumn(0); if (tmpWidth > 0) tmpView->setMinimumWidth(tmpWidth + 24); SStyleVal->setCurrentIndex(findParagraphStyle(doc, doc->currentStyle)); SStyleVal->setEnabled(false); SearchLayout->addWidget( SStyleVal, 1, 1 ); SAlignVal = new QComboBox( Search ); SAlignVal->setEditable(false); QString tmp_sty[] = { tr("Left"), tr("Center"), tr("Right"), tr("Block"), tr("Forced")}; size_t ar_sty = sizeof(tmp_sty) / sizeof(*tmp_sty); for (uint a = 0; a < ar_sty; ++a) SAlignVal->addItem( tmp_sty[a] ); tmpView = dynamic_cast<QListView*>(SAlignVal->view()); Q_ASSERT(tmpView); tmpWidth = tmpView->sizeHintForColumn(0); if (tmpWidth > 0) tmpView->setMinimumWidth(tmpWidth + 24); SAlignVal->setEnabled(false); SearchLayout->addWidget( SAlignVal, 2, 1 ); SFontVal = new FontCombo(Search); SFontVal->setMaximumSize(190, 30); setCurrentComboItem(SFontVal, doc->currentStyle.charStyle().font().scName()); SFontVal->setEnabled(false); SearchLayout->addWidget( SFontVal, 3, 1 ); SSizeVal = new ScrSpinBox( 0.5, 2048, Search, 0 ); SSizeVal->setValue( doc->currentStyle.charStyle().fontSize() / 10.0 ); SSizeVal->setEnabled(false); SearchLayout->addWidget( SSizeVal, 4, 1 ); SEffVal = new StyleSelect( Search ); SEffVal->setStyle(0); SEffVal->setEnabled(false); SearchLayout->addWidget( SEffVal, 5, 1, Qt::AlignLeft ); SFillVal = new ColorCombo( Search ); SFillVal->setEditable(false); SFillVal->setPixmapType(ColorCombo::fancyPixmaps); SFillVal->setColors(doc->PageColors, true); SFillVal->setMinimumWidth(SFillVal->view()->maximumViewportSize().width() + 24); setCurrentComboItem(SFillVal, doc->currentStyle.charStyle().fillColor()); SFillVal->setEnabled(false); SearchLayout->addWidget( SFillVal, 6, 1 ); SFillSVal = new ShadeButton(Search); SFillSVal->setEnabled(false); SearchLayout->addWidget( SFillSVal, 7, 1, Qt::AlignLeft ); SStrokeVal = new ColorCombo( Search ); SStrokeVal->setEditable(false); SStrokeVal->setPixmapType(ColorCombo::fancyPixmaps); SStrokeVal->setColors(doc->PageColors, true); SStrokeVal->view()->setMinimumWidth(SStrokeVal->view()->maximumViewportSize().width() + 24); setCurrentComboItem(SStrokeVal, doc->currentStyle.charStyle().strokeColor()); SStrokeVal->setEnabled(false); SearchLayout->addWidget( SStrokeVal, 8, 1 ); SStrokeSVal = new ShadeButton(Search); SStrokeSVal->setEnabled(false); SearchLayout->addWidget( SStrokeSVal, 9, 1, Qt::AlignLeft ); SelLayout->addWidget( Search ); Replace = new QGroupBox( this ); Replace->setTitle( tr( "Replace with:" ) ); ReplaceLayout = new QGridLayout( Replace ); ReplaceLayout->setSpacing( 2 ); ReplaceLayout->setMargin( 5 ); ReplaceLayout->setAlignment( Qt::AlignTop ); RText = new QCheckBox( Replace ); RText->setText( tr( "Text" ) ); ReplaceLayout->addWidget( RText, 0, 0 ); RStyle = new QCheckBox( Replace ); RStyle->setText( tr( "Style" ) ); ReplaceLayout->addWidget( RStyle, 1, 0 ); RAlign = new QCheckBox( Replace ); RAlign->setText( tr( "Alignment" ) ); ReplaceLayout->addWidget( RAlign, 2, 0 ); RFont = new QCheckBox( Replace ); RFont->setText( tr( "Font" ) ); ReplaceLayout->addWidget( RFont, 3, 0 ); RSize = new QCheckBox( Replace ); RSize->setText( tr( "Font Size" ) ); ReplaceLayout->addWidget( RSize, 4, 0 ); REffect = new QCheckBox( Replace ); REffect->setText( tr( "Font Effects" ) ); ReplaceLayout->addWidget( REffect, 5, 0 ); RFill = new QCheckBox( Replace ); RFill->setText( tr( "Fill Color" ) ); ReplaceLayout->addWidget( RFill, 6, 0 ); RFillS = new QCheckBox( Replace ); RFillS->setText( tr( "Fill Shade" ) ); ReplaceLayout->addWidget( RFillS, 7, 0 ); RStroke = new QCheckBox( Replace ); RStroke->setText( tr( "Stroke Color" ) ); ReplaceLayout->addWidget( RStroke, 8, 0 ); RStrokeS = new QCheckBox( Replace ); RStrokeS->setText( tr( "Stroke Shade" ) ); ReplaceLayout->addWidget( RStrokeS, 9, 0 ); RTextVal = new QLineEdit( Replace ); RTextVal->setEnabled(false); ReplaceLayout->addWidget( RTextVal, 0, 1 ); RStyleVal = new QComboBox( Replace ); RStyleVal->setEditable(false); for (int x = 0; x < doc->paragraphStyles().count(); ++x) RStyleVal->addItem(doc->paragraphStyles()[x].name()); tmpView = dynamic_cast<QListView*>(RStyleVal->view()); Q_ASSERT(tmpView); tmpWidth = tmpView->sizeHintForColumn(0); if (tmpWidth > 0) tmpView->setMinimumWidth(tmpWidth + 24); RStyleVal->setCurrentIndex(findParagraphStyle(doc, doc->currentStyle)); RStyleVal->setEnabled(false); ReplaceLayout->addWidget( RStyleVal, 1, 1 ); RAlignVal = new QComboBox( Replace ); RAlignVal->setEditable(false); for (uint a = 0; a < ar_sty; ++a) RAlignVal->addItem(tmp_sty[a]); tmpView = dynamic_cast<QListView*>(RAlignVal->view()); Q_ASSERT(tmpView); tmpWidth = tmpView->sizeHintForColumn(0); if (tmpWidth > 0) tmpView->setMinimumWidth(tmpWidth + 24); RAlignVal->setEnabled(false); ReplaceLayout->addWidget( RAlignVal, 2, 1 ); RFontVal = new FontCombo(Replace); RFontVal->setMaximumSize(190, 30); setCurrentComboItem(RFontVal, doc->currentStyle.charStyle().font().scName()); RFontVal->setEnabled(false); ReplaceLayout->addWidget( RFontVal, 3, 1 ); RSizeVal = new ScrSpinBox( 0.5, 2048, Replace, 0 ); RSizeVal->setValue( doc->currentStyle.charStyle().fontSize() / 10.0 ); RSizeVal->setEnabled(false); ReplaceLayout->addWidget( RSizeVal, 4, 1 ); REffVal = new StyleSelect( Replace ); REffVal->setStyle(0); REffVal->setEnabled(false); ReplaceLayout->addWidget( REffVal, 5, 1, Qt::AlignLeft ); RFillVal = new ColorCombo( true, Replace ); RFillVal->setEditable(false); RFillVal->setPixmapType(ColorCombo::fancyPixmaps); RFillVal->setColors(doc->PageColors, true); RFillVal->view()->setMinimumWidth(RFillVal->view()->maximumViewportSize().width() + 24); setCurrentComboItem(RFillVal, doc->currentStyle.charStyle().fillColor()); RFillVal->setEnabled(false); ReplaceLayout->addWidget( RFillVal, 6, 1 ); RFillSVal = new ShadeButton(Replace); RFillSVal->setEnabled(false); ReplaceLayout->addWidget( RFillSVal, 7, 1, Qt::AlignLeft ); RStrokeVal = new ColorCombo( true, Replace ); RStrokeVal->setEditable(false); RStrokeVal->setPixmapType(ColorCombo::fancyPixmaps); RStrokeVal->setColors(doc->PageColors, true); RStrokeVal->view()->setMinimumWidth(RStrokeVal->view()->maximumViewportSize().width() + 24); setCurrentComboItem(RStrokeVal, doc->currentStyle.charStyle().strokeColor()); RStrokeVal->setEnabled(false); ReplaceLayout->addWidget( RStrokeVal, 8, 1 ); RStrokeSVal = new ShadeButton(Replace);; RStrokeSVal->setEnabled(false); ReplaceLayout->addWidget( RStrokeSVal, 9, 1, Qt::AlignLeft ); SelLayout->addWidget( Replace ); SearchReplaceLayout->addLayout( SelLayout ); OptsLayout = new QHBoxLayout; OptsLayout->setSpacing( 5 ); OptsLayout->setMargin( 0 ); Word = new QCheckBox( tr( "&Whole Word" ), this ); if (mode) Word->setEnabled(false); OptsLayout->addWidget( Word ); CaseIgnore = new QCheckBox( tr( "&Ignore Case, Diacritics and Kashida" ), this ); if (mode) CaseIgnore->setEnabled(false); OptsLayout->addWidget( CaseIgnore ); SearchReplaceLayout->addLayout( OptsLayout ); ButtonsLayout = new QHBoxLayout; ButtonsLayout->setSpacing( 5 ); ButtonsLayout->setMargin( 0 ); DoSearch = new QPushButton( tr( "&Search" ), this ); DoSearch->setDefault( true ); ButtonsLayout->addWidget( DoSearch ); DoReplace = new QPushButton( tr( "&Replace" ), this ); DoReplace->setEnabled(false); ButtonsLayout->addWidget( DoReplace ); AllReplace = new QPushButton( tr( "Replace &All" ), this ); AllReplace->setEnabled(false); ButtonsLayout->addWidget( AllReplace ); clearButton = new QPushButton( tr("C&lear"), this); ButtonsLayout->addWidget(clearButton); Leave = new QPushButton( tr( "&Close" ), this ); ButtonsLayout->addWidget( Leave ); SearchReplaceLayout->addLayout( ButtonsLayout ); resize(minimumSizeHint()); // signals and slots connections connect( Leave, SIGNAL( clicked() ), this, SLOT( writePrefs() ) ); connect( DoSearch, SIGNAL( clicked() ), this, SLOT( slotSearch() ) ); connect( DoReplace, SIGNAL( clicked() ), this, SLOT( slotReplace() ) ); connect( AllReplace, SIGNAL( clicked() ), this, SLOT( slotReplaceAll() ) ); connect( STextVal, SIGNAL( textChanged(QString) ), this, SLOT( updateSearchButtonState() ) ); connect( SText, SIGNAL( clicked() ), this, SLOT( enableTxSearch() ) ); connect( SStyle, SIGNAL( clicked() ), this, SLOT( enableStyleSearch() ) ); connect( SAlign, SIGNAL( clicked() ), this, SLOT( enableAlignSearch() ) ); connect( SFont, SIGNAL( clicked() ), this, SLOT( enableFontSearch() ) ); connect( SSize, SIGNAL( clicked() ), this, SLOT( enableSizeSearch() ) ); connect( SEffect, SIGNAL( clicked() ), this, SLOT( enableEffSearch() ) ); connect( SFill, SIGNAL( clicked() ), this, SLOT( enableFillSearch() ) ); connect( SFillS, SIGNAL( clicked() ), this, SLOT( enableFillSSearch() ) ); connect( SStrokeS, SIGNAL( clicked() ), this, SLOT( enableStrokeSSearch() ) ); connect( SStroke, SIGNAL( clicked() ), this, SLOT( enableStrokeSearch() ) ); connect( RText, SIGNAL( clicked() ), this, SLOT( enableTxReplace() ) ); connect( RStyle, SIGNAL( clicked() ), this, SLOT( enableStyleReplace() ) ); connect( RAlign, SIGNAL( clicked() ), this, SLOT( enableAlignReplace() ) ); connect( RFont, SIGNAL( clicked() ), this, SLOT( enableFontReplace() ) ); connect( RSize, SIGNAL( clicked() ), this, SLOT( enableSizeReplace() ) ); connect( REffect, SIGNAL( clicked() ), this, SLOT( enableEffReplace() ) ); connect( RFill, SIGNAL( clicked() ), this, SLOT( enableFillReplace() ) ); connect( RStroke, SIGNAL( clicked() ), this, SLOT( enableStrokeReplace() ) ); connect( RFillS, SIGNAL( clicked() ), this, SLOT( enableFillSReplace() ) ); connect( RStrokeS, SIGNAL( clicked() ), this, SLOT( enableStrokeSReplace() ) ); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); //tooltips DoSearch->setToolTip( tr( "Search for text or formatting in the current text" ) ); DoReplace->setToolTip( tr( "Replace the searched for formatting with the replacement values" ) ); AllReplace->setToolTip( tr( "Replace all found instances" ) ); clearButton->setToolTip( tr( "Clear all search and replace options" ) ); Leave->setToolTip( tr( "Close search and replace" ) ); // tab order setTabOrder( SText, SStyle ); setTabOrder( SStyle, SFont ); setTabOrder( SFont, SSize ); setTabOrder( SSize, SEffect ); setTabOrder( SEffect, SFill ); setTabOrder( SFill, SStroke ); setTabOrder( SStroke, STextVal ); setTabOrder( STextVal, SStyleVal ); setTabOrder( SStyleVal, SAlignVal ); setTabOrder( SAlignVal, SFontVal ); setTabOrder( SFontVal, SSizeVal ); setTabOrder( SSizeVal, SEffVal ); setTabOrder( SEffVal, SFillVal ); setTabOrder( SFillVal, SStrokeVal ); setTabOrder( SStrokeVal, RText ); setTabOrder( RText, RStyle ); setTabOrder( RStyle, RFont ); setTabOrder( RFont, RSize ); setTabOrder( RSize, REffect ); setTabOrder( REffect, RFill ); setTabOrder( RFill, RStroke ); setTabOrder( RStroke, RTextVal ); setTabOrder( RTextVal, RStyleVal ); setTabOrder( RStyleVal, RAlignVal ); setTabOrder( RAlignVal, RFontVal ); setTabOrder( RFontVal, RSizeVal ); setTabOrder( RSizeVal, REffVal ); setTabOrder( REffVal, RFillVal ); setTabOrder( RFillVal, RStrokeVal ); setTabOrder( RStrokeVal, Word ); setTabOrder( Word, CaseIgnore ); setTabOrder( CaseIgnore, DoSearch ); setTabOrder( DoSearch, DoReplace ); setTabOrder( DoReplace, AllReplace ); setTabOrder( AllReplace, Leave ); m_prefs = PrefsManager::instance()->prefsFile->getContext("SearchReplace"); readPrefs(); }