author | paule <paule> | 2007-01-13 07:27:50 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:27:50 (UTC) |
commit | ee43ea083b2abea078507677ee30c7af88d248c4 (patch) (side-by-side diff) | |
tree | e9c61153289247a67f043012c04022cd97ab4767 | |
parent | 4892c61a3e76c031d7b882854dcb0dfbd575f045 (diff) | |
download | opie-ee43ea083b2abea078507677ee30c7af88d248c4.zip opie-ee43ea083b2abea078507677ee30c7af88d248c4.tar.gz opie-ee43ea083b2abea078507677ee30c7af88d248c4.tar.bz2 |
Improve layout of Highlight Modes tab so that it fits on QVGA screens, allowing the OK/Cancel buttons on the dialog to be shown.
Fixes bug #1373.
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedialogs.cpp | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedialogs.cpp b/noncore/apps/tinykate/libkate/document/katedialogs.cpp index f4edd7e..b492c26 100644 --- a/noncore/apps/tinykate/libkate/document/katedialogs.cpp +++ b/noncore/apps/tinykate/libkate/document/katedialogs.cpp @@ -3,242 +3,238 @@ ------------------- 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. * * * ***************************************************************************/ #include "katedialogs.h" #include <klocale.h> #include <kdebug.h> #include <qgroupbox.h> #include <qvgroupbox.h> #include <qhgroupbox.h> #include <qhbox.h> #include <qvbox.h> #include <qlayout.h> #include <qpushbutton.h> #include <qwidgetstack.h> #include <qlabel.h> #include <qlistview.h> #include <qlineedit.h> #include <qcombobox.h> #include <qcheckbox.h> //FIXME #include <kcharsets.h> #include <kglobal.h> #include <qmap.h> #include <kmessagebox.h> #include <kstddirs.h> /******************************************************************************************************************* * Context Editor * *******************************************************************************************************************/ StyleChanger::StyleChanger( QWidget *parent ) : QWidget(parent) { QLabel *label; - QGridLayout *glay = new QGridLayout( this, 4, 3, 0, KDialog::spacingHint() ); + QGridLayout *glay = new QGridLayout( this, 2, 6, 0, KDialog::spacingHint() ); CHECK_PTR(glay); glay->addColSpacing( 1, KDialog::spacingHint() ); // Looks better - glay->setColStretch( 2, 10 ); + glay->addColSpacing( 3, KDialog::spacingHint() ); + glay->addColSpacing( 5, KDialog::spacingHint() ); col = new KColorButton(this); CHECK_PTR(col); connect(col,SIGNAL(changed(const QColor&)),this,SLOT(changed())); label = new QLabel(col,i18n("Normal:"),this); CHECK_PTR(label); glay->addWidget(label,0,0); glay->addWidget(col,1,0); selCol = new KColorButton(this); CHECK_PTR(selCol); connect(selCol,SIGNAL(changed(const QColor&)),this,SLOT(changed())); label = new QLabel(selCol,i18n("Selected:"),this); CHECK_PTR(label); - glay->addWidget(label,2,0); - glay->addWidget(selCol,3,0); + glay->addWidget(label,0,2); + glay->addWidget(selCol,1,2); bold = new QCheckBox(i18n("Bold"),this); CHECK_PTR(bold); connect(bold,SIGNAL(clicked()),SLOT(changed())); - glay->addWidget(bold,1,2); + glay->addWidget(bold,0,4); italic = new QCheckBox(i18n("Italic"),this); CHECK_PTR(italic); connect(italic,SIGNAL(clicked()),SLOT(changed())); - glay->addWidget(italic,2,2); + glay->addWidget(italic,1,4); } void StyleChanger::setRef(ItemStyle *s) { style = s; col->setColor(style->col); selCol->setColor(style->selCol); bold->setChecked(style->bold); italic->setChecked(style->italic); } void StyleChanger::setEnabled(bool enable) { col->setEnabled(enable); selCol->setEnabled(enable); bold->setEnabled(enable); italic->setEnabled(enable); } void StyleChanger::changed() { if (style) { style->col = col->color(); style->selCol = selCol->color(); style->bold = bold->isChecked(); style->italic = italic->isChecked(); } } HighlightDialog::HighlightDialog( HlManager *hlManager, ItemStyleList *styleList, HlDataList *highlightDataList, int hlNumber, QWidget *parent, const char *name, bool modal ) :KDialogBase(parent,name,modal,i18n("Highlight Settings"), Ok|Cancel, Ok) { // QVBox *page = makeVBoxMainWidget(); QFrame *page=addPage("FIXME"); (new QVBoxLayout(page))->setAutoAdd(true); content=new HighlightDialogPage(hlManager,styleList,highlightDataList,hlNumber,page); } void HighlightDialog::done(int r) { kdDebug(13010)<<"HighlightDialod done"<<endl; content->saveData(); KDialogBase::done(r); } HighlightDialogPage::HighlightDialogPage(HlManager *hlManager, ItemStyleList *styleList, HlDataList* highlightDataList, int hlNumber,QWidget *parent, const char *name) :QTabWidget(parent,name),defaultItemStyleList(styleList),hlData(0L) { // defaults ========================================================= QFrame *page1 = new QFrame(this); addTab(page1,i18n("&Defaults")); QGridLayout *grid = new QGridLayout(page1, 1, 1); QVGroupBox *dvbox1 = new QVGroupBox( i18n("Default Item Styles"), page1 ); /*QLabel *label = */new QLabel( i18n("Item:"), dvbox1 ); QComboBox *styleCombo = new QComboBox( false, dvbox1 ); defaultStyleChanger = new StyleChanger( dvbox1 ); for( int i = 0; i < hlManager->defaultStyles(); i++ ) { styleCombo->insertItem(hlManager->defaultStyleName(i)); } connect(styleCombo, SIGNAL(activated(int)), this, SLOT(defaultChanged(int))); grid->addWidget(dvbox1, 0,0); defaultChanged(0); // highlight modes ===================================================== QFrame *page2 = new QFrame(this); addTab(page2,i18n("&Highlight Modes")); - //grid = new QGridLayout(page2,2,2); QVBoxLayout *bl=new QVBoxLayout(page2); bl->setAutoAdd(true); - QHGroupBox *hbox1 = new QHGroupBox( i18n("Config Select"), page2 ); - hbox1->layout()->setMargin(5); - QVBox *vbox1=new QVBox(hbox1); -// grid->addMultiCellWidget(vbox1,0,0,0,1); - QVGroupBox *vbox2 = new QVGroupBox( i18n("Item Style"), page2 ); -// grid->addWidget(vbox2,1,0); - QVGroupBox *vbox3 = new QVGroupBox( i18n("Highlight Auto Select"), hbox1 ); - //grid->addWidget(vbox3,1,1); - - QLabel *label = new QLabel( i18n("Highlight:"), vbox1 ); - hlCombo = new QComboBox( false, vbox1 ); - QHBox *modHl = new QHBox(vbox1); + QGroupBox *gbox1 = new QGroupBox( 2, Qt::Horizontal, i18n("Config Select"), page2 ); + gbox1->layout()->setMargin(5); + QGroupBox *gbox2 = new QGroupBox( 2, Qt::Horizontal, i18n("Item Style"), page2 ); + gbox2->layout()->setMargin(5); + + QLabel *label = new QLabel( i18n("Highlight:"), gbox1 ); + hlCombo = new QComboBox( false, gbox1 ); + hlCombo->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum ) ); // connect(new QPushButton(i18n("New"),modHl),SIGNAL(clicked()),this,SLOT(hlNew())); // connect(new QPushButton(i18n("Edit"),modHl),SIGNAL(clicked()),this,SLOT(hlEdit())); connect( hlCombo, SIGNAL(activated(int)), this, SLOT(hlChanged(int)) ); for( int i = 0; i < hlManager->highlights(); i++) { hlCombo->insertItem(hlManager->hlName(i)); } hlCombo->setCurrentItem(hlNumber); + label = new QLabel( i18n("File Extensions:"), gbox1 ); + wildcards = new QLineEdit( gbox1 ); + label = new QLabel( i18n("Mime Types:"), gbox1 ); + mimetypes = new QLineEdit( gbox1 ); - label = new QLabel( i18n("Item:"), vbox2 ); - itemCombo = new QComboBox( false, vbox2 ); + label = new QLabel( i18n("Item:"), gbox2 ); + itemCombo = new QComboBox( false, gbox2 ); connect( itemCombo, SIGNAL(activated(int)), this, SLOT(itemChanged(int)) ); - label = new QLabel( i18n("File Extensions:"), vbox3 ); - wildcards = new QLineEdit( vbox3 ); - label = new QLabel( i18n("Mime Types:"), vbox3 ); - mimetypes = new QLineEdit( vbox3 ); - - - styleDefault = new QCheckBox(i18n("Default"), vbox2 ); + styleDefault = new QCheckBox(i18n("Default"), gbox2 ); connect(styleDefault,SIGNAL(clicked()),SLOT(changed())); - styleChanger = new StyleChanger( vbox2 ); + gbox2->addSpace(1); + gbox2->addSpace(1); + styleChanger = new StyleChanger( gbox2 ); hlDataList = highlightDataList; hlChanged(hlNumber); } void HighlightDialogPage::defaultChanged(int z) { defaultStyleChanger->setRef(defaultItemStyleList->at(z)); } void HighlightDialogPage::hlChanged(int z) { writeback(); hlData = hlDataList->at(z); wildcards->setText(hlData->wildcards); mimetypes->setText(hlData->mimetypes); itemCombo->clear(); for (ItemData *itemData = hlData->itemDataList.first(); itemData != 0L; itemData = hlData->itemDataList.next()) { kdDebug(13010) << itemData->name << endl; itemCombo->insertItem(i18n(itemData->name.latin1())); } itemChanged(0); } void HighlightDialogPage::itemChanged(int z) { itemData = hlData->itemDataList.at(z); styleDefault->setChecked(itemData->defStyle); styleChanger->setRef(itemData); } void HighlightDialogPage::changed() { itemData->defStyle = styleDefault->isChecked(); } void HighlightDialogPage::writeback() { if (hlData) { hlData->wildcards = wildcards->text(); hlData->mimetypes = mimetypes->text(); |