~ubuntu-branches/ubuntu/karmic/kid3/karmic

« back to all changes in this revision

Viewing changes to kid3/importdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sarah Hobbs
  • Date: 2006-07-14 12:25:16 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060714122516-p2wk0iyzumu6jx42
Tags: 0.7-1ubuntu1
Merge from debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 *                      is passed with durations of files set
36
36
 */
37
37
ImportDialog::ImportDialog(QWidget *parent, QString &caption,
38
 
                                                                                                         ImportTrackDataVector& trackDataList)
39
 
#ifdef CONFIG_USE_KDE
40
 
        : KDialogBase(parent, "import", true, caption, Ok|Cancel, Ok),
41
 
#else
42
 
        : QDialog(parent, "import", true),
43
 
#endif
44
 
                m_trackDataVector(trackDataList)
 
38
                                                                                                         ImportTrackDataVector& trackDataList) :
 
39
        QDialog(parent, "import", true),
 
40
        m_autoStartSubDialog(ASD_None),
 
41
        m_trackDataVector(trackDataList)
45
42
{
46
 
 
47
 
#ifdef CONFIG_USE_KDE
48
 
        QWidget *page = new QWidget(this);
49
 
        if (!page) {
50
 
                return;
51
 
        }
52
 
        setMainWidget(page);
53
 
#else
54
 
#define page this
55
43
        setCaption(caption);
56
 
#endif
57
44
 
58
 
        QVBoxLayout *vlayout = new QVBoxLayout(page);
 
45
        QVBoxLayout *vlayout = new QVBoxLayout(this);
59
46
        if (!vlayout) {
60
47
                return ;
61
48
        }
62
49
        vlayout->setSpacing(6);
63
50
        vlayout->setMargin(6);
64
 
        impsel = new ImportSelector(page, m_trackDataVector);
 
51
        impsel = new ImportSelector(this, m_trackDataVector);
65
52
        vlayout->addWidget(impsel);
66
53
 
67
 
#ifndef CONFIG_USE_KDE
68
54
        QHBoxLayout *hlayout = new QHBoxLayout(vlayout);
69
55
        QSpacerItem *hspacer = new QSpacerItem(16, 0, QSizePolicy::Expanding,
70
56
                                               QSizePolicy::Minimum);
71
 
        QPushButton *okButton = new QPushButton(i18n("&OK"), page);
72
 
        QPushButton *cancelButton = new QPushButton(i18n("&Cancel"), page);
 
57
        QPushButton *okButton = new QPushButton(i18n("&OK"), this);
 
58
        QPushButton *cancelButton = new QPushButton(i18n("&Cancel"), this);
73
59
        if (hlayout && okButton && cancelButton) {
74
60
                hlayout->addItem(hspacer);
75
61
                hlayout->addWidget(okButton);
78
64
                connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
79
65
                connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
80
66
        }
81
 
#undef page
82
 
#endif
83
67
}
84
68
 
85
69
/**
89
73
{}
90
74
 
91
75
/**
 
76
 * Shows the dialog as a modal dialog.
 
77
 */
 
78
int ImportDialog::exec()
 
79
{
 
80
        switch (m_autoStartSubDialog) {
 
81
                case ASD_Freedb:
 
82
                        show();
 
83
                        impsel->fromFreedb();
 
84
                        break;
 
85
                case ASD_MusicBrainz:
 
86
                        show();
 
87
                        impsel->fromMusicBrainz();
 
88
                        break;
 
89
                case ASD_None:
 
90
                        break;
 
91
        }
 
92
        return QDialog::exec();
 
93
}
 
94
 
 
95
/**
 
96
 * Clear dialog data.
 
97
 */
 
98
void ImportDialog::clear()
 
99
{
 
100
        impsel->clear();
 
101
}
 
102
 
 
103
/**
92
104
 * Set ID3v1 or ID3v2 tags as import destination.
93
105
 *
94
106
 * @param v1 true to set ID3v1, false for ID3v2