~ubuntu-branches/ubuntu/precise/guayadeque/precise

« back to all changes in this revision

Viewing changes to src/.svn/text-base/RadioGenreEditor.cpp.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-05-14 15:08:03 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110514150803-8b5evqetnaj35j34
Tags: 0.3.1~dfsg0-1
* New upstream release.
* Strip wxsqlite3 stuff out of upstream's tarballs.
* Update get-orig-source target in debian/rules.
* Update gbp config file.
* Bump Standards.
* Build-depend on libwxsqlite3-2.8-dev
* Enable parallel builds.
* Link binaries against the system-wide copy of wxsqlite3.
* Point sources to the correct wxcurl's headers location.
* Update copyright file as per DEP-5
* Improve debian/watch to handle the ~dfsg\d* suffix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -------------------------------------------------------------------------------- //
2
 
//      Copyright (C) 2008-2010 J.Rios
3
 
//      anonbeat@gmail.com
4
 
//
5
 
//    This Program 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 2, or (at your option)
8
 
//    any later version.
9
 
//
10
 
//    This Program 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 this program; see the file LICENSE.  If not, write to
17
 
//    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
//    http://www.gnu.org/copyleft/gpl.html
19
 
//
20
 
// -------------------------------------------------------------------------------- //
21
 
#include "RadioGenreEditor.h"
22
 
 
23
 
#include "Shoutcast.h"
24
 
 
25
 
// -------------------------------------------------------------------------------- //
26
 
guRadioGenreEditor::guRadioGenreEditor( wxWindow * parent, guDbRadios * db ) :
27
 
    wxDialog( parent, wxID_ANY, _("Radio Genre Editor"), wxDefaultPosition, wxSize( 280,360 ), wxDEFAULT_DIALOG_STYLE )
28
 
{
29
 
    m_Db = db;
30
 
 
31
 
        this->SetSizeHints( wxDefaultSize, wxDefaultSize );
32
 
 
33
 
        wxBoxSizer* MainSizer;
34
 
        MainSizer = new wxBoxSizer( wxVERTICAL );
35
 
 
36
 
        wxStaticBoxSizer* ListBoxSizer;
37
 
        ListBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _(" Genres ") ), wxVERTICAL );
38
 
 
39
 
    guShoutCast ShoutCast;
40
 
    m_RadioGenres = ShoutCast.GetGenres();
41
 
 
42
 
        m_CheckListBox = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_RadioGenres, wxLB_MULTIPLE|wxLB_NEEDED_SB|wxNO_BORDER );
43
 
        ListBoxSizer->Add( m_CheckListBox, 1, wxALL|wxEXPAND, 5 );
44
 
 
45
 
        wxBoxSizer* InputSizer;
46
 
        InputSizer = new wxBoxSizer( wxHORIZONTAL );
47
 
 
48
 
        m_InputStaticText = new wxStaticText( this, wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 );
49
 
        m_InputStaticText->Wrap( -1 );
50
 
        InputSizer->Add( m_InputStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
51
 
 
52
 
        m_InputTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
53
 
        InputSizer->Add( m_InputTextCtrl, 1, wxALL, 5 );
54
 
 
55
 
        ListBoxSizer->Add( InputSizer, 0, wxEXPAND, 5 );
56
 
 
57
 
        MainSizer->Add( ListBoxSizer, 1, wxEXPAND|wxALL, 5 );
58
 
 
59
 
    wxStdDialogButtonSizer* TagEditorBtnSizer;
60
 
    wxButton*               TagEditorBtnSizerOK;
61
 
    wxButton*               TagEditorBtnSizerCancel;
62
 
 
63
 
        TagEditorBtnSizer = new wxStdDialogButtonSizer();
64
 
        TagEditorBtnSizerOK = new wxButton( this, wxID_OK );
65
 
        TagEditorBtnSizer->AddButton( TagEditorBtnSizerOK );
66
 
        TagEditorBtnSizerCancel = new wxButton( this, wxID_CANCEL );
67
 
        TagEditorBtnSizer->AddButton( TagEditorBtnSizerCancel );
68
 
        TagEditorBtnSizer->Realize();
69
 
        MainSizer->Add( TagEditorBtnSizer, 0, wxRIGHT|wxBOTTOM|wxEXPAND, 5 );
70
 
 
71
 
        this->SetSizer( MainSizer );
72
 
        this->Layout();
73
 
 
74
 
    // By default enable already added items
75
 
    m_Db->GetRadioGenres( guRADIO_SOURCE_GENRE, &m_AddedGenres, false );
76
 
    int index;
77
 
    int count = m_AddedGenres.Count();
78
 
    int item;
79
 
    for( index = 0; index < count; index ++ )
80
 
    {
81
 
        item = m_RadioGenres.Index( m_AddedGenres[ index ].m_Name );
82
 
        if( item != wxNOT_FOUND )
83
 
            m_CheckListBox->Check( item );
84
 
    }
85
 
 
86
 
 
87
 
}
88
 
 
89
 
// -------------------------------------------------------------------------------- //
90
 
wxArrayString guRadioGenreEditor::GetGenres( void )
91
 
{
92
 
    wxArrayString RetVal;
93
 
    int index;
94
 
    int count = m_CheckListBox->GetCount();
95
 
    for( index = 0; index < count; index++ )
96
 
    {
97
 
        if( m_CheckListBox->IsChecked( index ) )
98
 
        {
99
 
            RetVal.Add( m_RadioGenres[ index ] );
100
 
        }
101
 
    }
102
 
    if( !m_InputTextCtrl->IsEmpty() )
103
 
    {
104
 
        RetVal.Add( m_InputTextCtrl->GetValue() );
105
 
    }
106
 
 
107
 
    // we add all and then remove the existans as guListBox dont have the Index function
108
 
    // so we check the other direction
109
 
    count = m_AddedGenres.Count();
110
 
    int item;
111
 
    for( index = 0; index < count; index++ )
112
 
    {
113
 
        item = RetVal.Index( m_AddedGenres[ index ].m_Name );
114
 
        if( item != wxNOT_FOUND )
115
 
        {
116
 
            RetVal.RemoveAt( item );
117
 
        }
118
 
    }
119
 
    return RetVal;
120
 
}
121
 
 
122
 
// -------------------------------------------------------------------------------- //
123
 
guRadioGenreEditor::~guRadioGenreEditor()
124
 
{
125
 
}
126
 
 
127
 
// -------------------------------------------------------------------------------- //
128