author | llornkcor <llornkcor> | 2002-12-22 18:24:31 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-22 18:24:31 (UTC) |
commit | 3ae485ccb47ca618bc00d96a0e81c978a1cfbdaf (patch) (side-by-side diff) | |
tree | f4a50457221d593f258d2f3f3d55c7b47a7b976d | |
parent | c82ed38520b4038678ab0ab0c9f0ba147d8791ea (diff) | |
download | opie-3ae485ccb47ca618bc00d96a0e81c978a1cfbdaf.zip opie-3ae485ccb47ca618bc00d96a0e81c978a1cfbdaf.tar.gz opie-3ae485ccb47ca618bc00d96a0e81c978a1cfbdaf.tar.bz2 |
use ofontselector, and temp fix for dialog crash
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateview.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | 37 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.h | 2 |
3 files changed, 30 insertions, 11 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index 6453458..63e941f 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -2285,129 +2285,129 @@ void KateView::configDialog() page = kd->addPage(i18n("Fonts")); (new QVBoxLayout(page))->setAutoAdd(true); FontConfig *fontConfig = new FontConfig(page); fontConfig->setFont (myDoc->getFont()); // indent options page=kd->addPage(i18n("Indent")); (new QVBoxLayout(page))->setAutoAdd(true); IndentConfigTab *indentConfig = new IndentConfigTab(page, this); // select options page=kd->addPage(i18n("Select")); (new QVBoxLayout(page))->setAutoAdd(true); SelectConfigTab *selectConfig = new SelectConfigTab(page, this); // edit options page=kd->addPage(i18n("Edit")); (new QVBoxLayout(page))->setAutoAdd(true); EditConfigTab *editConfig = new EditConfigTab(page, this); HighlightDialogPage *hlPage; HlManager *hlManager; HlDataList hlDataList; ItemStyleList defaultStyleList; hlManager = HlManager::self(); defaultStyleList.setAutoDelete(true); hlManager->getDefaults(defaultStyleList); hlDataList.setAutoDelete(true); //this gets the data from the KConfig object hlManager->getHlDataList(hlDataList); page=kd->addPage(i18n("Highlighting")); (new QVBoxLayout(page))->setAutoAdd(true); hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); kd->showMaximized(); if (kd->exec()) { // color options colorConfig->getColors(colors); myDoc->setFont (fontConfig->getFont()); applyColors(); // indent options indentConfig->getData(this); // select options selectConfig->getData(this); // edit options editConfig->getData(this); // spell checker hlManager->setHlDataList(hlDataList); hlManager->setDefaults(defaultStyleList); hlPage->saveData(); } - delete kd; +// delete kd; #endif } int KateView::getHl() { return myDoc->highlightNum(); } void KateView::setDontChangeHlOnSave() { myDoc->setDontChangeHlOnSave(); } void KateView::setHl(int n) { myDoc->setHighlight(n); myDoc->setDontChangeHlOnSave(); myDoc->updateViews(); } int KateView::getEol() { return myDoc->eolMode; } void KateView::setEol(int eol) { if (isReadOnly()) return; myDoc->eolMode = eol; myDoc->setModified(true); } void KateView::paintEvent(QPaintEvent *e) { int x, y; QRect updateR = e->rect(); // update rectangle // debug("Update rect = ( %i, %i, %i, %i )", // updateR.x(),updateR.y(), updateR.width(), updateR.height() ); int ux1 = updateR.x(); int uy1 = updateR.y(); int ux2 = ux1 + updateR.width(); int uy2 = uy1 + updateR.height(); QPainter paint; paint.begin(this); QColorGroup g = colorGroup(); x = width(); y = height(); paint.setPen(g.dark()); if (uy1 <= 0) paint.drawLine(0,0,x-2,0); if (ux1 <= 0) paint.drawLine(0,1,0,y-2); paint.setPen(black); if (uy1 <= 1) paint.drawLine(1,1,x-3,1); if (ux1 <= 1) paint.drawLine(1,2,1,y-3); paint.setPen(g.midlight()); if (uy2 >= y-1) paint.drawLine(1,y-2,x-3,y-2); if (ux2 >= x-1) paint.drawLine(x-2,1,x-2,y-2); diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index a311042..6a19e01 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp @@ -1,112 +1,114 @@ /*************************************************************************** kateviewdialog.cpp - description ------------------- copyright : (C) 2001 by The Kate Team (C) 2002 by Joseph Wenninger email : kwrite-devel@kde.org jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // Dialogs #include <stdio.h> #include <stdlib.h> #include <qgrid.h> #include <qlabel.h> #include <qlayout.h> #include <qlistbox.h> #include <qspinbox.h> #include <qcombobox.h> #include <qgroupbox.h> #include <qlineedit.h> #include <qcheckbox.h> #include <qcollection.h> #include <qpushbutton.h> #include <qobjectlist.h> #include <qradiobutton.h> #include <qwhatsthis.h> #include <qstringlist.h> #include <klocale.h> #include <kcolorbtn.h> #include <qcombobox.h> #include <kglobal.h> #include <qvbox.h> #include <qspinbox.h> #include <kfontdialog.h> #include "../document/katedocument.h" #include "kateviewdialog.h" +#include <opie/ofontselector.h> + SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) , m_replace( 0L ) { QWidget *page = new QWidget( this ); setMainWidget( page ); QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); m_search = new QComboBox( true, page ); m_search->insertStringList( searchFor ); m_search->setMinimumWidth( m_search->sizeHint().width() ); m_search->lineEdit()->selectAll(); QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_search ); topLayout->addWidget( m_optRegExp ); if( flags & KateView::sfReplace ) { // make it a replace dialog setCaption( i18n( "Replace Text" ) ); m_replace = new QComboBox( true, page ); m_replace->insertStringList( replaceWith ); m_replace->setMinimumWidth( m_search->sizeHint().width() ); label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); topLayout->addWidget( label ); topLayout->addWidget( m_replace ); //topLayout->addWidget( m_optPlaceholders ); } QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); topLayout->addWidget( group, 10 ); QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); gbox->setRowStretch( 4, 10 ); m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); gbox->addWidget( m_opt1, 1, 0 ); m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); gbox->addWidget( m_opt2, 2, 0 ); m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); gbox->addWidget( m_opt3, 3, 0 ); m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); gbox->addWidget( m_opt4, 1, 1 ); m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); gbox->addWidget( m_opt5, 2, 1 ); m_opt1->setChecked( flags & KateView::sfCaseSensitive ); m_opt2->setChecked( flags & KateView::sfWholeWords ); m_opt3->setChecked( flags & KateView::sfFromBeginning ); m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); m_opt4->setChecked( flags & KateView::sfBackward ); m_opt5->setChecked( flags & KateView::sfSelected ); if( m_replace ) @@ -464,93 +466,108 @@ void EditConfigTab::getData(KateView *view) int configFlags, z; configFlags = view->config(); for (z = 1; z < numFlags; z++) { configFlags &= ~flags[z]; if (opt[z]->isChecked()) configFlags |= flags[z]; } view->setConfig(configFlags); view->setEncoding (encoding->currentText()); view->doc()->setWordWrapAt(e1->value()); view->doc()->setWordWrap (opt[0]->isChecked()); view->setTabWidth(e2->value()); view->setUndoSteps(e3->value()); } ColorConfig::ColorConfig( QWidget *parent, char *name ) : QWidget( parent, name ) { QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); glay->setColStretch(1,1); glay->setRowStretch(5,1); QLabel *label; label = new QLabel( i18n("Background:"), this); label->setAlignment( AlignRight|AlignVCenter ); m_back = new KColorButton( this ); glay->addWidget( label, 0, 0 ); glay->addWidget( m_back, 0, 1 ); label = new QLabel( i18n("Selected:"), this); label->setAlignment( AlignRight|AlignVCenter ); m_selected = new KColorButton( this ); glay->addWidget( label, 2, 0 ); glay->addWidget( m_selected, 2, 1 ); // QWhatsThis help QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the "<b>Configure Highlighting</b>" dialog.")); } ColorConfig::~ColorConfig() { } void ColorConfig::setColors(QColor *colors) { m_back->setColor( colors[0] ); m_selected->setColor( colors[1] ); } void ColorConfig::getColors(QColor *colors) { colors[0] = m_back->color(); colors[1] = m_selected->color(); } FontConfig::FontConfig( QWidget *parent, char *name ) : QWidget( parent, name ) { // sizemanagment QGridLayout *grid = new QGridLayout( this, 1, 1 ); -#if 0 - m_fontchooser = new KFontChooser ( this ); - m_fontchooser->enableColumn(KFontChooser::StyleList, false); - grid->addWidget( m_fontchooser, 0, 0); - - connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); -#endif +// QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); +// QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); +// int size = cfg. readNumEntry ( "FontSize", 10 ); +// OFontSelector *m_fontselect; + + m_fontselect = new OFontSelector ( false, this, "FontTab" ); +// m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); +// QWhatsThis::add( m_fontselect, +// tr( "Select the desired name, style and size of the default font applications will use." ) ); + + connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), + this, SLOT( slotFontSelected( const QFont & ))); + grid->addWidget( m_fontselect, 0, 0); + + +// #if 0 +// m_fontchooser = new KFontChooser ( this ); +// m_fontchooser->enableColumn(KFontChooser::StyleList, false); +// grid->addWidget( m_fontchooser, 0, 0); + +// connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); +// #endif } FontConfig::~FontConfig() { } void FontConfig::setFont ( const QFont &font ) { -#if 0 - m_fontchooser->setFont (font); +//#if 0 +m_fontselect->setFont (font); myFont = font; -#endif +//#endif } void FontConfig::slotFontSelected( const QFont &font ) { myFont = font; } diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.h b/noncore/apps/tinykate/libkate/view/kateviewdialog.h index 60f30bd..2ce5a11 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.h +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.h @@ -1,97 +1,98 @@ /*************************************************************************** kateviewdialog.h - description ------------------- copyright : (C) 2001 by The Kate Team (C) 2002 by Joseph Wenninger email : kwrite-devel@kde.org jowenn@kde.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // Dialogs #ifndef _KWDIALOG_H_ #define _KWDIALOG_H_ class QCheckBox; class QLineEdit; class QPushButton; class QRadioButton; class QSpinBox; class KColorButton; class QComboBox; #include <kdialogbase.h> +#include <opie/ofontselector.h> #include "kateview.h" class SearchDialog : public KDialogBase { Q_OBJECT public: SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ); QString getSearchFor(); QString getReplaceWith(); int getFlags(); void setSearchText( const QString &searchstr ); protected slots: void slotOk(); protected: QComboBox *m_search; QComboBox *m_replace; QCheckBox *m_opt1; QCheckBox *m_opt2; QCheckBox *m_opt3; QCheckBox *m_optRegExp; QCheckBox *m_opt4; QCheckBox *m_opt5; QCheckBox *m_opt6; }; class ReplacePrompt : public KDialogBase { Q_OBJECT public: ReplacePrompt(QWidget *parent); signals: void clicked(); protected slots: void slotUser1( void ); // All void slotUser2( void ); // No void slotUser3( void ); // Yes virtual void done(int); protected: void closeEvent(QCloseEvent *); }; class GotoLineDialog : public KDialogBase { Q_OBJECT public: GotoLineDialog(QWidget *parent, int line, int max); int getLine(); protected: QSpinBox *e1; @@ -122,73 +123,74 @@ class SelectConfigTab : public QWidget SelectConfigTab(QWidget *parent, KateView *); void getData(KateView *); protected: static const int numFlags = 6; static const int flags[numFlags]; QCheckBox *opt[numFlags]; }; class EditConfigTab : public QWidget { Q_OBJECT public: EditConfigTab(QWidget *parent, KateView *); void getData(KateView *); protected: static const int numFlags = 9; static const int flags[numFlags]; QCheckBox *opt[numFlags]; QComboBox *encoding; QSpinBox *e1; QSpinBox *e2; QSpinBox *e3; }; class ColorConfig : public QWidget { Q_OBJECT public: ColorConfig( QWidget *parent = 0, char *name = 0 ); ~ColorConfig(); void setColors( QColor * ); void getColors( QColor * ); private: KColorButton *m_back; KColorButton *m_selected; }; class FontConfig : public QWidget { Q_OBJECT public: FontConfig( QWidget *parent = 0, char *name = 0 ); ~FontConfig(); void setFont ( const QFont &font ); QFont getFont ( ) { return myFont; }; private: + OFontSelector *m_fontselect; // class KFontChooser *m_fontchooser; QFont myFont; private slots: void slotFontSelected( const QFont &font ); }; #endif //_KWDIALOG_H_ |