USBViewer::USBViewer(QWidget *parent, const char *name, const QStringList &) : KCModule(USBFactory::instance(), parent, name) { setButtons(Help); setQuickHelp( i18n("<h1>USB Devices</h1> This module allows you to see" " the devices attached to your USB bus(es).")); QVBoxLayout *vbox = new QVBoxLayout(this, 0, KDialog::spacingHint()); QGroupBox *gbox = new QGroupBox(i18n("USB Devices"), this); gbox->setColumnLayout(0, Qt::Horizontal); vbox->addWidget(gbox); QVBoxLayout *vvbox = new QVBoxLayout(gbox->layout(), KDialog::spacingHint()); QSplitter *splitter = new QSplitter(gbox); vvbox->addWidget(splitter); _devices = new QListView(splitter); _devices->addColumn(i18n("Device")); _devices->setRootIsDecorated(true); _devices->header()->hide(); _devices->setMinimumWidth(200); _devices->setColumnWidthMode(0, QListView::Maximum); QValueList< int > sizes; sizes.append(200); splitter->setSizes(sizes); _details = new QTextView(splitter); splitter->setResizeMode(_devices, QSplitter::KeepSize); QTimer *refreshTimer = new QTimer(this); // 1 sec seems to be a good compromise between latency and polling load. refreshTimer->start(1000); connect(refreshTimer, SIGNAL(timeout()), SLOT(refresh())); connect(_devices, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(selectionChanged(QListViewItem *))); KAboutData *about = new KAboutData(I18N_NOOP("kcmusb"), I18N_NOOP("KDE USB Viewer"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 2001 Matthias Hoelzer-Kluepfel")); about->addAuthor("Matthias Hoelzer-Kluepfel", 0, "*****@*****.**"); about->addCredit("Leo Savernik", "Live Monitoring of USB Bus", "*****@*****.**"); setAboutData(about); load(); }
XDSettingsWidget::XDSettingsWidget(XDSettings* settings, QWidget *parent, const char *name) : DebuggerTab(parent, name), m_settings(settings) { QVBoxLayout *mainLayout = new QVBoxLayout(this, 16, 5); QHBoxLayout* jitbox = new QHBoxLayout(0, 1, 10); m_ckEnableJIT = new QCheckBox(this); m_ckEnableJIT->setText(i18n("Enable JIT")); jitbox->addWidget(m_ckEnableJIT); mainLayout->addLayout(jitbox); QHBoxLayout* portbox = new QHBoxLayout(0, 1, 10); QLabel* lblistenPort = new QLabel(this); lblistenPort->setText(i18n("Listen on port:")); portbox->addWidget(lblistenPort); m_spListenPort = new QSpinBox(this); m_spListenPort->setMaxValue(99999); portbox->addWidget(m_spListenPort); portbox->addItem(new QSpacerItem( 40, 0, QSizePolicy::Expanding, QSizePolicy::Minimum )); mainLayout->addLayout(portbox); QGroupBox* groupbox = new QGroupBox(this); groupbox->setTitle(i18n("Options")); groupbox->setColumnLayout(0, Qt::Vertical ); QVBoxLayout* groupboxLayout = new QVBoxLayout(groupbox->layout()); groupboxLayout->setAlignment(Qt::AlignTop); QVBoxLayout* vbox = new QVBoxLayout(0, 3, 6); m_ckBreakOnLoad = new QCheckBox(groupbox); m_ckBreakOnLoad->setText(i18n("Break on load")); vbox->addWidget(m_ckBreakOnLoad); m_ckSendSuperGlobals = new QCheckBox(groupbox); m_ckSendSuperGlobals->setText(i18n("Send super global variables")); vbox->addWidget(m_ckSendSuperGlobals); groupboxLayout->addLayout(vbox); mainLayout->addWidget(groupbox); mainLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); }
MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *parent, const char *name ) : KDialogBase( parent, name, true, i18n("PIC Settings"), KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Ok, true ) { m_pMicroSettings = microSettings; m_pNewPinMappingWidget = 0l; m_pNewPinMappingDlg = 0l; m_pWidget = new MicroSettingsWidget(this); QWhatsThis::add( this, i18n("This dialog allows editing of the initial properties of the PIC") ); QWhatsThis::add( m_pWidget->portsGroupBox, i18n("Edit the initial value of the ports here. For each binary number, the order from right-to-left is pins 0 through 7.<br><br>The \"Type (TRIS)\" edit shows the initial input/output state of the ports; 1 represents an input, and 0 an output.<br><br>The \"State (PORT)\" edit shows the initial high/low state of the ports; 1 represents a high, and 0 a low.") ); QWhatsThis::add( m_pWidget->variables, i18n("Edit the initial value of the variables here.<br><br>Note that the value of the variable can only be in the range 0->255. These variables will be initialized before any other code is executed.") ); //BEGIN Initialize initial port settings m_portNames = microSettings->microInfo()->package()->portNames(); m_portTypeEdit.resize( m_portNames.size(), 0 ); m_portStateEdit.resize( m_portNames.size(), 0 ); uint row = 0; QStringList::iterator end = m_portNames.end(); for ( QStringList::iterator it = m_portNames.begin(); it != end; ++it, ++row ) { //BEGIN Get current Type / State text QString portType = QString::number( microSettings->portType(*it), 2 ); QString portState = QString::number( microSettings->portState(*it), 2 ); QString fill; fill.fill( '0', 8-portType.length() ); portType.prepend(fill); fill.fill( '0', 8-portState.length() ); portState.prepend(fill); //END Get current Type / State text QGroupBox * groupBox = new QGroupBox( *it, m_pWidget->portsGroupBox ); groupBox->setColumnLayout(0, Qt::Vertical ); groupBox->layout()->setSpacing( 6 ); groupBox->layout()->setMargin( 11 ); QGridLayout * groupBoxLayout = new QGridLayout( groupBox->layout() ); groupBoxLayout->setAlignment( Qt::AlignTop ); // TODO: replace this with i18n( "the type", "Type (TRIS register):" ); groupBoxLayout->addWidget( new QLabel( i18n("Type (TRIS register):"), groupBox ), 0, 0 ); groupBoxLayout->addWidget( new QLabel( i18n("State (PORT register):"), groupBox ), 1, 0 ); m_portTypeEdit[row] = new KLineEdit( portType, groupBox ); groupBoxLayout->addWidget( m_portTypeEdit[row], 0, 1 ); m_portStateEdit[row] = new KLineEdit( portState, groupBox ); groupBoxLayout->addWidget( m_portStateEdit[row], 1, 1 ); // (dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->insertWidget( row, groupBox ); (dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->addWidget( groupBox ); } //END Initialize initial port settings //BEGIN Initialize initial variable settings // Hide row headers m_pWidget->variables->setLeftMargin(0); // Make columns as thin as possible m_pWidget->variables->setColumnStretchable( 0, true ); m_pWidget->variables->setColumnStretchable( 1, true ); QStringList variables = microSettings->variableNames(); row = 0; end = variables.end(); for ( QStringList::iterator it = variables.begin(); it != end; ++it ) { VariableInfo *info = microSettings->variableInfo(*it); if (info) { m_pWidget->variables->insertRows( row, 1 ); m_pWidget->variables->setText( row, 0, *it ); m_pWidget->variables->setText( row, 1, info->valueAsString() ); ++row; } } m_pWidget->variables->insertRows( row, 1 ); connect( m_pWidget->variables, SIGNAL(valueChanged(int,int)), this, SLOT(checkAddVariableRow()) ); //END Initialize initial variable settings //BEGIN Initialize pin maps connect( m_pWidget->pinMapAdd, SIGNAL(clicked()), this, SLOT(slotCreatePinMap()) ); connect( m_pWidget->pinMapModify, SIGNAL(clicked()), this, SLOT(slotModifyPinMap()) ); connect( m_pWidget->pinMapRename, SIGNAL(clicked()), this, SLOT(slotRenamePinMap()) ); connect( m_pWidget->pinMapRemove, SIGNAL(clicked()), this, SLOT(slotRemovePinMap()) ); m_pinMappings = microSettings->pinMappings(); m_pWidget->pinMapCombo->insertStringList( m_pinMappings.keys() ); updatePinMapButtons(); //END Initialize pin maps enableButtonSeparator( false ); setMainWidget(m_pWidget); m_pWidget->adjustSize(); adjustSize(); connect( this, SIGNAL(applyClicked()), this, SLOT(slotSaveStuff()) ); }
KBellConfig::KBellConfig(QWidget *parent, const char *name): KCModule(parent, name) { QBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); int row = 0; QGroupBox *box = new QGroupBox( i18n("Bell Settings"), this ); box->setColumnLayout( 0, Qt::Horizontal ); layout->addWidget(box); layout->addStretch(); QGridLayout *grid = new QGridLayout(box->layout(), KDialog::spacingHint()); grid->setColStretch(0, 0); grid->setColStretch(1, 1); grid->addColSpacing(0, 30); m_useBell = new QCheckBox( i18n("&Use system bell instead of system notification" ), box ); QWhatsThis::add(m_useBell, i18n("You can use the standard system bell (PC speaker) or a " "more sophisticated system notification, see the " "\"System Notifications\" control module for the " "\"Something Special Happened in the Program\" event.")); connect(m_useBell, SIGNAL( toggled( bool )), SLOT( useBell( bool ))); row++; grid->addMultiCellWidget(m_useBell, row, row, 0, 1); setQuickHelp( i18n("<h1>System Bell</h1> Here you can customize the sound of the standard system bell," " i.e. the \"beep\" you always hear when there is something wrong. Note that you can further" " customize this sound using the \"Accessibility\" control module; for example, you can choose" " a sound file to be played instead of the standard bell.")); m_volume = new KIntNumInput(50, box); m_volume->setLabel(i18n("&Volume:")); m_volume->setRange(0, 100, 5); m_volume->setSuffix("%"); m_volume->setSteps(5,25); grid->addWidget(m_volume, ++row, 1); QWhatsThis::add( m_volume, i18n("Here you can customize the volume of the system bell. For further" " customization of the bell, see the \"Accessibility\" control module.") ); m_pitch = new KIntNumInput(m_volume, 800, box); m_pitch->setLabel(i18n("&Pitch:")); m_pitch->setRange(20, 2000, 20); m_pitch->setSuffix(i18n(" Hz")); m_pitch->setSteps(40,200); grid->addWidget(m_pitch, ++row, 1); QWhatsThis::add( m_pitch, i18n("Here you can customize the pitch of the system bell. For further" " customization of the bell, see the \"Accessibility\" control module.") ); m_duration = new KIntNumInput(m_pitch, 100, box); m_duration->setLabel(i18n("&Duration:")); m_duration->setRange(1, 1000, 50); m_duration->setSuffix(i18n(" msec")); m_duration->setSteps(20,100); grid->addWidget(m_duration, ++row, 1); QWhatsThis::add( m_duration, i18n("Here you can customize the duration of the system bell. For further" " customization of the bell, see the \"Accessibility\" control module.") ); QBoxLayout *boxLayout = new QHBoxLayout(); m_testButton = new QPushButton(i18n("&Test"), box, "test"); boxLayout->addWidget(m_testButton, 0, AlignRight); grid->addLayout( boxLayout, ++row, 1 ); connect( m_testButton, SIGNAL(clicked()), SLOT(ringBell())); QWhatsThis::add( m_testButton, i18n("Click \"Test\" to hear how the system bell will sound using your changed settings.") ); // watch for changes connect(m_volume, SIGNAL(valueChanged(int)), SLOT(changed())); connect(m_pitch, SIGNAL(valueChanged(int)), SLOT(changed())); connect(m_duration, SIGNAL(valueChanged(int)), SLOT(changed())); KAboutData *about = new KAboutData(I18N_NOOP("kcmbell"), I18N_NOOP("KDE Bell Control Module"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 1997 - 2001 Christian Czezatke, Matthias Elter")); about->addAuthor("Christian Czezatke", I18N_NOOP("Original author"), "*****@*****.**"); about->addAuthor("Bernd Wuebben", 0, "*****@*****.**"); about->addAuthor("Matthias Elter", I18N_NOOP("Current maintainer"), "*****@*****.**"); about->addAuthor("Carsten Pfeiffer", 0, "*****@*****.**"); setAboutData(about); load(); }
DominoConfig::DominoConfig( KConfig* config, QWidget* parent ) : QObject( parent ) { conf = new KConfig("kwindominorc"); KGlobal::locale()->insertCatalogue("kwin_clients"); vBox = new QVBox( parent ); customBorderColor = new QCheckBox( i18n("Custom border color"), vBox ); QHBox *hbox1 = new QHBox(vBox); hbox1->layout()->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum) ); borderColor = new KColorButton(hbox1); customButtonColor = new QCheckBox( i18n("Custom button color"), vBox ); QHBox *hbox2 = new QHBox(vBox); hbox2->layout()->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum) ); buttonColor = new KColorButton(hbox2); customButtonIconColor = new QCheckBox( i18n("Custom button icon color"), vBox ); QHBox *hbox3 = new QHBox(vBox); hbox3->layout()->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum) ); buttonIconColor = new KColorButton(hbox3); customGradientColors = new QCheckBox( i18n("Custom gradient colors"), vBox); QHBox *hbox4 = new QHBox(vBox); hbox4->layout()->addItem(new QSpacerItem(22, 0, QSizePolicy::Fixed, QSizePolicy::Minimum) ); QVBox *vbox1 = new QVBox(hbox4); new QLabel( i18n("Top gradient color"), vbox1); topGradientColor = new KColorButton(vbox1); new QLabel(i18n("Bottom gradient color"), vbox1); bottomGradientColor = new KColorButton(vbox1); showInactiveButtons = new QCheckBox( i18n("Show inactive buttons"), vBox ); showButtonIcons = new QCheckBox( i18n("Show button icons"), vBox ); darkFrame = new QCheckBox( i18n("Dark window frame"), vBox ); /////////////////////////////////////// QGroupBox* colorGb = new QGroupBox(vBox); colorGb->setTitle(i18n("Button contour colors:")); colorGb->setColumnLayout(0, Qt::Vertical ); colorGb->layout()->setSpacing( 6 ); colorGb->layout()->setMargin( 11 ); QGridLayout* gbLayout = new QGridLayout( colorGb->layout(), 4, 2 ); gbLayout->setAlignment( Qt::AlignTop ); QLabel* labelSC = new QLabel(i18n("Standard color:"), colorGb); buttonContourColor = new KColorButton(colorGb); buttonContourColor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); QLabel* labelMC = new QLabel(i18n("Mouseover color:"), colorGb); buttonMouseOverContourColor = new KColorButton(colorGb); QLabel* labelPC = new QLabel(i18n("Pressed color:"), colorGb); buttonPressedContourColor = new KColorButton(colorGb); useDominoStyleContourColors = new QCheckBox( i18n("Use domino style contour colors"), colorGb ); gbLayout->addMultiCellWidget(useDominoStyleContourColors, 0, 0, 0, 1); gbLayout->addWidget(labelSC, 1, 0); gbLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Minimum) ); gbLayout->addWidget(buttonContourColor, 1, 1); gbLayout->addWidget(labelMC, 2, 0); gbLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Minimum) ); gbLayout->addWidget(buttonMouseOverContourColor, 2, 1); gbLayout->addWidget(labelPC, 3, 0); gbLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Minimum) ); gbLayout->addWidget(buttonPressedContourColor, 3, 1); /////////////////////////////////////// // Load configuration options load(config); // Ensure we track user changes properly connect(customGradientColors, SIGNAL(toggled(bool)), topGradientColor, SLOT(setEnabled(bool))); connect(customGradientColors, SIGNAL(toggled(bool)), bottomGradientColor, SLOT(setEnabled(bool))); connect(customBorderColor, SIGNAL(toggled(bool)), borderColor, SLOT(setEnabled(bool))); connect(customButtonColor, SIGNAL(toggled(bool)), buttonColor, SLOT(setEnabled(bool))); connect(customButtonIconColor, SIGNAL(toggled(bool)), buttonIconColor, SLOT(setEnabled(bool))); connect(customGradientColors, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(topGradientColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(bottomGradientColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(customBorderColor, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(borderColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(customButtonColor, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(buttonColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(customButtonIconColor, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(buttonIconColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(showInactiveButtons, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(showButtonIcons, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(darkFrame, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(useDominoStyleContourColors, SIGNAL(clicked()), this, SLOT(loadButtonContourColors())); connect(useDominoStyleContourColors, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); connect(buttonContourColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(buttonMouseOverContourColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); connect(buttonPressedContourColor, SIGNAL(changed(const QColor&)), this, SLOT(slotSelectionChanged())); // Make the widgets visible in kwindecoration valueChanged vBox->show(); }
MailingListFolderPropertiesDialog::MailingListFolderPropertiesDialog(QWidget *parent, KMFolder *folder) : KDialogBase(parent, "mailinglist_properties", false, i18n("Mailinglist Folder Properties"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true), mFolder(folder) { setWFlags(getWFlags() | WDestructiveClose); QLabel *label; mLastItem = 0; QVBoxLayout *topLayout = new QVBoxLayout(layout(), spacingHint(), "topLayout"); QGroupBox *mlGroup = new QGroupBox(i18n("Associated Mailing List"), this); mlGroup->setColumnLayout(0, Qt::Vertical); QGridLayout *groupLayout = new QGridLayout(mlGroup->layout(), 6, 3, spacingHint()); topLayout->addWidget(mlGroup); setMainWidget(mlGroup); mHoldsMailingList = new QCheckBox(i18n("&Folder holds a mailing list"), mlGroup); QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)), SLOT(slotHoldsML(bool))); groupLayout->addMultiCellWidget(mHoldsMailingList, 0, 0, 0, 2); groupLayout->addItem(new QSpacerItem(0, 10), 1, 0); mDetectButton = new QPushButton(i18n("Detect Automatically"), mlGroup); mDetectButton->setEnabled(false); QObject::connect(mDetectButton, SIGNAL(pressed()), SLOT(slotDetectMailingList())); groupLayout->addWidget(mDetectButton, 2, 1); groupLayout->addItem(new QSpacerItem(0, 10), 3, 0); label = new QLabel(i18n("Mailing list description:"), mlGroup); label->setEnabled(false); QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)), label, SLOT(setEnabled(bool))); groupLayout->addWidget(label, 4, 0); mMLId = new QLabel(label, "", mlGroup); groupLayout->addMultiCellWidget(mMLId, 4, 4, 1, 2); mMLId->setEnabled(false); //FIXME: add QWhatsThis label = new QLabel(i18n("Preferred handler:"), mlGroup); label->setEnabled(false); QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)), label, SLOT(setEnabled(bool))); groupLayout->addWidget(label, 5, 0); mMLHandlerCombo = new QComboBox(mlGroup); mMLHandlerCombo->insertItem(i18n("KMail"), MailingList::KMail); mMLHandlerCombo->insertItem(i18n("Browser"), MailingList::Browser); mMLHandlerCombo->setEnabled(false); groupLayout->addMultiCellWidget(mMLHandlerCombo, 5, 5, 1, 2); QObject::connect(mMLHandlerCombo, SIGNAL(activated(int)), SLOT(slotMLHandling(int))); label->setBuddy(mMLHandlerCombo); label = new QLabel(i18n("&Address type:"), mlGroup); label->setEnabled(false); QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)), label, SLOT(setEnabled(bool))); groupLayout->addWidget(label, 6, 0); mAddressCombo = new QComboBox(mlGroup); label->setBuddy(mAddressCombo); groupLayout->addWidget(mAddressCombo, 6, 1); mAddressCombo->setEnabled(false); //FIXME: if the mailing list actions have either KAction's or toolbar buttons // associated with them - remove this button since it's really silly // here QPushButton *handleButton = new QPushButton(i18n("Invoke Handler"), mlGroup); handleButton->setEnabled(false); if(mFolder) { QObject::connect(mHoldsMailingList, SIGNAL(toggled(bool)), handleButton, SLOT(setEnabled(bool))); QObject::connect(handleButton, SIGNAL(clicked()), SLOT(slotInvokeHandler())); } groupLayout->addWidget(handleButton, 6, 2); mEditList = new KEditListBox(mlGroup); mEditList->setEnabled(false); groupLayout->addMultiCellWidget(mEditList, 7, 7, 0, 3); QStringList el; //Order is important because the activate handler and fillMLFromWidgets //depend on it el << i18n("Post to List") << i18n("Subscribe to List") << i18n("Unsubscribe from List") << i18n("List Archives") << i18n("List Help"); mAddressCombo->insertStringList(el); QObject::connect(mAddressCombo, SIGNAL(activated(int)), SLOT(slotAddressChanged(int))); load(); resize(QSize(295, 204).expandedTo(minimumSizeHint())); clearWState(WState_Polished); }
K3bWriterSelectionWidget::K3bWriterSelectionWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { d = new Private; d->forceAutoSpeed = false; d->supportedWritingApps = K3b::CDRECORD|K3b::CDRDAO|K3b::GROWISOFS; d->lastSetSpeed = -1; QGroupBox* groupWriter = new QGroupBox( this ); groupWriter->setTitle( i18n( "Burn Medium" ) ); groupWriter->setColumnLayout(0, Qt::Vertical ); groupWriter->layout()->setSpacing( 0 ); groupWriter->layout()->setMargin( 0 ); QGridLayout* groupWriterLayout = new QGridLayout( groupWriter->layout() ); groupWriterLayout->setAlignment( Qt::AlignTop ); groupWriterLayout->setSpacing( KDialog::spacingHint() ); groupWriterLayout->setMargin( KDialog::marginHint() ); QLabel* labelSpeed = new QLabel( groupWriter, "TextLabel1" ); labelSpeed->setText( i18n( "Speed:" ) ); m_comboSpeed = new KComboBox( false, groupWriter, "m_comboSpeed" ); m_comboSpeed->setAutoMask( false ); m_comboSpeed->setDuplicatesEnabled( false ); m_comboMedium = new MediaSelectionComboBox( groupWriter ); m_writingAppLabel = new QLabel( i18n("Writing app:"), groupWriter ); m_comboWritingApp = new KComboBox( groupWriter ); groupWriterLayout->addWidget( m_comboMedium, 0, 0 ); groupWriterLayout->addWidget( labelSpeed, 0, 1 ); groupWriterLayout->addWidget( m_comboSpeed, 0, 2 ); groupWriterLayout->addWidget( m_writingAppLabel, 0, 3 ); groupWriterLayout->addWidget( m_comboWritingApp, 0, 4 ); groupWriterLayout->setColStretch( 0, 1 ); QGridLayout* mainLayout = new QGridLayout( this ); mainLayout->setAlignment( Qt::AlignTop ); mainLayout->setSpacing( KDialog::spacingHint() ); mainLayout->setMargin( 0 ); mainLayout->addWidget( groupWriter, 0, 0 ); // tab order setTabOrder( m_comboMedium, m_comboSpeed ); setTabOrder( m_comboSpeed, m_comboWritingApp ); connect( m_comboMedium, SIGNAL(selectionChanged(K3bDevice::Device*)), this, SIGNAL(writerChanged()) ); connect( m_comboMedium, SIGNAL(selectionChanged(K3bDevice::Device*)), this, SIGNAL(writerChanged(K3bDevice::Device*)) ); connect( m_comboMedium, SIGNAL(newMedia()), this, SIGNAL(newMedia()) ); connect( m_comboMedium, SIGNAL(newMedium(K3bDevice::Device*)), this, SIGNAL(newMedium(K3bDevice::Device*)) ); connect( m_comboMedium, SIGNAL(newMedium(K3bDevice::Device*)), this, SLOT(slotNewBurnMedium(K3bDevice::Device*)) ); connect( m_comboWritingApp, SIGNAL(activated(int)), this, SLOT(slotWritingAppSelected(int)) ); connect( this, SIGNAL(writerChanged()), SLOT(slotWriterChanged()) ); connect( m_comboSpeed, SIGNAL(activated(int)), this, SLOT(slotSpeedChanged(int)) ); QToolTip::add( m_comboMedium, i18n("The medium that will be used for burning") ); QToolTip::add( m_comboSpeed, i18n("The speed at which to burn the medium") ); QToolTip::add( m_comboWritingApp, i18n("The external application to actually burn the medium") ); QWhatsThis::add( m_comboMedium, i18n("<p>Select the medium that you want to use for burning." "<p>In most cases there will only be one medium available which " "does not leave much choice.") ); QWhatsThis::add( m_comboSpeed, i18n("<p>Select the speed with which you want to burn." "<p><b>Auto</b><br>" "This will choose the maximum writing speed possible with the used " "medium. " "This is the recommended selection for most media.</p>" "<p><b>Ignore</b> (DVD only)<br>" "This will leave the speed selection to the writer device. " "Use this if K3b is unable to set the writing speed." "<p>1x refers to 1385 KB/s for DVD and 175 KB/s for CD.</p>" "<p><b>Caution:</b> Make sure your system is able to send the data " "fast enough to prevent buffer underruns.") ); QWhatsThis::add( m_comboWritingApp, i18n("<p>K3b uses the command line tools cdrecord, growisofs, and cdrdao " "to actually write a CD or DVD." "<p>Normally K3b chooses the best " "suited application for every task automatically but in some cases it " "may be possible that one of the applications does not work as intended " "with a certain writer. In this case one may select the " "application manually.") ); clearSpeedCombo(); slotConfigChanged(k3bcore->config()); slotWriterChanged(); }
KileWidgetPreviewConfig::KileWidgetPreviewConfig(KConfig *config, KileTool::QuickPreview *preview, QWidget *parent, const char *name ) : QWidget(parent,name), m_config(config), m_preview(preview) { // Layout QVBoxLayout *vbox = new QVBoxLayout(this, 5,5 ); QGroupBox *groupbox = new QGroupBox( i18n("Quick Preview in a separate window"), this, "groupbox" ); groupbox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, groupbox->sizePolicy().hasHeightForWidth() ) ); groupbox->setColumnLayout(0, Qt::Vertical ); groupbox->layout()->setSpacing( 6 ); groupbox->layout()->setMargin( 11 ); QGridLayout *groupboxLayout = new QGridLayout( groupbox->layout() ); groupboxLayout->setAlignment( Qt::AlignTop ); QLabel *label = new QLabel( i18n("Select a configuration:"), groupbox, "label"); m_combobox = new KComboBox(false,groupbox,"combobox" ); groupboxLayout->addWidget(label,0,0); groupboxLayout->addWidget(m_combobox,0,2); groupboxLayout->setColSpacing(1,8); groupboxLayout->setColStretch(3,1); QGroupBox *gbResolution = new QGroupBox( i18n("Quick Preview in bottom bar"), this, "gbresolution" ); gbResolution->setColumnLayout(0, Qt::Vertical ); gbResolution->layout()->setSpacing( 6 ); gbResolution->layout()->setMargin( 11 ); QGridLayout *resLayout = new QGridLayout( gbResolution->layout() ); resLayout->setAlignment( Qt::AlignTop ); QLabel *resLabel = new QLabel( i18n("&Resolution:"), gbResolution ); m_leDvipngResolution = new KLineEdit( gbResolution, "DvipngResolution" ); QLabel *resDpi = new QLabel( i18n("dpi"), gbResolution ); QLabel *resAllowed = new QLabel( i18n("(allowed values: 30-1000 dpi)"), gbResolution ); // set validator QValidator* validator = new QIntValidator(30,1000,this); m_leDvipngResolution->setValidator(validator); resLabel->setBuddy(m_leDvipngResolution); QString sep = " "; QString title = i18n("Kile supports three kinds of conversion to png images"); QString tool1 = i18n("dvi --> png") + sep + i18n("(uses dvipng)"); QString tool2 = i18n("dvi --> ps --> png") + sep + i18n("(uses dvips/convert)"); QString tool3 = i18n("pdf --> png") + sep + i18n("(uses convert)"); QString description = QString("%1:<ul><li>%2<li>%3<li>%4</ul>").arg(title).arg(tool1).arg(tool2).arg(tool3); QLabel *labelDescription = new QLabel(description, gbResolution); QLabel *labelDvipng = new QLabel(i18n("dvipng:"), gbResolution); QLabel *labelConvert = new QLabel(i18n("convert:"), gbResolution); m_lbDvipng = new QLabel(gbResolution); m_lbConvert = new QLabel(gbResolution); resLayout->addWidget(resLabel,0,0); resLayout->addWidget(m_leDvipngResolution,0,2); resLayout->addWidget(resDpi,0,3); resLayout->addWidget(resAllowed,0,5,Qt::AlignLeft); resLayout->addMultiCellWidget(labelDescription,1,1,0,5); resLayout->addWidget(labelDvipng,2,0); resLayout->addWidget(m_lbDvipng,2,2); resLayout->addWidget(labelConvert,3,0); resLayout->addWidget(m_lbConvert,3,2); resLayout->setColSpacing(1,8); resLayout->setColSpacing(4,24); resLayout->setColStretch(5,1); m_gbPreview = new QGroupBox( i18n("Properties"), this, "gbpreview" ); m_gbPreview->setColumnLayout(0, Qt::Vertical ); m_gbPreview->layout()->setSpacing( 6 ); m_gbPreview->layout()->setMargin( 11 ); QGridLayout *previewLayout = new QGridLayout( m_gbPreview->layout() ); previewLayout->setAlignment( Qt::AlignTop ); QLabel *labelPreviewWidget = new QLabel(i18n("Show preview in bottom bar:"), m_gbPreview); QLabel *labelPreviewType = new QLabel(i18n("Conversion to image:"), m_gbPreview); QLabel *labelSelection = new QLabel(i18n("Selection:"), m_gbPreview); QLabel *labelEnvironment = new QLabel(i18n("Environment:"), m_gbPreview); QLabel *labelMathgroup = new QLabel(i18n("Mathgroup:"), m_gbPreview); QLabel *labelSubdocument1 = new QLabel(i18n("Subdocument:"), m_gbPreview); QLabel *labelSubdocument2 = new QLabel(i18n("Not available, opens always in a separate window."), m_gbPreview); m_cbSelection = new QCheckBox(m_gbPreview); m_cbEnvironment = new QCheckBox(m_gbPreview); m_cbMathgroup = new QCheckBox(m_gbPreview); m_coSelection = new KComboBox(false,m_gbPreview); m_coEnvironment = new KComboBox(false,m_gbPreview); m_lbMathgroup = new QLabel(i18n("Preview uses always 'dvipng'."), m_gbPreview); previewLayout->addMultiCellWidget(labelPreviewWidget,0,0,0,2); previewLayout->addWidget(labelPreviewType,0,4); previewLayout->addWidget(labelSelection,1,0); previewLayout->addWidget(m_cbSelection,1,2); previewLayout->addWidget(m_coSelection,1,4); previewLayout->addWidget(labelEnvironment,2,0); previewLayout->addWidget(m_cbEnvironment,2,2); previewLayout->addWidget(m_coEnvironment,2,4); previewLayout->addWidget(labelMathgroup,3,0); previewLayout->addWidget(m_cbMathgroup,3,2); previewLayout->addMultiCellWidget(m_lbMathgroup,3,3,4,5,Qt::AlignLeft); previewLayout->addWidget(labelSubdocument1,4,0); previewLayout->addMultiCellWidget(labelSubdocument2,4,4,2,5,Qt::AlignLeft); previewLayout->setRowSpacing(0,3*labelPreviewWidget->sizeHint().height()/2); previewLayout->setRowSpacing(3,m_coEnvironment->sizeHint().height()); previewLayout->setColSpacing(1,12); previewLayout->setColSpacing(3,40); previewLayout->setColStretch(5,1); vbox->addWidget(groupbox); vbox->addWidget(gbResolution); vbox->addWidget(m_gbPreview); vbox->addStretch(); connect(m_cbEnvironment,SIGNAL(clicked()),this,SLOT(updateConversionTools())); connect(m_cbSelection,SIGNAL(clicked()),this,SLOT(updateConversionTools())); connect(m_cbMathgroup,SIGNAL(clicked()),this,SLOT(updateConversionTools())); }
KCMStyle::KCMStyle( QWidget* parent, const char* name ) : KCModule( parent, name ), appliedStyle(NULL) { setQuickHelp( i18n("<h1>Style</h1>" "This module allows you to modify the visual appearance " "of user interface elements, such as the widget style " "and effects.")); m_bEffectsDirty = false; m_bStyleDirty= false; m_bToolbarsDirty = false; KGlobal::dirs()->addResourceType("themes", KStandardDirs::kde_default("data") + "kstyle/themes"); KAboutData *about = new KAboutData( I18N_NOOP("kcmstyle"), I18N_NOOP("KDE Style Module"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 2002 Karol Szwed, Daniel Molkentin")); about->addAuthor("Karol Szwed", 0, "*****@*****.**"); about->addAuthor("Daniel Molkentin", 0, "*****@*****.**"); about->addAuthor("Ralf Nolden", 0, "*****@*****.**"); setAboutData( about ); // Setup pages and mainLayout mainLayout = new QVBoxLayout( this ); tabWidget = new QTabWidget( this ); mainLayout->addWidget( tabWidget ); page1 = new QWidget( tabWidget ); page1Layout = new QVBoxLayout( page1, KDialog::marginHint(), KDialog::spacingHint() ); page2 = new QWidget( tabWidget ); page2Layout = new QVBoxLayout( page2, KDialog::marginHint(), KDialog::spacingHint() ); page3 = new QWidget( tabWidget ); page3Layout = new QVBoxLayout( page3, KDialog::marginHint(), KDialog::spacingHint() ); // Add Page1 (Style) // ----------------- gbWidgetStyle = new QGroupBox( i18n("Widget Style"), page1, "gbWidgetStyle" ); gbWidgetStyle->setColumnLayout( 0, Qt::Vertical ); gbWidgetStyle->layout()->setMargin( KDialog::marginHint() ); gbWidgetStyle->layout()->setSpacing( KDialog::spacingHint() ); gbWidgetStyleLayout = new QVBoxLayout( gbWidgetStyle->layout() ); gbWidgetStyleLayout->setAlignment( Qt::AlignTop ); hbLayout = new QHBoxLayout( KDialog::spacingHint(), "hbLayout" ); cbStyle = new KComboBox( gbWidgetStyle, "cbStyle" ); cbStyle->setEditable( FALSE ); hbLayout->addWidget( cbStyle ); pbConfigStyle = new QPushButton( i18n("Con&figure..."), gbWidgetStyle ); pbConfigStyle->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum ); pbConfigStyle->setEnabled( FALSE ); hbLayout->addWidget( pbConfigStyle ); gbWidgetStyleLayout->addLayout( hbLayout ); lblStyleDesc = new QLabel( gbWidgetStyle ); lblStyleDesc->setTextFormat(Qt::RichText); gbWidgetStyleLayout->addWidget( lblStyleDesc ); cbIconsOnButtons = new QCheckBox( i18n("Sho&w icons on buttons"), gbWidgetStyle ); gbWidgetStyleLayout->addWidget( cbIconsOnButtons ); cbEnableTooltips = new QCheckBox( i18n("E&nable tooltips"), gbWidgetStyle ); gbWidgetStyleLayout->addWidget( cbEnableTooltips ); cbTearOffHandles = new QCheckBox( i18n("Show tear-off handles in &popup menus"), gbWidgetStyle ); gbWidgetStyleLayout->addWidget( cbTearOffHandles ); cbTearOffHandles->hide(); // reenable when the corresponding Qt method is virtual and properly reimplemented QGroupBox *gbPreview = new QGroupBox( i18n( "Preview" ), page1 ); gbPreview->setColumnLayout( 0, Vertical ); gbPreview->layout()->setMargin( 0 ); gbPreview->layout()->setSpacing( KDialog::spacingHint() ); gbPreview->setFlat( true ); stylePreview = new StylePreview( gbPreview ); gbPreview->layout()->add( stylePreview ); page1Layout->addWidget( gbWidgetStyle ); page1Layout->addWidget( gbPreview ); // Connect all required stuff connect( cbStyle, SIGNAL(activated(int)), this, SLOT(styleChanged()) ); connect( cbStyle, SIGNAL(activated(int)), this, SLOT(updateConfigButton())); connect( pbConfigStyle, SIGNAL(clicked()), this, SLOT(styleSpecificConfig())); // Add Page2 (Effects) // ------------------- cbEnableEffects = new QCheckBox( i18n("&Enable GUI effects"), page2 ); containerFrame = new QFrame( page2 ); containerFrame->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); containerFrame->setMargin(0); containerLayout = new QGridLayout( containerFrame, 1, 1, // rows, columns KDialog::marginHint(), KDialog::spacingHint() ); comboComboEffect = new QComboBox( FALSE, containerFrame ); comboComboEffect->insertItem( i18n("Disable") ); comboComboEffect->insertItem( i18n("Animate") ); lblComboEffect = new QLabel( i18n("Combobo&x effect:"), containerFrame ); lblComboEffect->setBuddy( comboComboEffect ); containerLayout->addWidget( lblComboEffect, 0, 0 ); containerLayout->addWidget( comboComboEffect, 0, 1 ); comboTooltipEffect = new QComboBox( FALSE, containerFrame ); comboTooltipEffect->insertItem( i18n("Disable") ); comboTooltipEffect->insertItem( i18n("Animate") ); comboTooltipEffect->insertItem( i18n("Fade") ); lblTooltipEffect = new QLabel( i18n("&Tool tip effect:"), containerFrame ); lblTooltipEffect->setBuddy( comboTooltipEffect ); containerLayout->addWidget( lblTooltipEffect, 1, 0 ); containerLayout->addWidget( comboTooltipEffect, 1, 1 ); comboMenuEffect = new QComboBox( FALSE, containerFrame ); comboMenuEffect->insertItem( i18n("Disable") ); comboMenuEffect->insertItem( i18n("Animate") ); comboMenuEffect->insertItem( i18n("Fade") ); comboMenuEffect->insertItem( i18n("Make Translucent") ); lblMenuEffect = new QLabel( i18n("&Menu effect:"), containerFrame ); lblMenuEffect->setBuddy( comboMenuEffect ); containerLayout->addWidget( lblMenuEffect, 2, 0 ); containerLayout->addWidget( comboMenuEffect, 2, 1 ); comboMenuHandle = new QComboBox( FALSE, containerFrame ); comboMenuHandle->insertItem( i18n("Disable") ); comboMenuHandle->insertItem( i18n("Application Level") ); // comboMenuHandle->insertItem( i18n("Enable") ); lblMenuHandle = new QLabel( i18n("Me&nu tear-off handles:"), containerFrame ); lblMenuHandle->setBuddy( comboMenuHandle ); containerLayout->addWidget( lblMenuHandle, 3, 0 ); containerLayout->addWidget( comboMenuHandle, 3, 1 ); cbMenuShadow = new QCheckBox( i18n("Menu &drop shadow"), containerFrame ); containerLayout->addWidget( cbMenuShadow, 4, 0 ); // Push the [label combo] to the left. comboSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); containerLayout->addItem( comboSpacer, 1, 2 ); // Separator. QFrame* hline = new QFrame ( page2 ); hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); // Now implement the Menu Transparency container. menuContainer = new QFrame( page2 ); menuContainer->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); menuContainer->setMargin(0); menuContainerLayout = new QGridLayout( menuContainer, 1, 1, // rows, columns KDialog::marginHint(), KDialog::spacingHint() ); menuPreview = new MenuPreview( menuContainer, /* opacity */ 90, MenuPreview::Blend ); comboMenuEffectType = new QComboBox( FALSE, menuContainer ); comboMenuEffectType->insertItem( i18n("Software Tint") ); comboMenuEffectType->insertItem( i18n("Software Blend") ); #ifdef HAVE_XRENDER comboMenuEffectType->insertItem( i18n("XRender Blend") ); #endif // So much stuffing around for a simple slider.. sliderBox = new QVBox( menuContainer ); sliderBox->setSpacing( KDialog::spacingHint() ); sliderBox->setMargin( 0 ); slOpacity = new QSlider( 0, 100, 5, /*opacity*/ 90, Qt::Horizontal, sliderBox ); slOpacity->setTickmarks( QSlider::Below ); slOpacity->setTickInterval( 10 ); QHBox* box1 = new QHBox( sliderBox ); box1->setSpacing( KDialog::spacingHint() ); box1->setMargin( 0 ); QLabel* lbl = new QLabel( i18n("0%"), box1 ); lbl->setAlignment( AlignLeft ); lbl = new QLabel( i18n("50%"), box1 ); lbl->setAlignment( AlignHCenter ); lbl = new QLabel( i18n("100%"), box1 ); lbl->setAlignment( AlignRight ); lblMenuEffectType = new QLabel( comboMenuEffectType, i18n("Menu trans&lucency type:"), menuContainer ); lblMenuEffectType->setAlignment( AlignBottom | AlignLeft ); lblMenuOpacity = new QLabel( slOpacity, i18n("Menu &opacity:"), menuContainer ); lblMenuOpacity->setAlignment( AlignBottom | AlignLeft ); menuContainerLayout->addWidget( lblMenuEffectType, 0, 0 ); menuContainerLayout->addWidget( comboMenuEffectType, 1, 0 ); menuContainerLayout->addWidget( lblMenuOpacity, 2, 0 ); menuContainerLayout->addWidget( sliderBox, 3, 0 ); menuContainerLayout->addMultiCellWidget( menuPreview, 0, 3, 1, 1 ); // Layout page2. page2Layout->addWidget( cbEnableEffects ); page2Layout->addWidget( containerFrame ); page2Layout->addWidget( hline ); page2Layout->addWidget( menuContainer ); QSpacerItem* sp1 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); page2Layout->addItem( sp1 ); // Data flow stuff. connect( cbEnableEffects, SIGNAL(toggled(bool)), containerFrame, SLOT(setEnabled(bool)) ); connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(menuEffectChanged(bool)) ); connect( slOpacity, SIGNAL(valueChanged(int)),menuPreview, SLOT(setOpacity(int)) ); connect( comboMenuEffect, SIGNAL(activated(int)), this, SLOT(menuEffectChanged()) ); connect( comboMenuEffect, SIGNAL(highlighted(int)), this, SLOT(menuEffectChanged()) ); connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(menuEffectTypeChanged()) ); connect( comboMenuEffectType, SIGNAL(highlighted(int)), this, SLOT(menuEffectTypeChanged()) ); // Add Page3 (Miscellaneous) // ------------------------- cbHoverButtons = new QCheckBox( i18n("High&light buttons under mouse"), page3 ); cbTransparentToolbars = new QCheckBox( i18n("Transparent tool&bars when moving"), page3 ); QWidget * dummy = new QWidget( page3 ); QHBoxLayout* box2 = new QHBoxLayout( dummy, 0, KDialog::spacingHint() ); lbl = new QLabel( i18n("Text pos&ition:"), dummy ); comboToolbarIcons = new QComboBox( FALSE, dummy ); comboToolbarIcons->insertItem( i18n("Icons Only") ); comboToolbarIcons->insertItem( i18n("Text Only") ); comboToolbarIcons->insertItem( i18n("Text Alongside Icons") ); comboToolbarIcons->insertItem( i18n("Text Under Icons") ); lbl->setBuddy( comboToolbarIcons ); box2->addWidget( lbl ); box2->addWidget( comboToolbarIcons ); QSpacerItem* sp2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); box2->addItem( sp2 ); page3Layout->addWidget( cbHoverButtons ); page3Layout->addWidget( cbTransparentToolbars ); page3Layout->addWidget( dummy ); // Layout page3. QSpacerItem* sp3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); page3Layout->addItem( sp3 ); // Load settings load(); // Do all the setDirty connections. connect(cbStyle, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); // Page2 connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setStyleDirty())); connect( comboTooltipEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); connect( comboComboEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); connect( comboMenuEffect, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); connect( comboMenuHandle, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); connect( comboMenuEffectType, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); connect( slOpacity, SIGNAL(valueChanged(int)),this, SLOT(setStyleDirty())); connect( cbMenuShadow, SIGNAL(toggled(bool)), this, SLOT(setStyleDirty())); // Page3 connect( cbHoverButtons, SIGNAL(toggled(bool)), this, SLOT(setToolbarsDirty())); connect( cbTransparentToolbars, SIGNAL(toggled(bool)), this, SLOT(setToolbarsDirty())); connect( cbEnableTooltips, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); connect( cbIconsOnButtons, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); connect( cbTearOffHandles, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); connect( comboToolbarIcons, SIGNAL(activated(int)), this, SLOT(setToolbarsDirty())); addWhatsThis(); // Insert the pages into the tabWidget tabWidget->insertTab( page1, i18n("&Style")); tabWidget->insertTab( page2, i18n("&Effects")); tabWidget->insertTab( page3, i18n("&Toolbar")); //Enable/disable the button for the initial style updateConfigButton(); }