--- as_panel.cpp 2003/02/07 16:37:55 1.1
+++ as_panel.cpp 2003/02/10 22:46:06 1.2
@@ -29,7 +29,7 @@
// as_panel.cpp: ISO C++ implementation
//
-#include "as_panel.h"
+#include <vector>
#include <qvariant.h>
#include <qbuttongroup.h>
@@ -37,12 +37,19 @@
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
+#include <qcheckbox.h>
#include <qtabwidget.h>
-#include <qtoolbutton.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
+#include <qstylefactory.h>
+#include <qlayout.h>
+
+#include "as_panel.h"
+#include "as_generic.h"
+#include "as_const.h"
+
//
// Constructs a Prefpanel as a child of 'pParent', with the
@@ -61,45 +68,139 @@
setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5,
(QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth()));
- m_pPrefgroup = new QButtonGroup(this, "Prefbuttons");
- m_pPrefgroup->setGeometry(QRect(230, 350, 220, 60));
-
- m_pOkaybutton = new QPushButton(m_pPrefgroup, "Okaybutton");
- m_pOkaybutton->setGeometry(QRect(10, 20, 86, 30));
-
- m_pCancelbutton = new QPushButton(m_pPrefgroup, "Cancelbutton");
- m_pCancelbutton->setGeometry(QRect(120, 20, 86, 30));
- m_pCancelbutton->setDefault(true);
-
+ m_pVlayout = new QVBoxLayout(this, 11, 6, "Formlayout");
m_pTabselect = new QTabWidget(this, "Tabselector");
- m_pTabselect->setGeometry(QRect(10, 10, 470, 320));
m_pGeneralpage = new QWidget(m_pTabselect, "Generalpage");
+ m_pGenlayout = new QHBoxLayout(m_pGeneralpage, 11, 6, "Genlayout");
+ m_pGenbox = new QGroupBox(m_pGeneralpage, "Groupboxlayout");
- m_pAcctlabel = new QLabel(m_pGeneralpage, "Accfilelabel");
- m_pAcctlabel->setGeometry(QRect(30, 40, 80, 20));
+ m_pGenbox->setColumnLayout(0, Qt::Vertical);
+ m_pGenbox->layout()->setSpacing(6);
+ m_pGenbox->layout()->setMargin(11);
+ m_pGenboxlay = new QHBoxLayout(m_pGenbox->layout());
+ m_pGenboxlay->setAlignment(Qt::AlignTop);
+
+ // Start of text entry preferences UI pieces
+ m_pGeninner = new QGridLayout(0, 6, 2, 0, 12, "Innergrid");
+ m_pAcctlabel = new QLabel(m_pGenbox, "Accfilelabel");
+ m_pGeninner->addWidget(m_pAcctlabel, 0, 0);
+ m_pAcctline = new QLineEdit(m_pGenbox, "Accountline");
+ m_pGeninner->addWidget(m_pAcctline, 0, 1);
+ m_pEventlabel = new QLabel(m_pGenbox, "Evntfilelabel");
+ m_pGeninner->addWidget(m_pEventlabel, 1, 0);
+ m_pEventline = new QLineEdit(m_pGenbox, "Eventline");
+ m_pGeninner->addWidget(m_pEventline, 1, 1);
+ m_pUserlabel = new QLabel(m_pGenbox, "Userlabel");
+ m_pGeninner->addWidget(m_pUserlabel, 2, 0);
+ m_pUserline = new QLineEdit(m_pGenbox, "Userline");
+ m_pGeninner->addWidget(m_pUserline, 2, 1);
+ m_pHomelabel = new QLabel(m_pGenbox, "Homelabel");
+ m_pGeninner->addWidget(m_pHomelabel, 3, 0);
+ m_pHomeline = new QLineEdit(m_pGenbox, "Homeline");
+ m_pGeninner->addWidget(m_pHomeline, 3, 1);
+ m_pCorbalabel = new QLabel(m_pGenbox, "Corbalabel");
+ m_pGeninner->addWidget(m_pCorbalabel, 4, 0);
+ m_pCorbaline = new QLineEdit(m_pGenbox, "Corbaline");
+ m_pGeninner->addWidget(m_pCorbaline, 4, 1);
+ m_pSoaplabel = new QLabel(m_pGenbox, "Soaplabel");
+ m_pGeninner->addWidget(m_pSoaplabel, 5, 0);
+ m_pSoapline = new QLineEdit(m_pGenbox, "Soapline");
+ m_pGeninner->addWidget(m_pSoapline, 5, 1);
+ m_pGenboxlay->addLayout(m_pGeninner);
- m_pAcctline = new QLineEdit(m_pGeneralpage, "Accountline");
- m_pAcctline->setGeometry(QRect(130, 40, 108, 22));
-
- m_pAcctbutton = new QToolButton(m_pGeneralpage, "Accfilebutton");
- m_pAcctbutton->setGeometry(QRect(270, 40, 80, 20));
- m_pAcctbutton->setFocusPolicy(QToolButton::StrongFocus);
+ m_pGenlayout->addWidget(m_pGenbox);
m_pTabselect->insertTab(m_pGeneralpage, "");
- m_pStylepage = new QWidget(m_pTabselect, "Stylepage");
-
- m_pStylegroup = new QButtonGroup(m_pStylepage, "Stylebuttons");
- m_pStylegroup->setGeometry(QRect(150, 30, 140, 230));
-
- m_pStylebutton1 = new QRadioButton(m_pStylegroup, "Stylebutton1");
- m_pStylebutton1->setGeometry(QRect(20, 30, 60, 20));
+ // Start of style chooser UI pieces
+ m_pBoolpage = new QWidget(m_pTabselect, "Tabpage");
+ m_pBoolayout = new QHBoxLayout(m_pBoolpage, 11, 6, "Genlayout");
+ m_pStylegroup = new QButtonGroup(m_pBoolpage, "Stylebuttongroup");
+ m_pStylegroup->setColumnLayout(0, Qt::Vertical);
+ m_pStylegroup->layout()->setSpacing(6);
+ m_pStylegroup->layout()->setMargin(11);
+ m_pStylegroup->setExclusive(true);
+ m_pBoolayout->addWidget(m_pStylegroup);
+
+ m_pStylelay = new QVBoxLayout(m_pStylegroup->layout());
+ m_pStylelay->setAlignment(Qt::AlignTop);
+
+ // Block to handle a vector of radio buttons
+ int nIter = 0;
+ QStringList Styles = QStyleFactory::keys();
+ std::vector<QRadioButton *> Stylevector(Styles.size());
+
+ // Discover which interface styles are available, and
+ // dynamically construct new radio buttons to represent them
+ for (QStringList::Iterator Stylename = Styles.begin();
+ Stylename != Styles.end(); Stylename++) {
+ Stylevector[nIter] = new QRadioButton(m_pStylegroup, *Stylename + "_button");
+ Stylevector[nIter]->setText(tr(*Stylename, "Comment for " + *Stylename));
+ Stylevector[nIter]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding,
+ Stylevector[nIter]->sizePolicy().hasHeightForWidth());
+ QToolTip::add(Stylevector[nIter], tr("The " + *Stylename + " style",
+ "Comment for toolTip " + *Stylename));
+ QWhatsThis::add(Stylevector[nIter], tr("Click this button to enjoy the style of the "
+ + *Stylename + " user interface", "Comment whatsThis for " + *Stylename));
+ m_pStylelay->addWidget(Stylevector[nIter]);
+ nIter++;
+ }
+
+ // Start of binary option UI pieces (like make backups, yes or no)
+ m_pSwitchgroup = new QButtonGroup(m_pBoolpage, "Switchbuttongroup");
+ m_pSwitchgroup->setColumnLayout(0, Qt::Vertical);
+ m_pSwitchgroup->layout()->setSpacing(6);
+ m_pSwitchgroup->layout()->setMargin(11);
+ m_pSwitchgroup->setExclusive(false);
+ m_pSwitchlay = new QVBoxLayout(m_pSwitchgroup->layout());
+ m_pSwitchlay->setAlignment(Qt::AlignTop);
+
+ // Optional file backups with hard coded extension .bak
+ m_pBackupcheck = new QCheckBox(m_pSwitchgroup, "Backupbutton");
+ m_pBackupcheck->setText(tr("Leave a .bak file", "Comment for Backupcheck"));
+ QToolTip::add(m_pBackupcheck, tr("Will make a .bak file when saving", "Comment for toolTip Backupcheck"));
+ QWhatsThis::add(m_pBackupcheck, tr("Check this box to enable automatic file backups when overwriting an existing file", "Comment whatsThis for Backupcheck"));
+ m_pSwitchlay->addWidget(m_pBackupcheck);
+
+ // Optional easy filename appending with hard coded extension .as
+ m_pExtendcheck = new QCheckBox(m_pSwitchgroup, "Extensionbutton");
+ m_pExtendcheck->setText(tr("Append .as extension", "Comment for Extensioncheck"));
+ QToolTip::add(m_pExtendcheck, tr("Use the .as file extension", "Comment for toolTip Extensioncheck"));
+ QWhatsThis::add(m_pExtendcheck, tr("Check this box to automatically append '.as' to new filenames when saving", "Comment whatsThis for Extensioncheck"));
+ m_pSwitchlay->addWidget(m_pExtendcheck);
+
+ m_pBoolayout->addWidget(m_pSwitchgroup);
+ m_pTabselect->insertTab(m_pBoolpage, "");
+ m_pVlayout->addWidget(m_pTabselect);
+
+ // Start of bottom buttons for aknowlegement and commital of changes
+ m_pButtlay = new QHBoxLayout(0, 0, 12, "Buttonlayout");
+ m_pOkaybutton = new QPushButton(this, "Okaybutton");
+ m_pOkaybutton->setMinimumWidth(120);
+ m_pOkaybutton->setPaletteBackgroundColor(QColor(202, 194, 182));
+ m_pOkaybutton->setCursor(QCursor(13));
+ m_pButtlay->addWidget(m_pOkaybutton);
+ m_pApplybutton = new QPushButton(this, "Applybutton");
+ m_pApplybutton->setMinimumWidth(120);
+ m_pApplybutton->setPaletteBackgroundColor(QColor(198, 196, 186));
+ m_pApplybutton->setCursor(QCursor(13));
+ m_pButtlay->addWidget(m_pApplybutton);
+// QSpacerItem *Spacey = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+// m_pButtlay->addItem(Spacey);
+ m_pCancelbutton = new QPushButton(this, "Cancelbutton");
+ m_pCancelbutton->setMinimumWidth(120);
+ m_pCancelbutton->setPaletteBackgroundColor(QColor(198, 196, 186));
+ m_pCancelbutton->setCursor(QCursor(13));
+ m_pButtlay->addWidget(m_pCancelbutton);
+ m_pCancelbutton->setDefault(true);
+ m_pVlayout->addLayout(m_pButtlay);
- m_pStylebutton2 = new QRadioButton(m_pStylegroup, "Stylebutton2");
- m_pStylebutton2->setGeometry(QRect(20, 70, 95, 20));
- m_pTabselect->insertTab(m_pStylepage, "");
+ // Connect our signals to slots, the only one we write is 'apply(void)'
+ connect(m_pOkaybutton, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(m_pApplybutton, SIGNAL(clicked()), this, SLOT(apply()));
+ connect(m_pCancelbutton, SIGNAL(clicked()), this, SLOT(reject()));
this->textChange();
- this->resize(QSize(491, 433).expandedTo(minimumSizeHint()));
+ this->resize(QSize(400, 264).expandedTo(minimumSizeHint()));
}
//
@@ -108,36 +209,50 @@
void Prefpanel::textChange()
{
this->setCaption(tr("AS Applicate Preferences", "Personal preferences are persistent across sessions"));
- m_pPrefgroup->setTitle(tr("Prefbuttons", "Buttons for preferences"));
- QToolTip::add(m_pPrefgroup, tr("Buttons for Preferences", "Comment for toolTip Prefbuttons"));
- QWhatsThis::add(m_pPrefgroup, tr("Buttons for Preferences", "Comment for whatsThis Prefbuttons"));
+
+ m_pTabselect->changeTab(m_pGeneralpage, tr("General"));
+ m_pTabselect->changeTab(m_pBoolpage, tr("Styles"));
+
m_pOkaybutton->setText(tr("Okay", "Comment for Okaybutton"));
- QToolTip::add(m_pOkaybutton, tr("Tooltip for Okaybutton", "Comment for tooltip Okaybutton"));
- QWhatsThis::add(m_pOkaybutton, tr("Whatsthis for Okaybutton", "Comment for whatsThis Okaybutton"));
+ QToolTip::add(m_pOkaybutton, tr("Applies and saves changes", "Comment for tooltip Okaybutton"));
+ QWhatsThis::add(m_pOkaybutton, tr("The okay button applies and saves changes", "Comment for whatsThis Okaybutton"));
+
+ m_pApplybutton->setText(tr("Apply", "Comment for Applybutton"));
+ QToolTip::add(m_pApplybutton, tr("Apply changes immediately", "Comment for toolTip Applybutton"));
+ QWhatsThis::add(m_pApplybutton, tr("The apply button applies changes immediately", "Comment for whatsThis Applybutton"));
+
m_pCancelbutton->setText(tr("Cancel", "Comment for Cancelbutton"));
- QToolTip::add(m_pCancelbutton, tr("Tooltip for Cancelbutton", "Comment for toolTip Cancelbutton"));
- QWhatsThis::add(m_pCancelbutton, tr("Whatsthis for Cancelbutton", "Comment for whatsThis Cancelbutton"));
- QToolTip::add(m_pTabselect, tr("Tooltip for General Preferences", "Comment for toolTip General Preferences"));
- QWhatsThis::add(m_pTabselect, tr("Whats this for General Not sure", "Comment for whatsthis General Preferences"));
- m_pAcctlabel->setText(tr("Account path", "Comment for Accfile"));
- QToolTip::add(m_pAcctlabel, tr("Tooltip for Accfilelabel", "Comment for toolTip Accfilelabel"));
- QWhatsThis::add(m_pAcctlabel, tr("Whatsthis for Accfilelabel", "Comment for whatsThis Accfilelabel"));
- m_pAcctline->setText(tr("Initialname", "Comment for text Lineedit"));
- QToolTip::add(m_pAcctline, tr("Tooltip for Accountfile", "Comment for toolTip Accountfile"));
- QWhatsThis::add(m_pAcctline, tr("Whatsthis for Accountfile", "Comment for whatsThis Accountfile"));
- m_pAcctbutton->setText(tr("Change...", "Text for Accfilebutton"));
- m_pAcctbutton->setTextLabel(tr("Accfile label", "Comment for textLabel Accfilebutton"));
- QToolTip::add(m_pAcctbutton, tr("Tooltip for Accfilebutton", "Comment for toolTip Accfilbutton"));
- QWhatsThis::add(m_pAcctbutton, tr("Whatsthis for Accfilebutton", "Comment for whatsThis Accfilebutton"));
- m_pTabselect->changeTab(m_pGeneralpage, tr("General"));
+ QToolTip::add(m_pCancelbutton, tr("Cancel any changes", "Comment for toolTip Cancelbutton"));
+ QWhatsThis::add(m_pCancelbutton, tr("The cancel button cancels any changes", "Comment for whatsThis Cancelbutton"));
+
+ m_pGenbox->setTitle(tr("Names and numbers", "Comment for Genbox"));
+ m_pAcctlabel->setText(tr("Accounts path", "Comment for Acctlabel"));
+ m_pEventlabel->setText(tr("Events path", "Comment for Eventlabel"));
+ m_pUserlabel->setText(tr("User name", "Comment for Userlabel"));
+ m_pHomelabel->setText(tr("Home directory", "Comment for Homelabel"));
+ m_pCorbalabel->setText(tr("CORBA host", "Comment for Corbalabel"));
+ m_pSoaplabel->setText(tr("SOAP host", "Comment for Soaplabel"));
+ QToolTip::add(m_pAcctline, tr("The accounts file pathname", "Comment for toolTip Acctline"));
+ QToolTip::add(m_pEventline, tr("The events file pathname", "Comment for toolTip Eventline"));
+ QToolTip::add(m_pUserline, tr("The user name", "Comment for toolTip Userline"));
+ QToolTip::add(m_pHomeline, tr("The home directory", "Comment for toolTip Homeline"));
+ QToolTip::add(m_pCorbaline, tr("The CORBA host name", "Comment for toolTip Corbaline"));
+ QToolTip::add(m_pSoapline, tr("The SOAP host name", "Comment for toolTip Soapline"));
+
m_pStylegroup->setTitle(tr("Available styles", "Comment for Stylebuttons"));
- QToolTip::add(m_pStylegroup, tr("Tooltip for Stylebutton", "Comment for toolTip Stylebutton"));
- QWhatsThis::add(m_pStylegroup, tr("Whatsthis for Stylebutton", "Comment for whatsThis Stylebuttons"));
- m_pStylebutton1->setText(tr("Erste", "Comment for Stylebutton1"));
- QToolTip::add(m_pStylebutton1, tr("Tooltip for Stylebutton1", "Comment for toolTip Stylebutton1"));
- QWhatsThis::add(m_pStylebutton1, tr("Whatsthis for Stylebutton1", "Comment whatsThis for Stylebutton1"));
- m_pStylebutton2->setText(tr("Zweite", "Comment for Stylebutton2"));
- QToolTip::add(m_pStylebutton2, tr("Tooltip for Stylebutton2", "Comment toolTip for Stylebutton2"));
- QWhatsThis::add(m_pStylebutton2, tr("Whatsthis for Stylebutton2", "Comment for whatsThis Stylebutton2"));
- m_pTabselect->changeTab(m_pStylepage, tr("Styles"));
+// QToolTip::add(m_pStylegroup, tr("Tooltip for Stylebutton", "Comment for toolTip Stylebutton"));
+// QWhatsThis::add(m_pStylegroup, tr("Whatsthis for Stylebutton", "Comment for whatsThis Stylebuttons"));
+
+ m_pSwitchgroup->setTitle(tr("Yes or no options", "Comment for Switchbox"));
+// QToolTip::add(m_pSwitchgroup, tr("Tooltip for Switchbox", "Comment for toolTip Switchbox"));
+// QWhatsThis::add(m_pSwitchgroup, tr("Whatsthis for Switchbutton", "Comment for whatsThis Switchbox"));
+}
+
+//
+// Applies changes user selected from this class
+//
+void Prefpanel::apply(void)
+{
+ Prototype Unimp;
+ Unimp.doMbox();
}
|