628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
1 |
/***************************************************************************
|
2 |
begin : Sat Sep 6 2003
|
|
1003
by Scott Wheeler
It's 2004 now. Update copyrights. |
3 |
copyright : (C) 2003 - 2004 by Scott Wheeler
|
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
4 |
email : wheeler@kde.org
|
5 |
***************************************************************************/
|
|
6 |
||
7 |
/***************************************************************************
|
|
8 |
* *
|
|
9 |
* This program is free software; you can redistribute it and/or modify *
|
|
10 |
* it under the terms of the GNU General Public License as published by *
|
|
11 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
12 |
* (at your option) any later version. *
|
|
13 |
* *
|
|
14 |
***************************************************************************/
|
|
15 |
||
1685
by Laurent Montel
Now we can search tunepimp lib |
16 |
#include <config-juk.h> |
1575
by Richard Lärkäng
Rename from musicbrainz to tunepimp in configure.in.in, defines etc |
17 |
#if HAVE_TUNEPIMP
|
629
by Frerich Raabe
- Don't do anything if we don't HAVE_MUSICBRAINZ |
18 |
|
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
19 |
|
1579
by Laurent Montel
adapt to new kdelis api |
20 |
#include <k3listview.h> |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
21 |
#include <klocale.h> |
22 |
||
23 |
#include "trackpickerdialog.h" |
|
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
24 |
|
1823
by Arto Hytönen
the last of QString::null Krazy flagger commits, to kdemultimedia. |
25 |
#define NUMBER(x) (x == 0 ? QString::null : QString::number(x)) //krazy:exclude=nullstrassign for old broken gcc |
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
26 |
|
1579
by Laurent Montel
adapt to new kdelis api |
27 |
class TrackPickerItem : public K3ListViewItem |
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
28 |
{
|
29 |
public: |
|
1579
by Laurent Montel
adapt to new kdelis api |
30 |
TrackPickerItem(K3ListView *parent, const KTRMResult &result) : |
31 |
K3ListViewItem(parent, parent->lastChild(), |
|
1149
by Scott Wheeler
Add API docs and a d-pointer. |
32 |
result.title(), result.artist(), result.album(), |
33 |
NUMBER(result.track()), NUMBER(result.year())), |
|
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
34 |
m_result(result) {} |
35 |
KTRMResult result() const { return m_result; } |
|
36 |
||
37 |
private: |
|
38 |
KTRMResult m_result; |
|
39 |
};
|
|
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
40 |
|
41 |
////////////////////////////////////////////////////////////////////////////////
|
|
42 |
// public methods
|
|
43 |
////////////////////////////////////////////////////////////////////////////////
|
|
44 |
||
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
45 |
TrackPickerDialog::TrackPickerDialog(const QString &name, |
46 |
const KTRMResultList &results, |
|
47 |
QWidget *parent) : |
|
1626
by Richard Lärkäng
KDialogBase -> KDialog |
48 |
KDialog(parent) |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
49 |
{
|
1673
by Dirk Mueller
qt3support-- |
50 |
setObjectName(name.toAscii()); |
1626
by Richard Lärkäng
KDialogBase -> KDialog |
51 |
setModal(true); |
52 |
setCaption(i18n("Internet Tag Guesser")); |
|
53 |
setButtons(Ok | Cancel); |
|
1635
by Laurent Montel
Port++ |
54 |
showButtonSeparator(true); |
1626
by Richard Lärkäng
KDialogBase -> KDialog |
55 |
|
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
56 |
m_base = new TrackPickerDialogBase(this); |
57 |
setMainWidget(m_base); |
|
58 |
||
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
59 |
m_base->fileLabel->setText(name); |
60 |
m_base->trackList->setSorting(-1); |
|
61 |
||
62 |
for(KTRMResultList::ConstIterator it = results.begin(); it != results.end(); ++it) |
|
1385
by Stephan Kulow
fix make final |
63 |
new TrackPickerItem(m_base->trackList, *it); |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
64 |
|
65 |
m_base->trackList->setSelected(m_base->trackList->firstChild(), true); |
|
1470
by Scott Wheeler
Make double clicking on the MusicBrainz track selection dialog "accept" the |
66 |
|
2248
by Laurent Montel
normalize signals/slots |
67 |
connect(m_base->trackList, SIGNAL(doubleClicked(Q3ListViewItem*,QPoint,int)), |
1470
by Scott Wheeler
Make double clicking on the MusicBrainz track selection dialog "accept" the |
68 |
this, SLOT(accept())); |
69 |
||
1537
by Laurent Montel
Adapt to new kdelibs api |
70 |
setMinimumWidth(qMax(400, width())); |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
71 |
}
|
72 |
||
73 |
TrackPickerDialog::~TrackPickerDialog() |
|
74 |
{
|
|
75 |
||
76 |
}
|
|
77 |
||
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
78 |
KTRMResult TrackPickerDialog::result() const |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
79 |
{
|
80 |
if(m_base->trackList->selectedItem()) |
|
1385
by Stephan Kulow
fix make final |
81 |
return static_cast<TrackPickerItem *>(m_base->trackList->selectedItem())->result(); |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
82 |
else
|
1142
by Scott Wheeler
Don't use the external TRM tool but instead use libtunepimp since it handles |
83 |
return KTRMResult(); |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
84 |
}
|
85 |
||
86 |
////////////////////////////////////////////////////////////////////////////////
|
|
87 |
// public slots
|
|
88 |
////////////////////////////////////////////////////////////////////////////////
|
|
89 |
||
90 |
int TrackPickerDialog::exec() |
|
91 |
{
|
|
1626
by Richard Lärkäng
KDialogBase -> KDialog |
92 |
int dialogCode = KDialog::exec(); |
628
by Scott Wheeler
Do this the right way now. Replaced the QDialog with a KDialogBase subclass |
93 |
|
94 |
// Only return true if an item was selected.
|
|
95 |
||
96 |
if(m_base->trackList->selectedItem()) |
|
97 |
return dialogCode; |
|
98 |
else
|
|
99 |
return Rejected; |
|
100 |
}
|
|
101 |
||
102 |
#include "trackpickerdialog.moc" |
|
629
by Frerich Raabe
- Don't do anything if we don't HAVE_MUSICBRAINZ |
103 |
|
1575
by Richard Lärkäng
Rename from musicbrainz to tunepimp in configure.in.in, defines etc |
104 |
#endif // HAVE_TUNEPIMP |
1562
by Michael Pyne
Since we're standardizing the source style, figured I'd throw in the Big Huge Vim Modeline |
105 |
|
106 |
// vim: set et sw=4 tw=0 sta:
|