streamdirectorydockwidget.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2008-2010  Lukas Sommer < SommerLuk at gmail dot com >
00003 
00004     This program is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU General Public License as
00006     published by the Free Software Foundation; either version 2 of
00007     the License or (at your option) version 3 or any later version
00008     accepted by the membership of KDE e.V. (or its successor approved
00009     by the membership of KDE e.V.), which shall act as a proxy
00010     defined in Section 14 of version 3 of the license.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 #include "streamdirectorydockwidget.h"
00021 
00022 #include <KLocale>
00023 #include "icecast.h"
00024 #include "streamdirectoryproxymodel.h"
00025 
00026 streamdirectoryDockwidget::streamdirectoryDockwidget(QWidget *parent) : QDockWidget(parent)
00027 {
00028   setupUi(this);
00029   setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
00030   icecast *m_icecast_model = new icecast(m_directoryView);
00031   streamDirectoryProxyModel *m_proxy_model = new streamDirectoryProxyModel(m_icecast_model);
00032   m_proxy_model->setSourceModel(m_icecast_model);
00033   m_directoryView->setModel(m_proxy_model);
00034   m_directoryView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
00035   m_directoryView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
00036   m_directoryView->setAnimated(true);
00037   m_directoryView->setAlternatingRowColors(true);
00038   m_directoryView->setSortingEnabled(true);
00039   m_directoryView->setUniformRowHeights(true); // makes the widget more performant
00040   m_directoryView->setSelectionMode(QAbstractItemView::ExtendedSelection);
00041   m_directoryView->setDragEnabled(true);
00042   kcombobox->insertItem(
00043     0,
00044     i18nc("@item:inlistbox The URL of Icecast. Normally, needs no translation. Just copy the URL.",
00045           "icecast.org"));
00046 }
00047 
00048 streamdirectoryDockwidget::~streamdirectoryDockwidget()
00049 {
00050 }
00051 
00052 void streamdirectoryDockwidget::closeEvent(QCloseEvent *event)
00053 {
00054   emit willAcceptCloseEventFromWindowSystem();
00055   event->accept();
00056 }

doxygen