ConfigDlg::ConfigDlg(QWidget *parent, const char *name) : KDialogBase(KDialogBase::TreeList, WStyle_DialogBorder, parent, name, true, "Settings", KDialogBase::Ok|KDialogBase::Cancel) { setShowIconsInTreeList(true); setMinimumSize(600,400); enableButtonSeparator(true); unfoldTreeList(); QVBox *frame; QStringList path; path << i18n("Languages"); setFolderIcon(path, BarIcon("protoeditor", KIcon::SizeSmall)); QValueList<LanguageSettings*> llist = Protoeditor::self()->settings()->languageSettingsList(); QValueList<LanguageSettings*>::iterator it; for(it = llist.begin(); it != llist.end(); ++it) { path.clear(); path << i18n("Languages") << (*it)->languageName(); frame = addVBoxPage(path, (*it)->languageName(), BarIcon((*it)->iconName(), KIcon::SizeSmall)); frame->setSpacing(0); frame->setMargin(0); m_langSettingsWidgets.append((*it)->createSettingsWidget(frame)); } path.clear(); path << i18n("Sites"); frame= addVBoxPage(path, i18n("Sites"), BarIcon("package_network", KIcon::SizeSmall)); frame->setSpacing(0); frame->setMargin(0); m_siteSettingsWidget = new SiteSettingsWidget(frame);//->reparent(((QWidget*)frame), 0, QPoint()); path.clear(); path << i18n("External Applications"); frame = addVBoxPage(path, i18n("External Applications"), BarIcon("gear", KIcon::SizeSmall)); frame->setSpacing(0); frame->setMargin(0); m_extAppSettingsWidget = new ExtAppSettingsWidget(frame, i18n("External Applications"));//->reparent(((QWidget*)frame), 0, QPoint()); resize(QSize(590, 300).expandedTo(minimumSizeHint())); }
KateConfigDialog::KateConfigDialog(KateMainWindow *parent, Kate::View *view) : KDialogBase(KDialogBase::TreeList, i18n("Configure"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Help, KDialogBase::Ok, parent, "configdialog") { KConfig *config = KateApp::self()->config(); KWin::setIcons(winId(), KateApp::self()->icon(), KateApp::self()->miniIcon()); actionButton(KDialogBase::Apply)->setEnabled(false); mainWindow = parent; setMinimumSize(600, 400); v = view; pluginPages.setAutoDelete(false); editorPages.setAutoDelete(false); QStringList path; setShowIconsInTreeList(true); path.clear(); path << i18n("Application"); setFolderIcon(path, SmallIcon("kate", KIcon::SizeSmall)); path.clear(); // BEGIN General page path << i18n("Application") << i18n("General"); QFrame *frGeneral = addPage(path, i18n("General Options"), BarIcon("gohome", KIcon::SizeSmall)); QVBoxLayout *lo = new QVBoxLayout(frGeneral); lo->setSpacing(KDialog::spacingHint()); config->setGroup("General"); // GROUP with the one below: "Appearance" QButtonGroup *bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Appearance"), frGeneral); lo->addWidget(bgStartup); // show full path in title config->setGroup("General"); cb_fullPath = new QCheckBox(i18n("&Show full path in title"), bgStartup); cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath()); QWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption.")); connect(cb_fullPath, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Behavior" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Behavior"), frGeneral); lo->addWidget(bgStartup); // sync the konsole ? cb_syncKonsole = new QCheckBox(bgStartup); cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document")); cb_syncKonsole->setChecked(parent->syncKonsole); QWhatsThis::add(cb_syncKonsole, i18n("If this is checked, the built in Konsole will <code>cd</code> to the directory " "of the active document when started and whenever the active document changes, " "if the document is a local file.")); connect(cb_syncKonsole, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // modified files notification cb_modNotifications = new QCheckBox(i18n("Wa&rn about files modified by foreign processes"), bgStartup); cb_modNotifications->setChecked(parent->modNotification); QWhatsThis::add(cb_modNotifications, i18n("If enabled, when Kate receives focus you will be asked what to do with " "files that have been modified on the hard disk. If not enabled, you will " "be asked what to do with a file that has been modified on the hard disk only " "when that file gains focus inside Kate.")); connect(cb_modNotifications, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Meta-informations" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Meta-Information"), frGeneral); lo->addWidget(bgStartup); // save meta infos cb_saveMetaInfos = new QCheckBox(bgStartup); cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions")); cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos()); QWhatsThis::add(cb_saveMetaInfos, i18n("Check this if you want document configuration like for example " "bookmarks to be saved past editor sessions. The configuration will be " "restored if the document has not changed when reopened.")); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // meta infos days QHBox *hbDmf = new QHBox(bgStartup); hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos()); QLabel *lDmf = new QLabel(i18n("&Delete unused meta-information after:"), hbDmf); sb_daysMetaInfos = new QSpinBox(0, 180, 1, hbDmf); sb_daysMetaInfos->setSpecialValueText(i18n("(never)")); sb_daysMetaInfos->setSuffix(i18n(" day(s)")); sb_daysMetaInfos->setValue(KateDocManager::self()->getDaysMetaInfos()); lDmf->setBuddy(sb_daysMetaInfos); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), hbDmf, SLOT(setEnabled(bool))); connect(sb_daysMetaInfos, SIGNAL(valueChanged(int)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END General page path.clear(); // BEGIN Session page path << i18n("Application") << i18n("Sessions"); QFrame *frSessions = addPage(path, i18n("Session Management"), BarIcon("history", KIcon::SizeSmall)); lo = new QVBoxLayout(frSessions); lo->setSpacing(KDialog::spacingHint()); // GROUP with the one below: "Startup" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Elements of Sessions"), frSessions); lo->addWidget(bgStartup); // restore view config cb_restoreVC = new QCheckBox(bgStartup); cb_restoreVC->setText(i18n("Include &window configuration")); config->setGroup("General"); cb_restoreVC->setChecked(config->readBoolEntry("Restore Window Configuration", true)); QWhatsThis::add(cb_restoreVC, i18n("Check this if you want all your views and frames restored each time you open Kate")); connect(cb_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); QRadioButton *rb1, *rb2, *rb3; sessions_start = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Startup"), frSessions); lo->add(sessions_start); sessions_start->setRadioButtonExclusive(true); sessions_start->insert(rb1 = new QRadioButton(i18n("&Start new session"), sessions_start), 0); sessions_start->insert(rb2 = new QRadioButton(i18n("&Load last-used session"), sessions_start), 1); sessions_start->insert(rb3 = new QRadioButton(i18n("&Manually choose a session"), sessions_start), 2); config->setGroup("General"); QString sesStart(config->readEntry("Startup Session", "manual")); if(sesStart == "new") sessions_start->setButton(0); else if(sesStart == "last") sessions_start->setButton(1); else sessions_start->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); sessions_exit = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Exit or Session Switch"), frSessions); lo->add(sessions_exit); sessions_exit->setRadioButtonExclusive(true); sessions_exit->insert(rb1 = new QRadioButton(i18n("&Do not save session"), sessions_exit), 0); sessions_exit->insert(rb2 = new QRadioButton(i18n("&Save session"), sessions_exit), 1); sessions_exit->insert(rb3 = new QRadioButton(i18n("&Ask user"), sessions_exit), 2); config->setGroup("General"); QString sesExit(config->readEntry("Session Exit", "save")); if(sesExit == "discard") sessions_exit->setButton(0); else if(sesExit == "save") sessions_exit->setButton(1); else sessions_exit->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END Session page path.clear(); // file selector page path << i18n("Application") << i18n("File Selector"); QVBox *page = addVBoxPage(path, i18n("File Selector Settings"), BarIcon("fileopen", KIcon::SizeSmall)); fileSelConfigPage = new KFSConfigPage(page, "file selector config page", mainWindow->fileselector); connect(fileSelConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Document List"); page = addVBoxPage(path, i18n("Document List Settings"), BarIcon("view_text", KIcon::SizeSmall)); filelistConfigPage = new KFLConfigPage(page, "file list config page", mainWindow->filelist); connect(filelistConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Plugins"); /*QVBox **/ page = addVBoxPage(path, i18n("Plugin Manager"), BarIcon("connect_established", KIcon::SizeSmall)); KateConfigPluginPage *configPluginPage = new KateConfigPluginPage(page, this); connect(configPluginPage, SIGNAL(changed()), this, SLOT(slotChanged())); // Tools->External Tools menu path.clear(); path << i18n("Application") << i18n("External Tools"); page = addVBoxPage(path, i18n("External Tools"), BarIcon("configure", KIcon::SizeSmall)); configExternalToolsPage = new KateExternalToolsConfigWidget(page, "external tools config page"); connect(configExternalToolsPage, SIGNAL(changed()), this, SLOT(slotChanged())); // editor widgets from kwrite/kwdialog path.clear(); path << i18n("Editor"); setFolderIcon(path, SmallIcon("edit", KIcon::SizeSmall)); for(uint i = 0; i < KTextEditor::configInterfaceExtension(v->document())->configPages(); i++) { path.clear(); path << i18n("Editor") << KTextEditor::configInterfaceExtension(v->document())->configPageName(i); /*QVBox **/ page = addVBoxPage(path, KTextEditor::configInterfaceExtension(v->document())->configPageFullName(i), KTextEditor::configInterfaceExtension(v->document())->configPagePixmap(i, KIcon::SizeSmall)); KTextEditor::ConfigPage *cPage = KTextEditor::configInterfaceExtension(v->document())->configPage(i, page); connect(cPage, SIGNAL(changed()), this, SLOT(slotChanged())); editorPages.append(cPage); } KatePluginList &pluginList(KatePluginManager::self()->pluginList()); for(unsigned int i = 0; i < pluginList.size(); ++i) { if(pluginList[i].load && Kate::pluginConfigInterfaceExtension(pluginList[i].plugin)) addPluginPage(pluginList[i].plugin); } enableButtonSeparator(true); dataChanged = false; unfoldTreeList(); }
SiteSettingsDialog::SiteSettingsDialog(QWidget *parent, const char *name) : KDialogBase(KDialogBase::Plain, WStyle_DialogBorder, parent, name, true, i18n("Site settings"), KDialogBase::Ok|KDialogBase::Cancel) { QFrame *frame = plainPage(); QVBoxLayout* mainLayout = new QVBoxLayout(frame, 0, 0); QTabWidget* tab = new QTabWidget(frame); QWidget* sitewidget = new QWidget(tab); QVBoxLayout* siteLayout = new QVBoxLayout(sitewidget, 10, 0); QGridLayout* grid = new QGridLayout(0, 5, 2, 3, 5); QLabel* label = new QLabel(sitewidget); label->setText(i18n("Site name:")); grid->addWidget(label, 0, 0); m_edName = new KLineEdit(sitewidget); grid->addWidget(m_edName, 0, 1); label = new QLabel(sitewidget); label->setText(i18n("URL:")); grid->addWidget(label, 1, 0); m_edUrl = new KLineEdit(sitewidget); m_edUrl->setText(i18n("http://")); grid->addWidget(m_edUrl, 1, 1); label = new QLabel(sitewidget); label->setText(i18n("Remote base dir:")); grid->addWidget(label, 2, 0); m_edRemoteBaseDir = new KLineEdit(sitewidget); grid->addWidget(m_edRemoteBaseDir, 2, 1); label = new QLabel(sitewidget); label->setText(i18n("Local base dir:")); grid->addWidget(label, 3, 0); m_edLocalBaseDir = new KURLRequester(sitewidget); m_edLocalBaseDir->setMode(KFile::Directory); grid->addWidget(m_edLocalBaseDir, 3, 1); // label = new QLabel(sitewidget); label->setText(i18n("Default file:")); grid->addWidget(label, 4, 0); m_edDefaultFile = new KURLRequester(sitewidget); grid->addWidget(m_edDefaultFile, 4, 1); label = new QLabel(sitewidget); label->setText(i18n("Debugger:")); grid->addWidget(label, 5, 0); m_cbDebuggerName = new QComboBox(sitewidget); QValueList<LanguageSettings*> llist = Protoeditor::self()->settings()->languageSettingsList(); QString dlabel; QValueList<DebuggerSettingsInterface*> dlist; for(QValueList<LanguageSettings*>::iterator it = llist.begin(); it != llist.end(); it++) { dlist = (*it)->debuggerSettingsList(); for(QValueList<DebuggerSettingsInterface*>::iterator dit = dlist.begin(); dit != dlist.end(); dit++) { dlabel = (*it)->languageName() + " " + (*dit)->debuggerLabel(); m_debuggerMap[dlabel] = (*dit)->debuggerName(); m_cbDebuggerName->insertItem(dlabel); } } grid->addWidget(m_cbDebuggerName, 5, 1); siteLayout->addLayout(grid); siteLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); tab->addTab(sitewidget, i18n("Site")); m_mappingWidget = new DirMappingWidget(tab); tab->addTab(m_mappingWidget, i18n("Mappings")); mainLayout->addWidget(tab); enableButtonSeparator(true); resize(600, 400); connect(m_edDefaultFile, SIGNAL(openFileDialog(KURLRequester*)), this, SLOT(slotOpenFileDialog(KURLRequester*))); }
KPrTransEffectDia::KPrTransEffectDia( QWidget *parent, const char *name, KPrDocument *_doc, KPrView *_view ) : KDialogBase( parent, name, true, "", KDialogBase::User1|Ok|Cancel ), doc( _doc ), view( _view ), soundPlayer( 0 ) { enableButtonSeparator( true ); QWidget *page = new QWidget( this ); setMainWidget(page); QBoxLayout *topLayout = new QHBoxLayout( page, KDialog::marginHint(), KDialog::spacingHint() ); QWidget* leftpart = new QWidget( page ); topLayout->addWidget( leftpart ); QWidget* rightpart = new QWidget( page ); topLayout->addWidget( rightpart ); // right-side of the dialog, for showing effect preview QVBoxLayout *rightlayout = new QVBoxLayout( rightpart, KDialog::marginHint(), KDialog::spacingHint() ); rightlayout->setAutoAdd( true ); effectPreview = new KPrEffectPreview( rightpart, doc, view ); int pgnum = view->getCurrPgNum() - 1; // getCurrPgNum() is 1-based KPrPage* pg = doc->pageList().at( pgnum ); // pixmap for effect preview QRect rect= pg->getZoomPageRect(); QPixmap pix( rect.size() ); pix.fill( Qt::white ); view->getCanvas()->drawPageInPix( pix, pgnum, 100 ); effectPreview->setPixmap( pix ); pageEffect = pg->getPageEffect(); speed = pg->getPageEffectSpeed(); QVBoxLayout *leftlayout = new QVBoxLayout( leftpart, KDialog::marginHint(), KDialog::spacingHint() ); leftlayout->setAutoAdd( true ); new QLabel( i18n("Effect:"), leftpart ); effectList = new QListBox( leftpart ); effectList->insertItem( i18n( "No Effect" ) ); effectList->insertItem( i18n( "Close Horizontal" ) ); effectList->insertItem( i18n( "Close Vertical" ) ); effectList->insertItem( i18n( "Close From All Directions" ) ); effectList->insertItem( i18n( "Open Horizontal" ) ); effectList->insertItem( i18n( "Open Vertical" ) ); effectList->insertItem( i18n( "Open From All Directions" ) ); effectList->insertItem( i18n( "Interlocking Horizontal 1" ) ); effectList->insertItem( i18n( "Interlocking Horizontal 2" ) ); effectList->insertItem( i18n( "Interlocking Vertical 1" ) ); effectList->insertItem( i18n( "Interlocking Vertical 2" ) ); effectList->insertItem( i18n( "Surround 1" ) ); effectList->insertItem( i18n( "Fly Away 1" ) ); effectList->insertItem( i18n( "Blinds Horizontal" ) ); effectList->insertItem( i18n( "Blinds Vertical" ) ); effectList->insertItem( i18n( "Box In" ) ); effectList->insertItem( i18n( "Box Out" ) ); effectList->insertItem( i18n( "Checkerboard Across" ) ); effectList->insertItem( i18n( "Checkerboard Down" ) ); effectList->insertItem( i18n( "Cover Down" ) ); effectList->insertItem( i18n( "Uncover Down" ) ); effectList->insertItem( i18n( "Cover Up" ) ); effectList->insertItem( i18n( "Uncover Up" ) ); effectList->insertItem( i18n( "Cover Left" ) ); effectList->insertItem( i18n( "Uncover Left" ) ); effectList->insertItem( i18n( "Cover Right" ) ); effectList->insertItem( i18n( "Uncover Right" ) ); effectList->insertItem( i18n( "Cover Left-Up" ) ); effectList->insertItem( i18n( "Uncover Left-Up" ) ); effectList->insertItem( i18n( "Cover Left-Down" ) ); effectList->insertItem( i18n( "Uncover Left-Down" ) ); effectList->insertItem( i18n( "Cover Right-Up" ) ); effectList->insertItem( i18n( "Uncover Right-Up" ) ); effectList->insertItem( i18n( "Cover Right-Bottom" ) ); effectList->insertItem( i18n( "Uncover Right-Bottom" ) ); effectList->insertItem( i18n( "Dissolve" ) ); effectList->insertItem( i18n( "Strips Left-Up" ) ); effectList->insertItem( i18n( "Strips Left-Down" ) ); effectList->insertItem( i18n( "Strips Right-Up" ) ); effectList->insertItem( i18n( "Strips Right-Down" ) ); effectList->insertItem( i18n( "Melting" ) ); effectList->insertItem( i18n( "Random Transition" ) ); effectList->setCurrentItem( static_cast<int>( pageEffect ) ); // workaround, because Random Effect is always negative if( pageEffect == PEF_RANDOM ) effectList->setCurrentItem( effectList->count()-1 ); connect( effectList, SIGNAL(highlighted(int)), this, SLOT(effectChanged(int)) ); connect( effectList, SIGNAL( doubleClicked ( QListBoxItem *) ), this, SLOT( effectChanged()) ); new QLabel( i18n("Speed:"), leftpart ); QWidget* sp = new QWidget( leftpart ); QBoxLayout* speedLayout = new QHBoxLayout( sp, KDialog::marginHint(), KDialog::spacingHint() ); speedLayout->setAutoAdd( true ); speedCombo = new QComboBox( sp ); speedCombo->insertItem(i18n("Slow") ); speedCombo->insertItem(i18n("Medium") ); speedCombo->insertItem(i18n("Fast") ); speedCombo->setCurrentItem( speed ); connect( speedCombo, SIGNAL(activated(int)), this, SLOT(speedChanged(int)) ); QWidget* previewgrp = new QWidget( leftpart ); QBoxLayout* previewLayout = new QHBoxLayout( previewgrp, KDialog::marginHint(), KDialog::spacingHint() ); previewLayout->setAutoAdd( true ); automaticPreview = new QCheckBox( i18n( "Automatic preview" ), previewgrp ); automaticPreview->setChecked( true ); QWidget* previewspacer = new QWidget( previewgrp ); previewspacer->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); previewButton = new QPushButton( previewgrp ); previewButton->setText( i18n("Preview") ); connect( previewButton, SIGNAL(clicked()), this, SLOT(preview()) ); QFrame* line = new QFrame( leftpart ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); soundFileName = pg->getPageSoundFileName(); soundEffect = pg->getPageSoundEffect(); checkSoundEffect = new QCheckBox( i18n( "Sound effect" ), leftpart ); checkSoundEffect->setChecked( soundEffect ); connect( checkSoundEffect, SIGNAL( clicked() ), this, SLOT( soundEffectChanged() ) ); QWidget* soundgrp = new QWidget( leftpart ); QBoxLayout* soundLayout = new QHBoxLayout( soundgrp, KDialog::marginHint(), KDialog::spacingHint() ); soundLayout->setAutoAdd( true ); lSoundEffect = new QLabel( i18n( "File name:" ), soundgrp ); requester = new KURLRequester( soundgrp ); requester->setURL( soundFileName ); connect( requester, SIGNAL( openFileDialog( KURLRequester * ) ), this, SLOT( slotRequesterClicked( KURLRequester * ) ) ); connect( requester, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotSoundFileChanged( const QString& ) ) ); buttonTestPlaySoundEffect = new QPushButton( soundgrp ); buttonTestPlaySoundEffect->setPixmap( BarIcon("1rightarrow", KIcon::SizeSmall) ); QToolTip::add( buttonTestPlaySoundEffect, i18n("Play") ); connect( buttonTestPlaySoundEffect, SIGNAL( clicked() ), this, SLOT( playSound() ) ); buttonTestStopSoundEffect = new QPushButton( soundgrp ); buttonTestStopSoundEffect->setPixmap( BarIcon("player_stop", KIcon::SizeSmall) ); QToolTip::add( buttonTestStopSoundEffect, i18n("Stop") ); connect( buttonTestStopSoundEffect, SIGNAL( clicked() ), this, SLOT( stopSound() ) ); soundEffect = pg->getPageSoundEffect(); setButtonText(KDialogBase::User1,i18n( "Apply &Global" )); slideTime = pg->getPageTimer(); new QLabel( i18n("Automatically advance to the next slide after:"), rightpart ); timeSlider = new KIntNumInput( slideTime, rightpart ); timeSlider->setRange( 1, 600, 1 ); timeSlider->setSuffix( i18n( " seconds" ) ); connect( timeSlider, SIGNAL(valueChanged(int)), this, SLOT(timeChanged(int)) ); QWidget* rspacer = new QWidget( rightpart ); rspacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); QWidget* lspacer = new QWidget( leftpart ); lspacer->setMinimumSize( 10, spacingHint() ); soundEffectChanged(); }
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()) ); }