/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. #include "playlisttypeselectordlg.h"
  19. #include "ui_playlisttypeselectordlg.h"
  20. #include "widgets/newplaylistwidget.h"
  21. #include "viewmanager.h"
  22. #include "viewpage.h"
  23. #include "sourcelist.h"
  24. #include "utils/logger.h"
  25. PlaylistTypeSelectorDlg::PlaylistTypeSelectorDlg( QWidget* parent, Qt::WindowFlags f )
  26. : QDialog( parent, f )
  27. , ui( new Ui::PlaylistTypeSelectorDlg )
  28. {
  29. ui->setupUi( this );
  30. #ifdef Q_WS_MAC
  31. // ui->
  32. ui->verticalLayout->setContentsMargins( 4, 0, 4, 4 );
  33. setSizeGripEnabled( false );
  34. resize( width(), 150 );
  35. setMinimumSize( size() );
  36. setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
  37. #else
  38. ui->verticalLayout->setContentsMargins( 9, 0, 9, 9 );
  39. #endif
  40. ui->line->setMaximumHeight( ui->label->height() );
  41. ui->line->setContentsMargins( 0, 0, 0, 0 );
  42. m_isAutoPlaylist = false;
  43. connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
  44. this, SLOT( createNormalPlaylist() ));
  45. connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
  46. this, SLOT( createAutomaticPlaylist() ));
  47. }
  48. PlaylistTypeSelectorDlg::~PlaylistTypeSelectorDlg()
  49. {
  50. delete ui;
  51. }
  52. void
  53. PlaylistTypeSelectorDlg::createNormalPlaylist()
  54. {
  55. m_isAutoPlaylist = false;
  56. done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog
  57. }
  58. void
  59. PlaylistTypeSelectorDlg::createAutomaticPlaylist()
  60. {
  61. m_isAutoPlaylist = true;
  62. done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog successfully
  63. }
  64. QString
  65. PlaylistTypeSelectorDlg::playlistName() const
  66. {
  67. return ui->playlistNameLine->text();
  68. }
  69. bool
  70. PlaylistTypeSelectorDlg::playlistTypeIsAuto() const
  71. {
  72. return m_isAutoPlaylist;
  73. }