PageRenderTime 142ms CodeModel.GetById 80ms app.highlight 7ms RepoModel.GetById 54ms app.codeStats 0ms

/src/libtomahawk/widgets/playlisttypeselectordlg.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 92 lines | 55 code | 19 blank | 18 comment | 0 complexity | adbaebdc5ef8666f830de60336d1b569 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2011, Christopher Reichert <creichert07@gmail.com>
 4 *
 5 *   Tomahawk is free software: you can redistribute it and/or modify
 6 *   it under the terms of the GNU General Public License as published by
 7 *   the Free Software Foundation, either version 3 of the License, or
 8 *   (at your option) any later version.
 9 *
10 *   Tomahawk is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "playlisttypeselectordlg.h"
20#include "ui_playlisttypeselectordlg.h"
21
22#include "widgets/newplaylistwidget.h"
23#include "viewmanager.h"
24#include "viewpage.h"
25#include "sourcelist.h"
26
27#include "utils/logger.h"
28
29
30PlaylistTypeSelectorDlg::PlaylistTypeSelectorDlg( QWidget* parent, Qt::WindowFlags f )
31    : QDialog( parent, f )
32    , ui( new Ui::PlaylistTypeSelectorDlg )
33{
34    ui->setupUi( this );
35
36#ifdef Q_WS_MAC
37//    ui->
38    ui->verticalLayout->setContentsMargins( 4, 0, 4, 4 );
39
40    setSizeGripEnabled( false );
41    resize( width(), 150 );
42    setMinimumSize( size() );
43    setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
44#else
45    ui->verticalLayout->setContentsMargins( 9, 0, 9, 9 );
46#endif
47
48    ui->line->setMaximumHeight( ui->label->height() );
49    ui->line->setContentsMargins( 0, 0, 0, 0 );
50    m_isAutoPlaylist = false;
51
52    connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
53             this, SLOT( createNormalPlaylist() ));
54    connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
55             this, SLOT( createAutomaticPlaylist() ));
56}
57
58
59PlaylistTypeSelectorDlg::~PlaylistTypeSelectorDlg()
60{
61    delete ui;
62}
63
64
65void
66PlaylistTypeSelectorDlg::createNormalPlaylist()
67{
68    m_isAutoPlaylist = false;
69    done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog
70}
71
72
73void
74PlaylistTypeSelectorDlg::createAutomaticPlaylist()
75{
76    m_isAutoPlaylist = true;
77    done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog successfully
78}
79
80
81QString
82PlaylistTypeSelectorDlg::playlistName() const
83{
84    return ui->playlistNameLine->text();
85}
86
87
88bool
89PlaylistTypeSelectorDlg::playlistTypeIsAuto() const
90{
91    return m_isAutoPlaylist;
92}