diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
commit | e654398e46e37abf457b2b1122ab898d2c51c49f (patch) | |
tree | d39ee6440f3c3663c3ead84a2d4cc2d034667e96 /juk/tageditor.cpp | |
parent | e4f29b18e19394b9352f52a6c0d0d0e3932cf511 (diff) | |
download | tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.tar.gz tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1157644 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'juk/tageditor.cpp')
-rw-r--r-- | juk/tageditor.cpp | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/juk/tageditor.cpp b/juk/tageditor.cpp index a9bc764d..449f4392 100644 --- a/juk/tageditor.cpp +++ b/juk/tageditor.cpp @@ -31,14 +31,14 @@ #include <kiconloader.h> #include <kactionclasses.h> -#include <qlabel.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qdir.h> -#include <qvalidator.h> -#include <qtooltip.h> -#include <qeventloop.h> -#include <qdict.h> +#include <tqlabel.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqdir.h> +#include <tqvalidator.h> +#include <tqtooltip.h> +#include <tqeventloop.h> +#include <tqdict.h> #include <id3v1genres.h> @@ -49,15 +49,15 @@ using namespace ActionCollection; class FileNameValidator : public QValidator { public: - FileNameValidator(QObject *parent, const char *name = 0) : - QValidator(parent, name) {} + FileNameValidator(TQObject *parent, const char *name = 0) : + TQValidator(parent, name) {} - virtual void fixup(QString &s) const + virtual void fixup(TQString &s) const { s.remove('/'); } - virtual State validate(QString &s, int &) const + virtual State validate(TQString &s, int &) const { if(s.find('/') != -1) return Invalid; @@ -68,10 +68,10 @@ public: class FileBoxToolTip : public QToolTip { public: - FileBoxToolTip(TagEditor *editor, QWidget *widget) : - QToolTip(widget), m_editor(editor) {} + FileBoxToolTip(TagEditor *editor, TQWidget *widget) : + TQToolTip(widget), m_editor(editor) {} protected: - virtual void maybeTip(const QPoint &) + virtual void maybeTip(const TQPoint &) { tip(parentWidget()->rect(), m_editor->items().first()->file().absFilePath()); } @@ -82,19 +82,19 @@ private: class FixedHLayout : public QHBoxLayout { public: - FixedHLayout(QWidget *parent, int margin = 0, int spacing = -1, const char *name = 0) : - QHBoxLayout(parent, margin, spacing, name), + FixedHLayout(TQWidget *parent, int margin = 0, int spacing = -1, const char *name = 0) : + TQHBoxLayout(parent, margin, spacing, name), m_width(-1) {} - FixedHLayout(QLayout *parentLayout, int spacing = -1, const char *name = 0) : - QHBoxLayout(parentLayout, spacing, name), + FixedHLayout(TQLayout *parentLayout, int spacing = -1, const char *name = 0) : + TQHBoxLayout(parentLayout, spacing, name), m_width(-1) {} void setWidth(int w = -1) { - m_width = w == -1 ? QHBoxLayout::minimumSize().width() : w; + m_width = w == -1 ? TQHBoxLayout::minimumSize().width() : w; } - virtual QSize minimumSize() const + virtual TQSize minimumSize() const { - QSize s = QHBoxLayout::minimumSize(); + TQSize s = TQHBoxLayout::minimumSize(); s.setWidth(m_width); return s; } @@ -127,8 +127,8 @@ private: // public members //////////////////////////////////////////////////////////////////////////////// -TagEditor::TagEditor(QWidget *parent, const char *name) : - QWidget(parent, name), +TagEditor::TagEditor(TQWidget *parent, const char *name) : + TQWidget(parent, name), m_currentPlaylist(0), m_observer(0), m_performingSave(false) @@ -172,8 +172,8 @@ void TagEditor::slotSetItems(const PlaylistItemList &list) saveChangesPrompt(); if(m_currentPlaylist) { - disconnect(m_currentPlaylist, SIGNAL(signalAboutToRemove(PlaylistItem *)), - this, SLOT(slotItemRemoved(PlaylistItem *))); + disconnect(m_currentPlaylist, TQT_SIGNAL(signalAboutToRemove(PlaylistItem *)), + this, TQT_SLOT(slotItemRemoved(PlaylistItem *))); } if(hadPlaylist && !m_currentPlaylist || !itemPlaylist) { @@ -189,9 +189,9 @@ void TagEditor::slotSetItems(const PlaylistItemList &list) } if(m_currentPlaylist) { - connect(m_currentPlaylist, SIGNAL(signalAboutToRemove(PlaylistItem *)), - this, SLOT(slotItemRemoved(PlaylistItem *))); - connect(m_currentPlaylist, SIGNAL(destroyed()), this, SLOT(slotPlaylistRemoved())); + connect(m_currentPlaylist, TQT_SIGNAL(signalAboutToRemove(PlaylistItem *)), + this, TQT_SLOT(slotItemRemoved(PlaylistItem *))); + connect(m_currentPlaylist, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotPlaylistRemoved())); } if(isVisible()) @@ -221,7 +221,7 @@ void TagEditor::slotRefresh() Tag *tag = item->file().tag(); - QFileInfo fi(item->file().absFilePath()); + TQFileInfo fi(item->file().absFilePath()); if(!fi.isWritable() && m_items.count() == 1) setEnabled(false); @@ -231,7 +231,7 @@ void TagEditor::slotRefresh() m_fileNameBox->setText(item->file().fileInfo().fileName()); new FileBoxToolTip(this, m_fileNameBox); - m_bitrateBox->setText(QString::number(tag->bitrate())); + m_bitrateBox->setText(TQString::number(tag->bitrate())); m_lengthBox->setText(tag->lengthString()); if(m_genreList.findIndex(tag->genre()) >= 0) @@ -255,7 +255,7 @@ void TagEditor::slotRefresh() if(it != m_items.end()) { - QValueListIterator<QWidget *> hideIt = m_hideList.begin(); + TQValueListIterator<TQWidget *> hideIt = m_hideList.begin(); for(; hideIt != m_hideList.end(); ++hideIt) (*hideIt)->hide(); @@ -335,7 +335,7 @@ void TagEditor::slotRefresh() else { // Clean up in the case that we are only handling one item. - QValueListIterator<QWidget *> showIt = m_hideList.begin(); + TQValueListIterator<TQWidget *> showIt = m_hideList.begin(); for(; showIt != m_hideList.end(); ++showIt) (*showIt)->show(); @@ -379,13 +379,13 @@ void TagEditor::updateCollection() if(!list) return; - QStringList artistList = list->uniqueSet(CollectionList::Artists); + TQStringList artistList = list->uniqueSet(CollectionList::Artists); artistList.sort(); m_artistNameBox->listBox()->clear(); m_artistNameBox->listBox()->insertStringList(artistList); m_artistNameBox->completionObject()->setItems(artistList); - QStringList albumList = list->uniqueSet(CollectionList::Albums); + TQStringList albumList = list->uniqueSet(CollectionList::Albums); albumList.sort(); m_albumNameBox->listBox()->clear(); m_albumNameBox->listBox()->insertStringList(albumList); @@ -397,7 +397,7 @@ void TagEditor::updateCollection() m_genreList = list->uniqueSet(CollectionList::Genres); - for(QStringList::ConstIterator it = m_genreList.begin(); it != m_genreList.end(); ++it) + for(TQStringList::ConstIterator it = m_genreList.begin(); it != m_genreList.end(); ++it) genreHash.insert(*it); TagLib::StringList genres = TagLib::ID3v1::genreList(); @@ -409,7 +409,7 @@ void TagEditor::updateCollection() m_genreList.sort(); m_genreBox->listBox()->clear(); - m_genreBox->listBox()->insertItem(QString::null); + m_genreBox->listBox()->insertItem(TQString::null); m_genreBox->listBox()->insertStringList(m_genreList); m_genreBox->completionObject()->setItems(m_genreList); } @@ -440,12 +440,12 @@ void TagEditor::readConfig() m_genreList.sort(); m_genreBox->clear(); - m_genreBox->insertItem(QString::null); + m_genreBox->insertItem(TQString::null); m_genreBox->insertStringList(m_genreList); m_genreBox->completionObject()->setItems(m_genreList); } -void TagEditor::readCompletionMode(KConfigBase *config, KComboBox *box, const QString &key) +void TagEditor::readCompletionMode(KConfigBase *config, KComboBox *box, const TQString &key) { KGlobalSettings::Completion mode = KGlobalSettings::Completion(config->readNumEntry(key, KGlobalSettings::CompletionAuto)); @@ -471,9 +471,9 @@ void TagEditor::setupActions() { KToggleAction *show = new KToggleAction(i18n("Show &Tag Editor"), "edit", 0, actions(), "showEditor"); show->setCheckedState(i18n("Hide &Tag Editor")); - connect(show, SIGNAL(toggled(bool)), this, SLOT(setShown(bool))); + connect(show, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(setShown(bool))); - new KAction(i18n("&Save"), "filesave", "CTRL+t", this, SLOT(slotSave()), actions(), "saveItem"); + new KAction(i18n("&Save"), "filesave", "CTRL+t", this, TQT_SLOT(slotSave()), actions(), "saveItem"); } void TagEditor::setupLayout() @@ -481,13 +481,13 @@ void TagEditor::setupLayout() static const int horizontalSpacing = 12; static const int verticalSpacing = 2; - QHBoxLayout *layout = new QHBoxLayout(this, 6, horizontalSpacing); + TQHBoxLayout *layout = new TQHBoxLayout(this, 6, horizontalSpacing); ////////////////////////////////////////////////////////////////////////////// // define two columns of the bottem layout ////////////////////////////////////////////////////////////////////////////// - QVBoxLayout *leftColumnLayout = new QVBoxLayout(layout, verticalSpacing); - QVBoxLayout *rightColumnLayout = new QVBoxLayout(layout, verticalSpacing); + TQVBoxLayout *leftColumnLayout = new TQVBoxLayout(layout, verticalSpacing); + TQVBoxLayout *rightColumnLayout = new TQVBoxLayout(layout, verticalSpacing); layout->setStretchFactor(leftColumnLayout, 2); layout->setStretchFactor(rightColumnLayout, 3); @@ -512,23 +512,23 @@ void TagEditor::setupLayout() addItem(i18n("&Genre:"), m_genreBox, leftColumnLayout, "knotify"); // this fills the space at the bottem of the left column - leftColumnLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, - QSizePolicy::Expanding)); + leftColumnLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Minimum, + TQSizePolicy::Expanding)); } ////////////////////////////////////////////////////////////////////////////// // put stuff in the right column ////////////////////////////////////////////////////////////////////////////// { // just for organization - QHBoxLayout *fileNameLayout = new QHBoxLayout(rightColumnLayout, + TQHBoxLayout *fileNameLayout = new TQHBoxLayout(rightColumnLayout, horizontalSpacing); m_fileNameBox = new KLineEdit(this, "fileNameBox"); m_fileNameBox->setValidator(new FileNameValidator(m_fileNameBox)); - QLabel *fileNameIcon = new QLabel(this); + TQLabel *fileNameIcon = new TQLabel(this); fileNameIcon->setPixmap(SmallIcon("sound")); - QWidget *fileNameLabel = addHidden(new QLabel(m_fileNameBox, i18n("&File name:"), this)); + TQWidget *fileNameLabel = addHidden(new TQLabel(m_fileNameBox, i18n("&File name:"), this)); fileNameLayout->addWidget(addHidden(fileNameIcon)); fileNameLayout->addWidget(fileNameLabel); @@ -545,17 +545,17 @@ void TagEditor::setupLayout() addItem(i18n("T&rack:"), m_trackSpin, trackRowLayout); m_trackSpin->installEventFilter(this); - trackRowLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, - QSizePolicy::Minimum)); + trackRowLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, + TQSizePolicy::Minimum)); m_yearSpin = new KIntSpinBox(0, 9999, 1, 0, 10, this, "yearSpin"); addItem(i18n("&Year:"), m_yearSpin, trackRowLayout); m_yearSpin->installEventFilter(this); - trackRowLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, - QSizePolicy::Minimum)); + trackRowLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, + TQSizePolicy::Minimum)); - trackRowLayout->addWidget(addHidden(new QLabel(i18n("Length:"), this))); + trackRowLayout->addWidget(addHidden(new TQLabel(i18n("Length:"), this))); m_lengthBox = new KLineEdit(this, "lengthBox"); // addItem(i18n("Length:"), m_lengthBox, trackRowLayout); m_lengthBox->setMinimumWidth(fontMetrics().width("00:00") + trackRowLayout->spacing()); @@ -564,10 +564,10 @@ void TagEditor::setupLayout() m_lengthBox->setReadOnly(true); trackRowLayout->addWidget(addHidden(m_lengthBox)); - trackRowLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, - QSizePolicy::Minimum)); + trackRowLayout->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding, + TQSizePolicy::Minimum)); - trackRowLayout->addWidget(addHidden(new QLabel(i18n("Bitrate:"), this))); + trackRowLayout->addWidget(addHidden(new TQLabel(i18n("Bitrate:"), this))); m_bitrateBox = new KLineEdit(this, "bitrateBox"); // addItem(i18n("Bitrate:"), m_bitrateBox, trackRowLayout); m_bitrateBox->setMinimumWidth(fontMetrics().width("000") + trackRowLayout->spacing()); @@ -586,32 +586,32 @@ void TagEditor::setupLayout() } - connect(m_artistNameBox, SIGNAL(textChanged(const QString&)), - this, SLOT(slotDataChanged())); + connect(m_artistNameBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotDataChanged())); - connect(m_trackNameBox, SIGNAL(textChanged(const QString&)), - this, SLOT(slotDataChanged())); + connect(m_trackNameBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotDataChanged())); - connect(m_albumNameBox, SIGNAL(textChanged(const QString&)), - this, SLOT(slotDataChanged())); + connect(m_albumNameBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotDataChanged())); - connect(m_genreBox, SIGNAL(activated(int)), - this, SLOT(slotDataChanged())); + connect(m_genreBox, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotDataChanged())); - connect(m_genreBox, SIGNAL(textChanged(const QString&)), - this, SLOT(slotDataChanged())); + connect(m_genreBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotDataChanged())); - connect(m_fileNameBox, SIGNAL(textChanged(const QString&)), - this, SLOT(slotDataChanged())); + connect(m_fileNameBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(slotDataChanged())); - connect(m_yearSpin, SIGNAL(valueChanged(int)), - this, SLOT(slotDataChanged())); + connect(m_yearSpin, TQT_SIGNAL(valueChanged(int)), + this, TQT_SLOT(slotDataChanged())); - connect(m_trackSpin, SIGNAL(valueChanged(int)), - this, SLOT(slotDataChanged())); + connect(m_trackSpin, TQT_SIGNAL(valueChanged(int)), + this, TQT_SLOT(slotDataChanged())); - connect(m_commentBox, SIGNAL(textChanged()), - this, SLOT(slotDataChanged())); + connect(m_commentBox, TQT_SIGNAL(textChanged()), + this, TQT_SLOT(slotDataChanged())); } void TagEditor::save(const PlaylistItemList &list) @@ -634,7 +634,7 @@ void TagEditor::save(const PlaylistItemList &list) // playlists will try to modify the file we edit if the tag changes // due to our alterations here. - kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput); + kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput); PlaylistItem *item = *it; @@ -644,7 +644,7 @@ void TagEditor::save(const PlaylistItemList &list) ++it; - QString fileName = item->file().fileInfo().dirPath() + QDir::separator() + + TQString fileName = item->file().fileInfo().dirPath() + TQDir::separator() + m_fileNameBox->text(); if(list.count() > 1) fileName = item->file().fileInfo().absFilePath(); @@ -694,7 +694,7 @@ void TagEditor::saveChangesPrompt() if(!isVisible() || !m_dataChanged || m_items.isEmpty()) return; - QStringList files; + TQStringList files; for(PlaylistItemList::Iterator it = m_items.begin(); it != m_items.end(); ++it) files.append((*it)->file().absFilePath()); @@ -711,30 +711,30 @@ void TagEditor::saveChangesPrompt() } } -void TagEditor::addItem(const QString &text, QWidget *item, QBoxLayout *layout, const QString &iconName) +void TagEditor::addItem(const TQString &text, TQWidget *item, TQBoxLayout *layout, const TQString &iconName) { if(!item || !layout) return; - QLabel *label = new QLabel(item, text, this); - QLabel *iconLabel = new QLabel(item, 0, this); + TQLabel *label = new TQLabel(item, text, this); + TQLabel *iconLabel = new TQLabel(item, 0, this); if(!iconName.isNull()) iconLabel->setPixmap(SmallIcon(iconName)); - QCheckBox *enableBox = new QCheckBox(i18n("Enable"), this); + TQCheckBox *enableBox = new TQCheckBox(i18n("Enable"), this); enableBox->setChecked(true); label->setMinimumHeight(enableBox->height()); - if(layout->direction() == QBoxLayout::LeftToRight) { + if(layout->direction() == TQBoxLayout::LeftToRight) { layout->addWidget(iconLabel); layout->addWidget(label); layout->addWidget(item); layout->addWidget(enableBox); } else { - QHBoxLayout *l = new QHBoxLayout(layout); + TQHBoxLayout *l = new TQHBoxLayout(layout); l->addWidget(iconLabel); l->addWidget(label); @@ -750,24 +750,24 @@ void TagEditor::addItem(const QString &text, QWidget *item, QBoxLayout *layout, enableBox->hide(); - connect(enableBox, SIGNAL(toggled(bool)), item, SLOT(setEnabled(bool))); + connect(enableBox, TQT_SIGNAL(toggled(bool)), item, TQT_SLOT(setEnabled(bool))); m_enableBoxes.insert(item, enableBox); } -void TagEditor::showEvent(QShowEvent *e) +void TagEditor::showEvent(TQShowEvent *e) { if(m_collectionChanged) { updateCollection(); slotRefresh(); } - QWidget::showEvent(e); + TQWidget::showEvent(e); } -bool TagEditor::eventFilter(QObject *watched, QEvent *e) +bool TagEditor::eventFilter(TQObject *watched, TQEvent *e) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); - if(watched->inherits("QSpinBox") && e->type() == QEvent::KeyRelease && ke->state() == 0) + TQKeyEvent *ke = static_cast<TQKeyEvent*>(e); + if(watched->inherits("TQSpinBox") && e->type() == TQEvent::KeyRelease && ke->state() == 0) slotDataChanged(); return false; |