diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /noatun-plugins/lyrics | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/lyrics')
-rw-r--r-- | noatun-plugins/lyrics/Makefile.am | 2 | ||||
-rw-r--r-- | noatun-plugins/lyrics/cmodule.cpp | 36 | ||||
-rw-r--r-- | noatun-plugins/lyrics/cmodule.h | 1 | ||||
-rw-r--r-- | noatun-plugins/lyrics/historymanager.cpp | 2 | ||||
-rw-r--r-- | noatun-plugins/lyrics/historymanager.h | 3 | ||||
-rw-r--r-- | noatun-plugins/lyrics/lyrics.cpp | 50 | ||||
-rw-r--r-- | noatun-plugins/lyrics/lyrics.h | 1 |
7 files changed, 49 insertions, 46 deletions
diff --git a/noatun-plugins/lyrics/Makefile.am b/noatun-plugins/lyrics/Makefile.am index ac34a17..1ddb6ef 100644 --- a/noatun-plugins/lyrics/Makefile.am +++ b/noatun-plugins/lyrics/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES= $(all_includes) +INCLUDES= $(all_includes) -I$(kde_includes)/kde kde_module_LTLIBRARIES = noatunlyrics.la noatunlyrics_la_SOURCES = lyrics.cpp historymanager.cpp cmodule.cpp diff --git a/noatun-plugins/lyrics/cmodule.cpp b/noatun-plugins/lyrics/cmodule.cpp index efc2d77..6f2183f 100644 --- a/noatun-plugins/lyrics/cmodule.cpp +++ b/noatun-plugins/lyrics/cmodule.cpp @@ -29,7 +29,7 @@ const char *const DEFAULT_NAME = "Everything2," "Everything2 (author info)"; -const char *const DEFAULT_QUERY = +const char *const DEFAULT_TQUERY = "http://www.google.com/search?q=lyrics+$(title)+$(author)+$(album)," "http://www.purelyrics.com/index.php?search_artist=$(author)&search_album=$(album)&search_title=$(title)&search_lyrics=&search_advsubmit2=Search," "http://search.sing365.com/search.php?searchstr=$(title)&submit=search&category=song," @@ -47,23 +47,23 @@ const char *const DEFAULT_QUERY = LyricsCModule::LyricsCModule(TQObject *_parent) : CModule(i18n("Lyrics"), i18n("Configure Lyrics Plugin"), "document", _parent) { /* Thanks to the kde-usability guys for the help designing this dialog! * help to simon edwards of KGuardGod, for a big help designing it */ - TQVBoxLayout *vlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); - TQHBoxLayout *hlayout = new TQHBoxLayout(vlayout, KDialog::spacingHint()); - vlayout->setStretchFactor( hlayout, 1 ); + TQVBoxLayout *vtqlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + TQHBoxLayout *htqlayout = new TQHBoxLayout(vtqlayout, KDialog::spacingHint()); + vtqlayout->setStretchFactor( htqlayout, 1 ); // Search box - TQVBoxLayout *boxlayout = new TQVBoxLayout( hlayout, KDialog::spacingHint() ); - boxlayout->addWidget( new TQLabel( i18n("Search providers:" ), this ) ); + TQVBoxLayout *boxtqlayout = new TQVBoxLayout( htqlayout, KDialog::spacingHint() ); + boxtqlayout->addWidget( new TQLabel( i18n("Search providers:" ), this ) ); providersBox = new KListBox( this, "providersBox" ); - boxlayout->addWidget(providersBox); + boxtqlayout->addWidget(providersBox); - boxButtons = new KButtonBox( this, Vertical ); - boxButtons->addButton( i18n( "New Search Provider" ), this, TQT_SLOT( newSearch() ) ); - boxButtons->addButton( i18n( "Delete Search Provider" ), this, TQT_SLOT( delSearch() ) ); - boxButtons->addButton( i18n( "Move Up" ), this, TQT_SLOT( moveUpSearch() ) ); - boxButtons->addButton( i18n( "Move Down" ), this, TQT_SLOT( moveDownSearch() ) ); - boxButtons->layout(); - boxlayout->addWidget( boxButtons ); + boxButtons = new KButtonBox( this,Qt::Vertical ); + boxButtons->addButton( i18n( "New Search Provider" ), TQT_TQOBJECT(this), TQT_SLOT( newSearch() ) ); + boxButtons->addButton( i18n( "Delete Search Provider" ), TQT_TQOBJECT(this), TQT_SLOT( delSearch() ) ); + boxButtons->addButton( i18n( "Move Up" ), TQT_TQOBJECT(this), TQT_SLOT( moveUpSearch() ) ); + boxButtons->addButton( i18n( "Move Down" ), TQT_TQOBJECT(this), TQT_SLOT( moveDownSearch() ) ); + boxButtons->tqlayout(); + boxtqlayout->addWidget( boxButtons ); // Edit box TQGroupBox *propBox = new TQVGroupBox( i18n("Search Provider Properties" ), this ); @@ -76,8 +76,8 @@ LyricsCModule::LyricsCModule(TQObject *_parent) : CModule(i18n("Lyrics"), i18n(" /* ATTENTION to translators: * The property names can't be translated. This means that $(author) must be kept as $(author), $(title) as $(title), etc, or it won't work.*/ TQLabel *textLabel = new TQLabel(i18n("For your query, you can use any property of your multimedia item, just enclosing it with a $(property).\n\nSome common properties used are $(title), $(author) and $(album). For example, to search in Google for the author, title and track, just use:\nhttp://www.google.com/search?q=$(author)+$(title)+$(track)"), propBox, "textLabel"); - textLabel->setAlignment(Qt::WordBreak); - hlayout->addWidget( propBox, 1 ); + textLabel->tqsetAlignment(TQt::WordBreak); + htqlayout->addWidget( propBox, 1 ); /* Signal/slots */ nameEdit->setEnabled( false ); @@ -88,7 +88,7 @@ LyricsCModule::LyricsCModule(TQObject *_parent) : CModule(i18n("Lyrics"), i18n(" - vlayout->addStretch(); + vtqlayout->addStretch(); reopen(); save(); } @@ -205,7 +205,7 @@ void LyricsCModule::reopen() { queryList = conf->readListEntry( "queryList" ); nameList = conf->readListEntry( "nameList" ); if ( queryList.count() == 0 && nameList.count() == 0 ) { - queryList = TQStringList::split( ",", DEFAULT_QUERY ); + queryList = TQStringList::split( ",", DEFAULT_TQUERY ); nameList = TQStringList::split( ",", DEFAULT_NAME ); } TQStringList::Iterator queryIt, nameIt; diff --git a/noatun-plugins/lyrics/cmodule.h b/noatun-plugins/lyrics/cmodule.h index a7fdc08..7a6ddc1 100644 --- a/noatun-plugins/lyrics/cmodule.h +++ b/noatun-plugins/lyrics/cmodule.h @@ -16,6 +16,7 @@ struct SearchProvider { class LyricsCModule : public CModule { Q_OBJECT + TQ_OBJECT public: LyricsCModule(TQObject *_parent); public slots: diff --git a/noatun-plugins/lyrics/historymanager.cpp b/noatun-plugins/lyrics/historymanager.cpp index 629466d..ac958e3 100644 --- a/noatun-plugins/lyrics/historymanager.cpp +++ b/noatun-plugins/lyrics/historymanager.cpp @@ -4,7 +4,7 @@ *** TODO: Add more complex support (like in Konqueror) Maybe use Konqueror's History Manager */ -HistoryManager::HistoryManager(TQObject *parent) : TQObject(parent) { +HistoryManager::HistoryManager(TQObject *tqparent) : TQObject(tqparent) { } HistoryManager::~HistoryManager() { diff --git a/noatun-plugins/lyrics/historymanager.h b/noatun-plugins/lyrics/historymanager.h index 910e463..7444f5b 100644 --- a/noatun-plugins/lyrics/historymanager.h +++ b/noatun-plugins/lyrics/historymanager.h @@ -7,8 +7,9 @@ class HistoryManager : public TQObject { Q_OBJECT + TQ_OBJECT public: - HistoryManager(TQObject *parent = NULL); + HistoryManager(TQObject *tqparent = NULL); ~HistoryManager(); KURL back(); KURL forward(); diff --git a/noatun-plugins/lyrics/lyrics.cpp b/noatun-plugins/lyrics/lyrics.cpp index 1c7a05b..f0c9ebd 100644 --- a/noatun-plugins/lyrics/lyrics.cpp +++ b/noatun-plugins/lyrics/lyrics.cpp @@ -27,28 +27,28 @@ Lyrics::Lyrics() : KMainWindow(), Plugin(), active(false) { lyrics = this; /* Create default actions */ - (void)KStdAction::close(this, TQT_SLOT(close()), actionCollection()); - ( void )KStdAction::goTo( this, TQT_SLOT( goTo() ), actionCollection(), "go_web_goTo" ); - //(void)KStdAction::print(this, TQT_SLOT(print()), actionCollection()); - //(void)KStdAction::printPreview(this, TQT_SLOT(printPreview()), actionCollection()); - //(void)KStdAction::mail(this, TQT_SLOT(mail()), actionCollection()); - //(void)KStdAction::find(this, TQT_SLOT(find()), actionCollection()); + (void)KStdAction::close(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + ( void )KStdAction::goTo( TQT_TQOBJECT(this), TQT_SLOT( goTo() ), actionCollection(), "go_web_goTo" ); + //(void)KStdAction::print(TQT_TQOBJECT(this), TQT_SLOT(print()), actionCollection()); + //(void)KStdAction::printPreview(TQT_TQOBJECT(this), TQT_SLOT(printPreview()), actionCollection()); + //(void)KStdAction::mail(TQT_TQOBJECT(this), TQT_SLOT(mail()), actionCollection()); + //(void)KStdAction::tqfind(TQT_TQOBJECT(this), TQT_SLOT(tqfind()), actionCollection()); follow_act = new KToggleAction(i18n("&Follow Noatun Playlist"), "goto", 0, actionCollection(), "follow"); - KStdAction::redisplay(this, TQT_SLOT(viewLyrics()), actionCollection()); + KStdAction::redisplay(TQT_TQOBJECT(this), TQT_SLOT(viewLyrics()), actionCollection()); attach_act = new KToggleAction(i18n("&Link URL to File"), "attach", KShortcut("CTRL+ALT+A"), actionCollection(), "attach_url"); connect(attach_act, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(attach(bool))); - back_act = KStdAction::back(this, TQT_SLOT(back()), actionCollection()); + back_act = KStdAction::back(TQT_TQOBJECT(this), TQT_SLOT(back()), actionCollection()); back_act->setEnabled(false); - forward_act = KStdAction::forward(this, TQT_SLOT(forward()), actionCollection()); + forward_act = KStdAction::forward(TQT_TQOBJECT(this), TQT_SLOT(forward()), actionCollection()); forward_act->setEnabled(false); new KWidgetAction( new TQLabel(i18n("Search provider:"), this, "kde toolbar widget"), i18n("Search Provider"), 0, 0, 0, actionCollection(), "search_label"); - site_act = new KSelectAction(i18n("&Search Provider"), 0, this, TQT_SLOT(viewLyrics()), actionCollection(), "search_provider"); + site_act = new KSelectAction(i18n("&Search Provider"), 0, TQT_TQOBJECT(this), TQT_SLOT(viewLyrics()), actionCollection(), "search_provider"); /* Add entry to menu */ - menuID = napp->pluginMenuAdd(i18n("&View Lyrics"), this, TQT_SLOT(viewLyrics())); + menuID = napp->pluginMenuAdd(i18n("&View Lyrics"), TQT_TQOBJECT(this), TQT_SLOT(viewLyrics())); /* Create history manager and htmlpart */ - history = new HistoryManager(this); + history = new HistoryManager(TQT_TQOBJECT(this)); htmlpart = new KHTMLPart(this); //htmlpart->view()->setMinimumSize(350, 420); @@ -59,9 +59,9 @@ Lyrics::Lyrics() : KMainWindow(), Plugin(), active(false) connect( history, TQT_SIGNAL(uiChanged(int, bool)), this, TQT_SLOT(changeUI(int, bool)) ); connect( napp->player(), TQT_SIGNAL(newSong()), this, TQT_SLOT(newSong()) ); - /* Status bar */ + /* tqStatus bar */ statusBar()->insertItem(i18n("Ready"), 0, 1); - statusBar()->setItemAlignment(0, Qt::AlignLeft); + statusBar()->setItemAlignment(0, TQt::AlignLeft); /* Finalize the GUI */ setCentralWidget(htmlpart->view()); @@ -73,7 +73,7 @@ Lyrics::Lyrics() : KMainWindow(), Plugin(), active(false) config->setGroup("Lyrics"); follow_act->setChecked(config->readBoolEntry("follow", true)); /* Create config object */ - new LyricsCModule(this); + new LyricsCModule(TQT_TQOBJECT(this)); } @@ -98,7 +98,7 @@ void Lyrics::attach(bool a) { if ( !napp->player()->current() ) return; if (a) { - KMessageBox::information(this, i18n("Choosing this option, the current URL will be attached to the current file. This way, if you try to view the lyrics of this file later, you won't have to search for it again. This information can be stored between sessions, as long as your playlist stores metadata about the multimedia items (almost all the playlists do). If you want to be able to search for other lyrics for this music, you must select this option again to clear the stored URL."), TQString::null, "lyrics::attach_info"); + KMessageBox::information(this, i18n("Choosing this option, the current URL will be attached to the current file. This way, if you try to view the lyrics of this file later, you won't have to search for it again. This information can be stored between sessions, as long as your playlist stores metadata about the multimedia items (almost all the playlists do). If you want to be able to search for other lyrics for this music, you must select this option again to clear the stored URL."), TQString(), "lyrics::attach_info"); kdDebug(90020) << "Setting URL for (attach)" << napp->player()->current().title() << endl; napp->player()->current().setProperty("Lyrics::URL", htmlpart->url().url()); site_act->setEnabled(false); @@ -122,7 +122,7 @@ void Lyrics::loadedURL() if ( !napp->player()->current() ) return; statusBar()->changeItem(i18n("Loaded"), 0); - setCaption(i18n("Lyrics: %1").arg(napp->player()->current().property("title"))); + setCaption(i18n("Lyrics: %1").tqarg(napp->player()->current().property("title"))); if (!htmlpart->url().url().isEmpty() && napp->player()->current() && !napp->player()->current().property("Lyrics::URL").isEmpty()) { kdDebug(90020) << "Setting URL for (loaded)" << napp->player()->current().title() << endl; napp->player()->current().setProperty("Lyrics::URL", htmlpart->url().url()); @@ -192,11 +192,11 @@ void Lyrics::viewLyrics(int index) int pos = props_regexp.search(url); while (pos >= 0) { TQString property = props_regexp.cap(1); - url.replace(pos, props_regexp.matchedLength(), napp->player()->current().property(property)); + url.tqreplace(pos, props_regexp.matchedLength(), napp->player()->current().property(property)); pos = props_regexp.search(url); } TQString title(napp->player()->current().property("title")); - setCaption(i18n("Loading Lyrics for %1").arg(title)); + setCaption(i18n("Loading Lyrics for %1").tqarg(title)); // Check if we have a music playing if (napp->player()->current()) { htmlpart->begin(); @@ -207,32 +207,32 @@ void Lyrics::viewLyrics(int index) "<TR><TD BGCOLOR=\"#707671\"><strong>Title</strong></TD><TD>%1</TD></TR>" "<TR><TD BGCOLOR=\"#707671\"><strong>Author</strong></TD><TD>%2</TD></TR>" "<TR><TD BGCOLOR=\"#707671\"><strong>Album</strong></TD><TD>%3</TD></TR>" - "</TABLE>").arg( napp->player()->current().property( "title" ) ).arg( napp->player()->current().property( "author" ) ).arg( napp->player()->current().property( "album" ) ) ); + "</TABLE>").tqarg( napp->player()->current().property( "title" ) ).tqarg( napp->player()->current().property( "author" ) ).tqarg( napp->player()->current().property( "album" ) ) ); KURL _url; /* Check if we should use the store url or the query one */ if (napp->player()->current().property("Lyrics::URL").isEmpty()) { /* Use the query one */ _url = url; - _url.setQuery(_url.query().replace(TQRegExp("%20"), "+")); + _url.setQuery(_url.query().tqreplace(TQRegExp("%20"), "+")); kdDebug(90020) << "I'm using the query url" << endl; attach_act->setChecked(false); site_act->setEnabled(true); actionCollection()->action("search_label")->setEnabled(true); - htmlpart->write( i18n( "<hr><p><strong>Searching at %1</strong><br><small>(<a href=\"%3\">%2</a></small>)</p>" ).arg( name ).arg( _url.prettyURL() ).arg( _url.url() ) ); + htmlpart->write( i18n( "<hr><p><strong>Searching at %1</strong><br><small>(<a href=\"%3\">%2</a></small>)</p>" ).tqarg( name ).tqarg( _url.prettyURL() ).tqarg( _url.url() ) ); } else { _url = napp->player()->current().property("Lyrics::URL"); - _url.setQuery(_url.query().replace(TQRegExp("%20"), "+")); + _url.setQuery(_url.query().tqreplace(TQRegExp("%20"), "+")); kdDebug(90020) << "I'm using the stored url" << endl; attach_act->setChecked(true); site_act->setEnabled(false); actionCollection()->action("search_label")->setEnabled(false); - htmlpart->write( i18n( "<hr><p><strong>Using the stored URL</strong><br><small>(<a href=\"%2\">%1</a></small>)</p>" ).arg( _url.prettyURL() ).arg( _url.url() ) ); + htmlpart->write( i18n( "<hr><p><strong>Using the stored URL</strong><br><small>(<a href=\"%2\">%1</a></small>)</p>" ).tqarg( _url.prettyURL() ).tqarg( _url.url() ) ); } htmlpart->write( "</BODY></HTML>" ); htmlpart->end(); go(_url); this->show(); - KMessageBox::information( this, i18n( "In order to find the lyrics for the current song, this plugin uses the properties stored with each song, such as its title, author and album. These properties are usually retrieved by a tag reader, but in some cases they may not be present or be incorrect. In that case, the Lyrics plugin will not be able to find the lyrics until these properties are fixed (you can fix them using the tag editor).\nHint: The lucky tag plugin, present in the kdeaddons module, can try to guess properties such as title and author from the filename of a song. Enabling it may increase the probability of finding lyrics." ), TQString::null, "Lyrics::usage_info" ); + KMessageBox::information( this, i18n( "In order to find the lyrics for the current song, this plugin uses the properties stored with each song, such as its title, author and album. These properties are usually retrieved by a tag reader, but in some cases they may not be present or be incorrect. In that case, the Lyrics plugin will not be able to find the lyrics until these properties are fixed (you can fix them using the tag editor).\nHint: The lucky tag plugin, present in the kdeaddons module, can try to guess properties such as title and author from the filename of a song. Enabling it may increase the probability of finding lyrics." ), TQString(), "Lyrics::usage_info" ); active = true; } } diff --git a/noatun-plugins/lyrics/lyrics.h b/noatun-plugins/lyrics/lyrics.h index 362c7a4..1011f0a 100644 --- a/noatun-plugins/lyrics/lyrics.h +++ b/noatun-plugins/lyrics/lyrics.h @@ -14,6 +14,7 @@ class HistoryManager; class Lyrics : public KMainWindow, public Plugin { Q_OBJECT + TQ_OBJECT public: Lyrics(); |