Permalink
Browse files

Added Participants View

  • Loading branch information...
1 parent 555573a commit f36d7830ad737c44ea3822c57183b6380bebf338 @klnusbaum committed Aug 27, 2012
View
@@ -48,6 +48,9 @@ void ActivityList::itemClicked(const QModelIndex& index){
else if(index == playlistItem->index()){
emit playlistClicked();
}
+ else if(index == participantsItem->index()){
+ emit participantsClicked();
+ }
}
void ActivityList::setupUi(){
@@ -58,10 +61,14 @@ void ActivityList::setupUi(){
playlistItem = new QStandardItem(getPlaylistTitle());
playlistItem->setEditable(false);
+ participantsItem = new QStandardItem(getParticipantsTitle());
+ participantsItem->setEditable(false);
+
model = new QStandardItemModel(this);
model->appendRow(libraryItem);
model->appendRow(playlistItem);
+ model->appendRow(participantsItem);
setModel(model);
View
@@ -65,15 +65,21 @@ public slots:
/** @name Signals */
//@{
- /**
+ /**
* \brief Emitted when the library activity is clicked.
*/
void libraryClicked();
/**
- * \brief emited when the playlist activity is clicked.
+ * \brief Emitted when the playlist activity is clicked.
*/
void playlistClicked();
+
+ /**
+ * \brief Emitted when the participants item is clicked.
+ */
+ void participantsClicked();
+
//@}
private:
@@ -106,10 +112,20 @@ public slots:
return playlistTitle;
}
+ /**
+ * \brief Gets the name of the Participants activity.
+ *
+ * @return The name of the Participants activity.
+ */
+ static const QString& getParticipantsTitle(){
+ static const QString participantsTitle(tr("Participants"));
+ return participantsTitle;
+ }
+
//@}
- /** @name Private Memeber */
+ /** @name Private Members */
//@{
/** \brief Pointer to the DataStore backing this instance of UDJ */
@@ -124,6 +140,9 @@ public slots:
/** \brief The item representing the playlist activity. */
QStandardItem *playlistItem;
+ /** \brief The item representing the participants activity. */
+ QStandardItem *participantsItem;
+
//@}
private slots:
View
@@ -53,6 +53,8 @@ SET(SOURCES
SetLocationDialog.cpp
DialogWithLoaderWidget.cpp
PlaybackErrorMessage.cpp
+ ParticipantsView.cpp
+ ParticipantsModel.cpp
)
#IF(APPLE)
View
@@ -28,6 +28,7 @@
#include "AboutWidget.hpp"
#include "LogViewer.hpp"
#include "SetLocationDialog.hpp"
+#include "ParticipantsView.hpp"
#include <QCloseEvent>
#include <QHBoxLayout>
#include <QVBoxLayout>
@@ -273,10 +274,14 @@ void MetaWindow::setupUi(){
playlistView = new ActivePlaylistView(dataStore, this);
playlistView->installEventFilter(this);
+ participantsView = new ParticipantsView(dataStore, this);
+ participantsView->installEventFilter(this);
+
QWidget* contentStackContainer = new QWidget(this);
contentStack = new QStackedWidget(this);
contentStack->addWidget(libraryWidget);
contentStack->addWidget(playlistView);
+ contentStack->addWidget(participantsView);
contentStack->setCurrentWidget(libraryWidget);
QVBoxLayout *contentStackLayout = new QVBoxLayout;
contentStackLayout->addWidget(contentStack, Qt::AlignCenter);
@@ -314,6 +319,12 @@ void MetaWindow::setupUi(){
SLOT(displayPlaylist()));
connect(
+ activityList,
+ SIGNAL(participantsClicked()),
+ this,
+ SLOT(displayParticipants()));
+
+ connect(
libraryWidget,
SIGNAL(libNeedsSync()),
this,
@@ -424,6 +435,10 @@ void MetaWindow::displayPlaylist(){
contentStack->setCurrentWidget(playlistView);
}
+void MetaWindow::displayParticipants(){
+ contentStack->setCurrentWidget(participantsView);
+}
+
void MetaWindow::syncLibrary(){
syncingProgress = new QProgressDialog(
"Syncing Library...", "Cancel", 0, dataStore->getTotalUnsynced(), this);
View
@@ -46,6 +46,7 @@ class ActivityList;
class EventWidget;
class DataStore;
class PlayerDashboard;
+class ParticipantsView;
/**
* \brief A class that is the main point of interaction with the user.
@@ -135,6 +136,11 @@ private slots:
void displayPlaylist();
/**
+ * \brief Displays the participants view in the main content panel.
+ */
+ void displayParticipants();
+
+ /**
* \brief Updates the syncprogress given the songs that have been updated.
*
* \param songs Songs that were updated.
@@ -273,6 +279,9 @@ private slots:
/** \brief Dashboard used to display information about the player. */
PlayerDashboard *dashboard;
+ /** \brief ParticipantsView used to display player participants. */
+ ParticipantsView *participantsView;
+
/** \brief A flag indicating whether or not the client is in the process of quitting. */
bool isQuiting;
View
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2011 Kurtis L. Nusbaum
+ *
+ * This file is part of UDJ.
+ *
+ * UDJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UDJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UDJ. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "ParticipantsModel.hpp"
+
+
+namespace UDJ{
+
+ParticipantsModel::ParticipantsModel(QObject *parent)
+ :QStandardItemModel(parent)
+{
+ QStringList headers;
+ headers << tr("Id") << tr("Username") << tr("First Name") << tr("Last Name");
+ setHorizontalHeaderLabels(headers);
+}
+
+
+} // end namespace
View
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2011 Kurtis L. Nusbaum
+ *
+ * This file is part of UDJ.
+ *
+ * UDJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UDJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UDJ. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef PARTICIPANTS_MODEL_HPP
+#define PARTICIPANTS_MODEL_HPP
+#include <QStandardItemModel>
+
+class QStandardItem;
+
+namespace UDJ{
+
+
+class ParticipantsModel : public QStandardItemModel{
+
+public:
+
+ ParticipantsModel(QObject *parent=0);
+
+};
+
+
+} //end namespace UDJ
+
+#endif //PARTICIPANTS_MODEL_HPP
View
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2011 Kurtis L. Nusbaum
+ *
+ * This file is part of UDJ.
+ *
+ * UDJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UDJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UDJ. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ParticipantsView.hpp"
+#include "ParticipantsModel.hpp"
+#include <QStandardItemModel>
+#include <QHeaderView>
+
+
+namespace UDJ{
+
+
+ParticipantsView::ParticipantsView(DataStore* dataStore, QWidget* parent):
+ QTableView(parent),
+ dataStore(dataStore)
+{
+ setFocusPolicy(Qt::TabFocus);
+ setEditTriggers(QAbstractItemView::NoEditTriggers);
+ horizontalHeader()->setStretchLastSection(true);
+ participantsModel = new ParticipantsModel(this);
+ setModel(participantsModel);
+ setSelectionBehavior(QAbstractItemView::SelectRows);
+ setSelectionMode(QAbstractItemView::ContiguousSelection);
+ configureHeaders();
+}
+
+void ParticipantsView::configureHeaders(){
+ setColumnHidden(0, true);
+}
+
+
+} //end namesapce UDJ
View
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2011 Kurtis L. Nusbaum
+ *
+ * This file is part of UDJ.
+ *
+ * UDJ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UDJ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UDJ. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef PARTICIPANTS_VIEW_HPP
+#define PARTICIPANTS_VIEW_HPP
+#include "ConfigDefs.hpp"
+#include "DataStore.hpp"
+#include <QTableView>
+
+
+
+namespace UDJ{
+
+class ParticipantsModel;
+
+class ParticipantsView : public QTableView{
+Q_OBJECT
+public:
+
+ /** @name Constructors */
+ //@{
+
+ ParticipantsView(DataStore* dataStore, QWidget* parent=0);
+
+ //@}
+
+private:
+
+
+ /** @name Private Members */
+ //@{
+
+ /**
+ * \brief The data store containing music that could potentially be added
+ * to the playlist.
+ */
+ DataStore* dataStore;
+
+ ParticipantsModel *participantsModel;
+
+ //@}
+
+ /** @name Private Functions */
+ //@{
+
+ /**
+ * \brief Configures how the headers in the view should look.
+ */
+ void configureHeaders();
+
+ //@}
+
+};
+
+
+} //end namespace
+#endif //PARTICIPANTS_VIEW_HPP

0 comments on commit f36d783

Please sign in to comment.