SVN commit 855467 by mludwig: -- Qt3 warnings. M +23 -24 findfilesdialog.cpp M +93 -83 mathenvironmentdialog.cpp M +4 -5 mathenvironmentdialog.h --- trunk/extragear/office/kile/src/dialogs/findfilesdialog.cpp #855466:855467 @@ -125,7 +125,7 @@ projectgrouplayout->addWidget(projectname_label, 0, 1, Qt::AlignLeft | Qt::AlignVCenter); projectgrouplayout->addWidget(projectdir_label, 1, 0, Qt::AlignLeft | Qt::AlignVCenter); projectgrouplayout->addWidget(projectdirname_label, 1, 1, Qt::AlignLeft | Qt::AlignVCenter); - projectgrouplayout->setColStretch(1, 1); + projectgrouplayout->setColumnStretch(1, 1); // search groupbox QGroupBox *searchgroup = new QGroupBox(i18n("Search"), page); @@ -159,14 +159,13 @@ << i18n("Image") << i18n("Label") << i18n("Reference") - << i18n("File") - ; + << i18n("File"); QHBoxLayout *template_layout = new QHBoxLayout(); template_layout->setMargin(0); template_layout->setSpacing(KDialog::spacingHint()); template_combo = new KComboBox(false, searchgroup); - template_combo->insertStringList(templatemode_list); + template_combo->addItems(templatemode_list); template_combo->adjustSize(); template_combo->setFixedSize(template_combo->size()); template_layout->addWidget(template_combo); @@ -219,7 +218,7 @@ filtergrouplayout->addWidget(dir_label, 1, 0); filtergrouplayout->addWidget(dir_combo, 1, 1); filtergrouplayout->addWidget(recursive_box, 2, 1); - filtergrouplayout->setColStretch(1, 1); + filtergrouplayout->setColumnStretch(1, 1); // result box resultbox = new QListWidget(page); @@ -350,7 +349,7 @@ void FindFilesDialog::readConfig() { - pattern_combo->insertStringList(readList(KileGrep::SearchItems)); + pattern_combo->addItems(readList(KileGrep::SearchItems)); QString labels = getCommandList(KileDocument::CmdAttrLabel); QString references = getCommandList(KileDocument::CmdAttrReference); @@ -367,7 +366,7 @@ ; if (m_mode == KileGrep::Directory) { - dir_combo->comboBox()->insertStringList(readList(KileGrep::SearchPaths)); + dir_combo->comboBox()->addItems(readList(KileGrep::SearchPaths)); recursive_box->setChecked(KileConfig::grepRecursive()); } } @@ -448,7 +447,7 @@ if(!strings[0].isEmpty()) { result.append(strings[0]); } - strings.remove(strings[0]); + strings.removeAll(strings[0]); } return result; } @@ -471,7 +470,7 @@ emit itemSelected(m_projectdir + '/' + filename, linenumber.toInt()); } else { - emit itemSelected(dir_combo->comboBox()->text(0) + '/' + filename, linenumber.toInt()); + emit itemSelected(dir_combo->comboBox()->itemText(0) + '/' + filename, linenumber.toInt()); } } } @@ -589,7 +588,7 @@ QString FindFilesDialog::getPattern() { QString pattern; - int template_mode = template_combo->currentItem(); + int template_mode = template_combo->currentIndex(); if (template_mode < KileGrep::tmEnv) { pattern = template_edit->text(); if (pattern.isEmpty()) { @@ -621,8 +620,8 @@ { QString files, files_temp; - if(filter_combo->currentItem() >= 0) { - files_temp = m_filterList[filter_combo->currentItem()]; + if(filter_combo->currentIndex() >= 0) { + files_temp = m_filterList[filter_combo->currentIndex()]; } else { files_temp = filter_combo->currentText(); @@ -665,7 +664,7 @@ KILE_DEBUG() << "\tgrep: start slot search"; slotClear(); - if (template_combo->currentItem() < KileGrep::tmEnv && pattern_combo->currentText().isEmpty()) { + if (template_combo->currentIndex() < KileGrep::tmEnv && pattern_combo->currentText().isEmpty()) { return; } @@ -683,7 +682,7 @@ resultbox->setCursor(QCursor(Qt::WaitCursor)); search_button->setText(i18n("&Cancel")); - if (template_combo->currentItem() < KileGrep::tmEnv) { + if (template_combo->currentIndex() < KileGrep::tmEnv) { m_TemplateList[m_lastTemplateIndex] = template_edit->text(); } @@ -747,7 +746,7 @@ { bool search_state = (m_mode == KileGrep::Directory) || (m_mode == KileGrep::Project && m_projectOpened); - if (template_combo->currentItem() < KileGrep::tmEnv) { + if (template_combo->currentIndex() < KileGrep::tmEnv) { template_edit->setEnabled(true); search_button->setEnabled(search_state && !pattern_combo->currentText().isEmpty()); } @@ -764,9 +763,9 @@ KComboBox *combo = dir_combo->comboBox(); if (findListItem(combo, dir) < 0) { - combo->insertItem(dir); + combo->addItem(dir); } - if (combo->text(0) != dir) { + if (combo->itemText(0) != dir) { slotClear(); } } @@ -782,14 +781,14 @@ for (QStringList::Iterator it = filter_lst.begin(); it != filter_lst.end(); ++it) { QStringList filter_split = (*it).split("|"); m_filterList.append(filter_split[0]); - filter_combo->insertItem(filter_split[1]); + filter_combo->addItem(filter_split[1]); } } } void FindFilesDialog::appendFilter(const QString &name, const QString &filter) { - filter_combo->insertItem(name); + filter_combo->addItem(name); m_filterList.append(filter); } @@ -797,7 +796,7 @@ void FindFilesDialog::appendTemplate(const QString &name, const QString ®exp) { - template_combo->insertItem(name); + template_combo->addItem(name); m_TemplateList.append(regexp); } @@ -813,7 +812,7 @@ { QStringList list; for (int i = 0; i < combo->count() && i < KILEGREP_MAX; ++i) { - list.append(combo->text(i)); + list.append(combo->itemText(i)); } return list; } @@ -821,7 +820,7 @@ int FindFilesDialog::findListItem(KComboBox *combo, const QString &s) { for (int i = 0; i < combo->count(); ++i) { - if (combo->text(i) == s) { + if (combo->itemText(i) == s) { return i; } } @@ -848,8 +847,8 @@ } if(index != 0) { - combo->insertItem(s, 0); // insert this item as first item - combo->setCurrentItem(0); // and select it + combo->insertItem(0, s); // insert this item as first item + combo->setCurrentIndex(0); // and select it } } --- trunk/extragear/office/kile/src/dialogs/mathenvironmentdialog.cpp #855466:855467 @@ -1,11 +1,10 @@ -/*************************************************************************** +/***************************************************************************************** mathenvdialog.cpp ---------------------------------------------------------------------------- date : Dec 06 2005 version : 0.21 - copyright : (C) 2005 by Holger Danielsson - email : holger.danielsson@t-online.de - ***************************************************************************/ + copyright : (C) 2005 by Holger Danielsson (holger.danielsson@t-online.de) + *****************************************************************************************/ /*************************************************************************** * * @@ -69,9 +68,15 @@ m_coEnvironment = new QComboBox(envgroup); m_cbStarred = new QCheckBox(envgroup); - m_spRows = new QSpinBox(1, 99, 1, envgroup); + m_spRows = new QSpinBox(envgroup); + m_spRows->setMinimum(1); + m_spRows->setMaximum(99); + m_spRows->setSingleStep(1); m_spRows->setValue(3); - m_spCols = new QSpinBox(1, 49, 1, envgroup); + m_spCols = new QSpinBox(envgroup); + m_spCols->setMinimum(1); + m_spCols->setMaximum(49); + m_spCols->setSingleStep(1); m_spCols->setValue(3); m_edSpace = new KLineEdit("", envgroup); m_coTabulator = new QComboBox(envgroup); @@ -100,9 +105,9 @@ envlayout->addWidget(m_edSpace, 3, 4); envlayout->addWidget(m_cbBullets, 5, 4); envlayout->addWidget(frame, 4, 0, 1, 5); - envlayout->setRowSpacing(4, 30); - envlayout->setColSpacing(2, 20); - envlayout->setColStretch(4, 1); + envlayout->setRowMinimumHeight(4, 30); + envlayout->setColumnMinimumWidth(2, 20); + envlayout->setColumnStretch(4, 1); // add widgets vbox->addWidget(envgroup); @@ -118,16 +123,19 @@ m_lbBullets->setBuddy(m_cbBullets); // initialize dialog - m_coDisplaymath->insertItem(QString::null); - m_coDisplaymath->insertItem("displaymath"); - m_coDisplaymath->insertItem("\\["); - m_coDisplaymath->insertItem("equation"); - m_coDisplaymath->insertItem("equation*"); + m_coDisplaymath->addItem(QString()); + m_coDisplaymath->addItem("displaymath"); + m_coDisplaymath->addItem("\\["); + m_coDisplaymath->addItem("equation"); + m_coDisplaymath->addItem("equation*"); // install environments initEnvironments(); - m_coEnvironment->setCurrentText("align"); - slotEnvironmentChanged(m_coEnvironment->currentItem()); + int alignIndex = m_coEnvironment->findText("align"); + if(alignIndex >= 0) { + m_coEnvironment->setCurrentIndex(alignIndex); + } + slotEnvironmentChanged(m_coEnvironment->currentIndex()); // signals and slots connect(m_coEnvironment, SIGNAL(activated(int)), this, SLOT(slotEnvironmentChanged(int))); @@ -149,9 +157,8 @@ QStringList list; QStringList::ConstIterator it; m_latexCommands->commandList(list, (uint)(KileDocument::CmdAttrAmsmath | KileDocument::CmdAttrMath), false); - for (it = list.begin(); it != list.end(); ++it) - { - m_coEnvironment->insertItem(*it); + for (it = list.begin(); it != list.end(); ++it) { + m_coEnvironment->addItem(*it); } } @@ -169,13 +176,12 @@ void MathEnvironmentDialog::slotEnvironmentChanged(int index) { - KILE_DEBUG() << "environment changed: " << m_coEnvironment->text(index) << endl; - m_envname = m_coEnvironment->text(index); + KILE_DEBUG() << "environment changed: " << m_coEnvironment->itemText(index) << endl; + m_envname = m_coEnvironment->itemText(index); // look for environment parameter in dictionary KileDocument::LatexCmdAttributes attr; - if (m_latexCommands->commandAttributes(m_envname, attr)) - { + if (m_latexCommands->commandAttributes(m_envname, attr)) { m_starred = attr.starred; m_mathmode = attr.mathmode; m_columns = (attr.tabulator == "&"); @@ -197,44 +203,44 @@ int maxvalue = 1; int value = 1; - if (m_columns) - { + if (m_columns) { spinstate = true; - if (m_envname != "cases") // 1,49,3 - { + if (m_envname != "cases") { // 1,49,3 maxvalue = 49; value = 3; } - else - { + else { minvalue = 2; // 2,2,2 maxvalue = 2; value = 2; } - } else - if (m_groups) - { + } + else { + if (m_groups) { spinstate = true; labeltext = i18n("Number of groups:"); maxvalue = 19; // 1,19,1 - } else - if (m_fixedcolumns) - { + } + else { + if (m_fixedcolumns) { spinstate = true; minvalue = 3; // 3,3,3 maxvalue = 3; value = 3; - } else - if (m_envname == "split") - { + } + else { + if (m_envname == "split") { spinstate = true; maxvalue = 2; // 1,2,1 } - + } + } + } + // set column/group entries m_lbCols->setText(labeltext); - m_spCols->setMinValue(minvalue); - m_spCols->setMaxValue(maxvalue); + m_spCols->setMinimum(minvalue); + m_spCols->setMaximum(maxvalue); m_spCols->setValue(value); m_lbCols->setEnabled(spinstate); @@ -244,22 +250,28 @@ // set tabulator entries m_coTabulator->clear(); QStringList tablist; - if (m_tabulator == "&=&") + if(m_tabulator == "&=&") { tablist << "&=&" << "& &" << "&<&" << "&<=&" << "&>&" << "&>=&" - << "&\\ne&" << "&\\approx&" << "&\\equiv&" << "&\\conq&" ; - else - if (m_tabulator == "&=") + << "&\\ne&" << "&\\approx&" << "&\\equiv&" << "&\\conq&"; + } + else { + if(m_tabulator == "&=") { tablist << "&=" << "& " << "&<" << "&<=" << "&>" << "&>=" - << "&\\ne" << "&\\approx" << "&\\equiv" << "&\\conq" ; - else - if (! m_tabulator.isEmpty()) + << "&\\ne" << "&\\approx" << "&\\equiv" << "&\\conq"; + } + else { + if(!m_tabulator.isEmpty()) { tablist << "&"; + } + } + } bool tabstate = (tablist.count() > 0); m_lbTabulator->setEnabled(tabstate); m_coTabulator->setEnabled(tabstate); - if (tabstate) - m_coTabulator->insertStringList(tablist); - + if(tabstate) { + m_coTabulator->addItems(tablist); + } + // set displaymathmode entries m_lbDisplaymath->setEnabled(m_mathmode); m_coDisplaymath->setEnabled(m_mathmode); @@ -280,7 +292,7 @@ QString indent = m_ki->editorExtension()->autoIndentEnvironment(); // use bullets? - QString bullet = (m_cbBullets->isChecked()) ? s_bullet : QString::null; + QString bullet = (m_cbBullets->isChecked()) ? s_bullet : QString(); // normal tabulator QString tab = m_coTabulator->currentText(); @@ -295,46 +307,40 @@ QString topgrouptabulator, grouptabulator; int numgroups; bool aligngroups; - if (m_groups) - { + if (m_groups) { aligngroups = true; numgroups = (m_tabulator != "&") ? m_spCols->value() : 1; - if (m_edSpace->isEnabled()) - { + if (m_edSpace->isEnabled()) { QString spaces; topgrouptabulator = " &" + m_edSpace->text() + " "; grouptabulator = " & " + spaces.fill(' ', m_edSpace->text().length()); } - else - { + else { topgrouptabulator = " & "; grouptabulator = " & "; } } - else - { + else { aligngroups = false; - if (! m_fixedcolumns) + if(!m_fixedcolumns) { numgroups = (m_columns) ? m_spCols->value() - 1 : 0; - else + } + else { numgroups = 1; + } } // get displaymath mode QString displaymathbegin = QString::null; QString displaymathend = QString::null; - if (m_coDisplaymath->isEnabled()) - { + if(m_coDisplaymath->isEnabled()) { QString mathmode = m_coDisplaymath->currentText(); - if (! mathmode.isEmpty()) - { - if (mathmode == "\\[") - { + if(!mathmode.isEmpty()) { + if(mathmode == "\\[") { displaymathbegin = "\\[\n"; displaymathend = "\\]\n"; } - else - { + else { displaymathbegin = QString("\\begin{%1}\n").arg(mathmode); displaymathend = QString("\\end{%1}\n").arg(mathmode); } @@ -345,35 +351,39 @@ m_td.tagBegin = displaymathbegin; QString parameter; - if (isGroupsParameterEnv()) + if (isGroupsParameterEnv()) { parameter = QString("{%2}").arg(numgroups); - else - if (isParameterEnv()) + } + else { + if(isParameterEnv()) { parameter = '{' + bullet + '}'; + } + } // open environment m_td.tagBegin += QString("\\begin{%1}").arg(envname) + parameter + '\n'; - for (int row = 0; row < numrows; ++row) - { + for(int row = 0; row < numrows; ++row) { m_td.tagBegin += indent; - for (int col = 0; col < numgroups; ++col) - { + for(int col = 0; col < numgroups; ++col) { m_td.tagBegin += tabulator; // is there more than one group or column? - if (aligngroups && col < numgroups - 1) - { - if (row == 0) + if(aligngroups && col < numgroups - 1) { + if (row == 0) { m_td.tagBegin += bullet + topgrouptabulator; - else + } + else { m_td.tagBegin += bullet + grouptabulator; + } } } // last row without CR - if (row < numrows - 1) + if(row < numrows - 1) { m_td.tagBegin += bullet + " \\\\\n"; - else + } + else { m_td.tagBegin += bullet; + } } // close environment --- trunk/extragear/office/kile/src/dialogs/mathenvironmentdialog.h #855466:855467 @@ -1,11 +1,10 @@ -/*************************************************************************** +/****************************************************************************************** mathenvdialog.h ----------------------------------------------------------------------------- +------------------------------------------------------------------------------------------- date : Dec 06 2005 version : 0.21 - copyright : (C) 2005 by Holger Danielsson - email : holger.danielsson@t-online.de - ***************************************************************************/ + copyright : (C) 2005 by Holger Danielsson (holger.danielsson@t-online.de) + ******************************************************************************************/ /*************************************************************************** * *