author | tille <tille> | 2002-07-07 17:18:50 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-07 17:18:50 (UTC) |
commit | 04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d (patch) (side-by-side diff) | |
tree | 91ed01ce29ec4dfd478f75239f874a22d1672a14 /noncore/apps/confedit/mainwindow.cpp | |
parent | a72877e867e70784e3c865fa2948ac40f72b5c39 (diff) | |
download | opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.zip opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.tar.gz opie-04f29267e391eb4ad7ff9fc86468f6ccd1bd8f6d.tar.bz2 |
better layout
Diffstat (limited to 'noncore/apps/confedit/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/confedit/mainwindow.cpp | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp index fc403d2..6de8741 100644 --- a/noncore/apps/confedit/mainwindow.cpp +++ b/noncore/apps/confedit/mainwindow.cpp @@ -18,4 +18,5 @@ #include <qpe/config.h> #include <qpe/qpetoolbar.h> +#include <qpe/qpeapplication.h> #include <qaction.h> #include <qmessagebox.h> @@ -35,32 +36,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : - QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0) + QDialog( parent, name, f ), _currentItem(0), _fileItem(0) { setCaption( tr("Conf File Editor") ); - QWidget *mainWidget = new QWidget(this); - setCentralWidget( mainWidget); - QGridLayout *mainLayout = new QGridLayout( mainWidget ); - mainLayout->setSpacing( 3 ); - mainLayout->setMargin( 3 ); +// setBaseSize( qApp->globalStrut() ); + setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); + mainLayout = new QVBoxLayout( this ); + mainLayout->setSpacing( 0 ); + mainLayout->setMargin( 0 ); - qDebug("settingList"); + + qDebug("creating settingList"); settingList = new ListViewConfDir( "/root/Settings/", this, "settingslist"); - settingList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding));//, sizePolicy().hasHeightForWidth() ) ); - mainLayout->addWidget( settingList, 0, 0 ); + settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) ); + mainLayout->addWidget( settingList, 0); - qDebug("editor"); + qDebug("creating editor"); editor = new EditWidget(this); - editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum));//, sizePolicy().hasHeightForWidth() ) ); -// editor->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3));//, sizePolicy().hasHeightForWidth() ) ); - mainLayout->addWidget( editor, 1, 0 ); + editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) ); + mainLayout->addWidget( editor, 1 ); + editor->layoutType( ListViewItemConf::File ); makeMenu(); - qDebug("connect"); connect(settingList, SIGNAL( pressed(QListViewItem*) ), this, SLOT(setCurrent(QListViewItem*))); - + connect( settingList, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( stopTimer( QListViewItem* ) ) ); connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ), @@ -70,9 +72,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ), SLOT( valueChanged(const QString&) ) ); -// qDebug("editor->hide()"); -// editor->hide(); - qDebug("connect"); - connect( settingList, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( stopTimer( QListViewItem* ) ) ); + setCurrent(0); } @@ -80,11 +78,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : void MainWindow::makeMenu() { - qDebug("MainWindow::makeMenu()"); - popupTimer = new QTimer(this); popupMenuFile = new QPopupMenu(this); popupMenuEntry = new QPopupMenu(this); - qDebug("Save"); popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 ); popupActionSave->addTo( popupMenuFile ); @@ -93,5 +88,4 @@ void MainWindow::makeMenu() this , SLOT( saveConfFile() ) ); - qDebug("Revert"); popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 ); popupActionRevert->addTo( popupMenuFile ); @@ -100,5 +94,4 @@ void MainWindow::makeMenu() this , SLOT( revertConfFile() ) ); - qDebug("Delete"); popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 ); popupActionDelete->addTo( popupMenuFile ); @@ -107,8 +100,6 @@ void MainWindow::makeMenu() this , SLOT( removeConfFile() ) ); - qDebug("connect"); connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); - qDebug("connect"); } @@ -121,5 +112,5 @@ MainWindow::~MainWindow() void MainWindow::setCurrent(QListViewItem *item) { - editor->hide(); +// qDebug("MainWindow::setCurrent"); if (!item) return; _item = (ListViewItemConf*) item; @@ -128,10 +119,9 @@ void MainWindow::setCurrent(QListViewItem *item) if (_item->getType() == ListViewItemConf::File) { - updateGeometry(); + editor->layoutType(EditWidget::File); _currentItem=0; _fileItem = (ListViewItemConfFile*)item; return; } - editor->show(); _fileItem = 0; _currentItem = (ListViewItemConfigEntry*)item; @@ -145,13 +135,10 @@ void MainWindow::setCurrent(QListViewItem *item) if (!key.isEmpty()) { - editor->isKey(true); + editor->layoutType(EditWidget::Entry); editor->LineEditKey->setText(key); editor->LineEditValue->setText(val); }else{ - editor->isKey(false); + editor->layoutType(EditWidget::Group); } - updateGeometry(); - editor->updateGeometry(); - settingList->updateGeometry(); } @@ -198,4 +185,5 @@ void MainWindow::removeConfFile() _item->remove(); } + void MainWindow::showPopup() { |