diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-06 20:59:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-06 20:59:29 +0000 |
commit | 11f31c37e5fa4889d9989f10272f44845449cb7b (patch) | |
tree | 4383da04a76c497950d957fc6120b0fd0d9082c2 /src/gui/editors/guitar/GuitarChordSelectorDialog.cpp | |
parent | 832eb69d571e8e518db45d0c0e6fbc0f00690209 (diff) | |
download | rosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.tar.gz rosegarden-11f31c37e5fa4889d9989f10272f44845449cb7b.zip |
Initial TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1172292 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/editors/guitar/GuitarChordSelectorDialog.cpp')
-rw-r--r-- | src/gui/editors/guitar/GuitarChordSelectorDialog.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/gui/editors/guitar/GuitarChordSelectorDialog.cpp b/src/gui/editors/guitar/GuitarChordSelectorDialog.cpp index bd62c1f..5430098 100644 --- a/src/gui/editors/guitar/GuitarChordSelectorDialog.cpp +++ b/src/gui/editors/guitar/GuitarChordSelectorDialog.cpp @@ -29,11 +29,11 @@ #include "FingeringListBoxItem.h" #include "misc/Debug.h" -#include <qlistbox.h> -#include <qlayout.h> -#include <qcombobox.h> -#include <qpushbutton.h> -#include <qlabel.h> +#include <tqlistbox.h> +#include <tqlayout.h> +#include <tqcombobox.h> +#include <tqpushbutton.h> +#include <tqlabel.h> #include <klocale.h> #include <kmessagebox.h> #include <kstddirs.h> @@ -41,34 +41,34 @@ namespace Rosegarden { -GuitarChordSelectorDialog::GuitarChordSelectorDialog(QWidget *parent) +GuitarChordSelectorDialog::GuitarChordSelectorDialog(TQWidget *parent) : KDialogBase(parent, "GuitarChordSelector", true, i18n("Guitar Chord Selector"), Ok|Cancel) { - QWidget *page = new QWidget(this); + TQWidget *page = new TQWidget(this); setMainWidget(page); - QGridLayout *topLayout = new QGridLayout(page, 3, 4, spacingHint()); + TQGridLayout *topLayout = new TQGridLayout(page, 3, 4, spacingHint()); - topLayout->addWidget(new QLabel(i18n("Root"), page), 0, 0); - m_rootNotesList = new QListBox(page); + topLayout->addWidget(new TQLabel(i18n("Root"), page), 0, 0); + m_rootNotesList = new TQListBox(page); topLayout->addWidget(m_rootNotesList, 1, 0); - topLayout->addWidget(new QLabel(i18n("Extension"), page), 0, 1); - m_chordExtList = new QListBox(page); + topLayout->addWidget(new TQLabel(i18n("Extension"), page), 0, 1); + m_chordExtList = new TQListBox(page); topLayout->addWidget(m_chordExtList, 1, 1); - m_newFingeringButton = new QPushButton(i18n("New"), page); - m_deleteFingeringButton = new QPushButton(i18n("Delete"), page); - m_editFingeringButton = new QPushButton(i18n("Edit"), page); + m_newFingeringButton = new TQPushButton(i18n("New"), page); + m_deleteFingeringButton = new TQPushButton(i18n("Delete"), page); + m_editFingeringButton = new TQPushButton(i18n("Edit"), page); - m_chordComplexityCombo = new QComboBox(page); + m_chordComplexityCombo = new TQComboBox(page); m_chordComplexityCombo->insertItem(i18n("beginner")); m_chordComplexityCombo->insertItem(i18n("common")); m_chordComplexityCombo->insertItem(i18n("all")); - connect(m_chordComplexityCombo, SIGNAL(activated(int)), - this, SLOT(slotComplexityChanged(int))); + connect(m_chordComplexityCombo, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotComplexityChanged(int))); - QVBoxLayout* vboxLayout = new QVBoxLayout(page, 5); + TQVBoxLayout* vboxLayout = new TQVBoxLayout(page, 5); topLayout->addMultiCellLayout(vboxLayout, 1, 3, 2, 2); vboxLayout->addWidget(m_chordComplexityCombo); vboxLayout->addStretch(10); @@ -76,26 +76,26 @@ GuitarChordSelectorDialog::GuitarChordSelectorDialog(QWidget *parent) vboxLayout->addWidget(m_deleteFingeringButton); vboxLayout->addWidget(m_editFingeringButton); - connect(m_newFingeringButton, SIGNAL(clicked()), - this, SLOT(slotNewFingering())); - connect(m_deleteFingeringButton, SIGNAL(clicked()), - this, SLOT(slotDeleteFingering())); - connect(m_editFingeringButton, SIGNAL(clicked()), - this, SLOT(slotEditFingering())); + connect(m_newFingeringButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotNewFingering())); + connect(m_deleteFingeringButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotDeleteFingering())); + connect(m_editFingeringButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotEditFingering())); - topLayout->addWidget(new QLabel(i18n("Fingerings"), page), 0, 3); - m_fingeringsList = new QListBox(page); + topLayout->addWidget(new TQLabel(i18n("Fingerings"), page), 0, 3); + m_fingeringsList = new TQListBox(page); topLayout->addMultiCellWidget(m_fingeringsList, 1, 2, 3, 3); m_fingeringBox = new FingeringBox(false, page); topLayout->addMultiCellWidget(m_fingeringBox, 2, 2, 0, 1); - connect(m_rootNotesList, SIGNAL(highlighted(int)), - this, SLOT(slotRootHighlighted(int))); - connect(m_chordExtList, SIGNAL(highlighted(int)), - this, SLOT(slotChordExtHighlighted(int))); - connect(m_fingeringsList, SIGNAL(highlighted(QListBoxItem*)), - this, SLOT(slotFingeringHighlighted(QListBoxItem*))); + connect(m_rootNotesList, TQT_SIGNAL(highlighted(int)), + this, TQT_SLOT(slotRootHighlighted(int))); + connect(m_chordExtList, TQT_SIGNAL(highlighted(int)), + this, TQT_SLOT(slotChordExtHighlighted(int))); + connect(m_fingeringsList, TQT_SIGNAL(highlighted(TQListBoxItem*)), + this, TQT_SLOT(slotFingeringHighlighted(TQListBoxItem*))); } void @@ -103,7 +103,7 @@ GuitarChordSelectorDialog::init() { // populate the listboxes // - std::vector<QString> chordFiles = getAvailableChordFiles(); + std::vector<TQString> chordFiles = getAvailableChordFiles(); parseChordFiles(chordFiles); @@ -115,11 +115,11 @@ GuitarChordSelectorDialog::init() void GuitarChordSelectorDialog::populate() { - QStringList rootList = m_chordMap.getRootList(); + TQStringList rootList = m_chordMap.getRootList(); if (rootList.count() > 0) { m_rootNotesList->insertStringList(rootList); - QStringList extList = m_chordMap.getExtList(rootList.first()); + TQStringList extList = m_chordMap.getExtList(rootList.first()); populateExtensions(extList); Guitar::ChordMap::chordarray chords = m_chordMap.getChords(rootList.first(), extList.first()); @@ -156,7 +156,7 @@ GuitarChordSelectorDialog::slotRootHighlighted(int i) m_chord.setRoot(m_rootNotesList->text(i)); - QStringList extList = m_chordMap.getExtList(m_chord.getRoot()); + TQStringList extList = m_chordMap.getExtList(m_chord.getRoot()); populateExtensions(extList); if (m_chordExtList->count() > 0) m_chordExtList->setCurrentItem(0); @@ -176,7 +176,7 @@ GuitarChordSelectorDialog::slotChordExtHighlighted(int i) } void -GuitarChordSelectorDialog::slotFingeringHighlighted(QListBoxItem* listBoxItem) +GuitarChordSelectorDialog::slotFingeringHighlighted(TQListBoxItem* listBoxItem) { NOTATION_DEBUG << "GuitarChordSelectorDialog::slotFingeringHighlighted\n"; @@ -193,7 +193,7 @@ GuitarChordSelectorDialog::slotComplexityChanged(int) { // simply repopulate the extension list box // - QStringList extList = m_chordMap.getExtList(m_chord.getRoot()); + TQStringList extList = m_chordMap.getExtList(m_chord.getRoot()); populateExtensions(extList); if (m_chordExtList->count() > 0) m_chordExtList->setCurrentItem(0); @@ -210,7 +210,7 @@ GuitarChordSelectorDialog::slotNewFingering() GuitarChordEditorDialog* chordEditorDialog = new GuitarChordEditorDialog(newChord, m_chordMap, this); - if (chordEditorDialog->exec() == QDialog::Accepted) { + if (chordEditorDialog->exec() == TQDialog::Accepted) { m_chordMap.insert(newChord); // populate lists // @@ -245,7 +245,7 @@ GuitarChordSelectorDialog::slotEditFingering() Guitar::Chord newChord = m_chord; GuitarChordEditorDialog* chordEditorDialog = new GuitarChordEditorDialog(newChord, m_chordMap, this); - if (chordEditorDialog->exec() == QDialog::Accepted) { + if (chordEditorDialog->exec() == TQDialog::Accepted) { NOTATION_DEBUG << "GuitarChordSelectorDialog::slotEditFingering() - current map state :\n"; m_chordMap.debugDump(); m_chordMap.substitute(m_chord, newChord); @@ -280,13 +280,13 @@ GuitarChordSelectorDialog::setChord(const Guitar::Chord& chord) // select the chord's root // m_rootNotesList->setCurrentItem(0); - QListBoxItem* correspondingRoot = m_rootNotesList->findItem(chord.getRoot(), Qt::ExactMatch); + TQListBoxItem* correspondingRoot = m_rootNotesList->findItem(chord.getRoot(), Qt::ExactMatch); if (correspondingRoot) m_rootNotesList->setSelected(correspondingRoot, true); // update the dialog's complexity setting if needed, then populate the extension list // - QString chordExt = chord.getExt(); + TQString chordExt = chord.getExt(); int complexityLevel = m_chordComplexityCombo->currentItem(); int chordComplexity = evaluateChordComplexity(chordExt); @@ -294,7 +294,7 @@ GuitarChordSelectorDialog::setChord(const Guitar::Chord& chord) m_chordComplexityCombo->setCurrentItem(chordComplexity); } - QStringList extList = m_chordMap.getExtList(chord.getRoot()); + TQStringList extList = m_chordMap.getExtList(chord.getRoot()); populateExtensions(extList); // select the chord's extension @@ -303,7 +303,7 @@ GuitarChordSelectorDialog::setChord(const Guitar::Chord& chord) chordExt = ""; m_chordExtList->setSelected(0, true); } else { - QListBoxItem* correspondingExt = m_chordExtList->findItem(chordExt, Qt::ExactMatch); + TQListBoxItem* correspondingExt = m_chordExtList->findItem(chordExt, Qt::ExactMatch); if (correspondingExt) m_chordExtList->setSelected(correspondingExt, true); } @@ -321,9 +321,9 @@ GuitarChordSelectorDialog::populateFingerings(const Guitar::ChordMap::chordarray for(Guitar::ChordMap::chordarray::const_iterator i = chords.begin(); i != chords.end(); ++i) { const Guitar::Chord& chord = *i; - QString fingeringString = chord.getFingering().toString(); + TQString fingeringString = chord.getFingering().toString(); NOTATION_DEBUG << "GuitarChordSelectorDialog::populateFingerings " << chord << endl; - QPixmap fingeringPixmap = getFingeringPixmap(chord.getFingering()); + TQPixmap fingeringPixmap = getFingeringPixmap(chord.getFingering()); FingeringListBoxItem *item = new FingeringListBoxItem(chord, m_fingeringsList, fingeringPixmap, fingeringString); if (refFingering == chord.getFingering()) { NOTATION_DEBUG << "GuitarChordSelectorDialog::populateFingerings - fingering found " << fingeringString << endl; @@ -337,11 +337,11 @@ GuitarChordSelectorDialog::populateFingerings(const Guitar::ChordMap::chordarray QPixmap GuitarChordSelectorDialog::getFingeringPixmap(const Guitar::Fingering& fingering) const { - QPixmap pixmap(FINGERING_PIXMAP_WIDTH, FINGERING_PIXMAP_HEIGHT); + TQPixmap pixmap(FINGERING_PIXMAP_WIDTH, FINGERING_PIXMAP_HEIGHT); pixmap.fill(); - QPainter pp(&pixmap); - QPainter *p = &pp; + TQPainter pp(&pixmap); + TQPainter *p = &pp; p->setViewport(FINGERING_PIXMAP_H_MARGIN, FINGERING_PIXMAP_W_MARGIN, FINGERING_PIXMAP_WIDTH - FINGERING_PIXMAP_W_MARGIN, @@ -353,7 +353,7 @@ GuitarChordSelectorDialog::getFingeringPixmap(const Guitar::Fingering& fingering } void -GuitarChordSelectorDialog::populateExtensions(const QStringList& extList) +GuitarChordSelectorDialog::populateExtensions(const TQStringList& extList) { m_chordExtList->clear(); @@ -361,8 +361,8 @@ GuitarChordSelectorDialog::populateExtensions(const QStringList& extList) // some filtering needs to be done int complexityLevel = m_chordComplexityCombo->currentItem(); - QStringList filteredList; - for(QStringList::const_iterator i = extList.constBegin(); i != extList.constEnd(); ++i) { + TQStringList filteredList; + for(TQStringList::const_iterator i = extList.constBegin(); i != extList.constEnd(); ++i) { if (evaluateChordComplexity((*i).lower().stripWhiteSpace()) <= complexityLevel) { NOTATION_DEBUG << "GuitarChordSelectorDialog::populateExtensions - adding '" << *i << "'\n"; filteredList.append(*i); @@ -377,7 +377,7 @@ GuitarChordSelectorDialog::populateExtensions(const QStringList& extList) } int -GuitarChordSelectorDialog::evaluateChordComplexity(const QString& ext) +GuitarChordSelectorDialog::evaluateChordComplexity(const TQString& ext) { if (ext.isEmpty() || ext == "7" || @@ -402,24 +402,24 @@ GuitarChordSelectorDialog::evaluateChordComplexity(const QString& ext) } void -GuitarChordSelectorDialog::parseChordFiles(const std::vector<QString>& chordFiles) +GuitarChordSelectorDialog::parseChordFiles(const std::vector<TQString>& chordFiles) { - for(std::vector<QString>::const_iterator i = chordFiles.begin(); i != chordFiles.end(); ++i) { + for(std::vector<TQString>::const_iterator i = chordFiles.begin(); i != chordFiles.end(); ++i) { parseChordFile(*i); } } void -GuitarChordSelectorDialog::parseChordFile(const QString& chordFileName) +GuitarChordSelectorDialog::parseChordFile(const TQString& chordFileName) { ChordXmlHandler handler(m_chordMap); - QFile chordFile(chordFileName); + TQFile chordFile(chordFileName); bool ok = chordFile.open(IO_ReadOnly); if (!ok) KMessageBox::error(0, i18n("couldn't open file '%1'").arg(handler.errorString())); - QXmlInputSource source(chordFile); - QXmlSimpleReader reader; + TQXmlInputSource source(chordFile); + TQXmlSimpleReader reader; reader.setContentHandler(&handler); reader.setErrorHandler(&handler); NOTATION_DEBUG << "GuitarChordSelectorDialog::parseChordFile() parsing " << chordFileName << endl; @@ -436,15 +436,15 @@ GuitarChordSelectorDialog::setEditionEnabled(bool enabled) m_editFingeringButton->setEnabled(enabled); } -std::vector<QString> +std::vector<TQString> GuitarChordSelectorDialog::getAvailableChordFiles() { - std::vector<QString> names; + std::vector<TQString> names; // Read config for default directory - QStringList chordDictFiles = KGlobal::dirs()->findAllResources("appdata", "chords/*.xml"); + TQStringList chordDictFiles = KGlobal::dirs()->findAllResources("appdata", "chords/*.xml"); - for(QStringList::iterator i = chordDictFiles.begin(); i != chordDictFiles.end(); ++i) { + for(TQStringList::iterator i = chordDictFiles.begin(); i != chordDictFiles.end(); ++i) { NOTATION_DEBUG << "GuitarChordSelectorDialog::getAvailableChordFiles : adding file " << *i << endl; names.push_back(*i); } @@ -456,12 +456,12 @@ bool GuitarChordSelectorDialog::saveUserChordMap() { // Read config for user directory - QString userDir = KGlobal::dirs()->saveLocation("appdata", "chords/"); + TQString userDir = KGlobal::dirs()->saveLocation("appdata", "chords/"); - QString userChordDictPath = userDir + "/user_chords.xml"; + TQString userChordDictPath = userDir + "/user_chords.xml"; NOTATION_DEBUG << "GuitarChordSelectorDialog::saveUserChordMap() : saving user chord map to " << userChordDictPath << endl; - QString errMsg; + TQString errMsg; m_chordMap.saveDocument(userChordDictPath, true, errMsg); |