PageRenderTime 137ms CodeModel.GetById 50ms app.highlight 43ms RepoModel.GetById 37ms app.codeStats 1ms

/src/LoadXSPFDialog.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 68 lines | 40 code | 11 blank | 17 comment | 1 complexity | 3a58d6aa1b3afefb6236fca91f033b25 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 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 "LoadXSPFDialog.h"
20#include "ui_LoadXSPFDialog.h"
21
22#include "TomahawkSettings.h"
23#include "Source.h"
24
25#include <QFileDialog>
26
27LoadXSPFDialog::LoadXSPFDialog( QWidget* parent, Qt::WindowFlags f )
28    : QDialog( parent, f )
29    , m_ui( new Ui_LoadXSPF )
30{
31    m_ui->setupUi( this );
32
33#ifdef Q_WS_MAC
34    m_ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 );
35    m_ui->horizontalLayout->setSpacing( 5 );
36    m_ui->verticalLayout->setContentsMargins( 0, 10, 0, 0 );
37    m_ui->verticalLayout->setSpacing( 0 );
38#endif
39
40    connect( m_ui->navigateButton, SIGNAL( clicked( bool ) ), this, SLOT( getLocalFile() ) );
41}
42
43LoadXSPFDialog::~LoadXSPFDialog()
44{
45}
46
47void
48LoadXSPFDialog::getLocalFile()
49{
50    const QString path = TomahawkSettings::instance()->importXspfPath();
51    QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), path, tr( "XSPF Files (*.xspf)" ) );
52    if ( !url.isEmpty() )
53        TomahawkSettings::instance()->setImportXspfPath( QFileInfo( url ).absoluteDir().absolutePath() );
54
55    m_ui->lineEdit->setText( url );
56}
57
58QString
59LoadXSPFDialog::xspfUrl() const
60{
61    return m_ui->lineEdit->text();
62}
63
64bool
65LoadXSPFDialog::autoUpdate() const
66{
67    return m_ui->autoUpdate->isChecked();
68}