QueueManager::QueueManager( QWidget *parent, const char *name ) : KDialogBase( KDialogBase::Swallow, 0, parent, name, false, 0, Ok|Cancel ) { s_instance = this; // Gives the window a small title bar, and skips a taskbar entry KWin::setType( winId(), NET::Utility ); KWin::setState( winId(), NET::SkipTaskbar ); kapp->setTopWidget( this ); setCaption( kapp->makeStdCaption( i18n("Queue Manager") ) ); setInitialSize( QSize( 400, 260 ) ); QVBox *mainBox = new QVBox( this ); setMainWidget( mainBox ); QHBox *box = new QHBox( mainWidget() ); box->setSpacing( 5 ); m_listview = new QueueList( box ); QVBox *buttonBox = new QVBox( box ); m_up = new KPushButton( KGuiItem( QString::null, "up" ), buttonBox ); m_down = new KPushButton( KGuiItem( QString::null, "down" ), buttonBox ); m_remove = new KPushButton( KGuiItem( QString::null, "edit_remove" ), buttonBox ); m_add = new KPushButton( KGuiItem( QString::null, "edit_add" ), buttonBox ); m_clear = new KPushButton( KGuiItem( QString::null, amaroK::icon( "playlist_clear" ) ), buttonBox ); QToolTip::add( m_up, i18n( "Move up" ) ); QToolTip::add( m_down, i18n( "Move down" ) ); QToolTip::add( m_remove, i18n( "Remove" ) ); QToolTip::add( m_add, i18n( "Enqueue track" ) ); QToolTip::add( m_clear, i18n( "Clear queue" ) ); m_up->setEnabled( false ); m_down->setEnabled( false ); m_remove->setEnabled( false ); m_add->setEnabled( false ); m_clear->setEnabled( false ); connect( m_up, SIGNAL( clicked() ), m_listview, SLOT( moveSelectedUp() ) ); connect( m_down, SIGNAL( clicked() ), m_listview, SLOT( moveSelectedDown() ) ); connect( m_remove, SIGNAL( clicked() ), this, SLOT( removeSelected() ) ); connect( m_add, SIGNAL( clicked() ), this, SLOT( addItems() ) ); connect( m_clear, SIGNAL( clicked() ), m_listview, SLOT( clear() ) ); Playlist *pl = Playlist::instance(); connect( pl, SIGNAL( selectionChanged() ), SLOT( updateButtons() ) ); connect( m_listview, SIGNAL( selectionChanged() ), SLOT( updateButtons() ) ); connect( pl, SIGNAL( queueChanged(const PLItemList &, const PLItemList &) ), SLOT( addQueuedItems(const PLItemList &, const PLItemList &) ) ); insertItems(); }
SendMsgListWidget::SendMsgListWidget(QWidget* parentObj) : Base("Messages to Send", new SendAreaToolBar(), parentObj), m_state(GuiAppMgr::instanceRef().sendState()) { selectOnAdd(true); auto* guiMgr = GuiAppMgr::instance(); assert(guiMgr != nullptr); connect( guiMgr, SIGNAL(sigAddSendMsg(MessagePtr)), this, SLOT(addMessage(MessagePtr))); connect( guiMgr, SIGNAL(sigSendMsgUpdated(MessagePtr)), this, SLOT(updateCurrentMessage(MessagePtr))); connect( guiMgr, SIGNAL(sigSendDeleteSelectedMsg()), this, SLOT(deleteCurrentMessage())); connect( guiMgr, SIGNAL(sigSendMsgListClearSelection()), this, SLOT(clearSelection())); connect( guiMgr, SIGNAL(sigSendClear()), this, SLOT(clearList())); connect( guiMgr, SIGNAL(sigSetSendState(int)), this, SLOT(stateChanged(int))); connect( guiMgr, SIGNAL(sigSendMoveSelectedTop()), this, SLOT(moveSelectedTop())); connect( guiMgr, SIGNAL(sigSendMoveSelectedUp()), this, SLOT(moveSelectedUp())); connect( guiMgr, SIGNAL(sigSendMoveSelectedDown()), this, SLOT(moveSelectedDown())); connect( guiMgr, SIGNAL(sigSendMoveSelectedBottom()), this, SLOT(moveSelectedBottom())); connect( guiMgr, SIGNAL(sigSendLoadMsgs(bool, const QString&, ProtocolPtr)), this, SLOT(loadMessages(bool, const QString&, ProtocolPtr))); connect( guiMgr, SIGNAL(sigSendSaveMsgs(const QString&)), this, SLOT(saveMessages(const QString&))); connect( guiMgr, SIGNAL(sigSendMsgSelected(int)), this, SLOT(selectMsg(int))); }
void QueueList::keyPressEvent( QKeyEvent *e ) { switch( e->key() ) { case Key_Delete: //remove removeSelected(); break; case CTRL+Key_Up: moveSelectedUp(); break; case CTRL+Key_Down: moveSelectedDown(); break; } }
ImportList::ImportList(QWidget *parent) : QDialog(parent), ui(new Ui::ImportList), selectedFile(NULL) { ui->setupUi(this); //Set up preview table ui->twPreview->setHidden(true); ui->pbRefresh->setHidden(true); connect(ui->gbPreview, SIGNAL(clicked()), this, SLOT(togglePreview())); connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(ui->pbImport, SIGNAL(clicked()), this, SLOT(import())); //Browse File and Preview Related connect(ui->pbBrowse, SIGNAL(clicked()), this, SLOT(browseListFile())); connect(ui->leFilePath, SIGNAL(editingFinished()), this, SLOT(reloadSelectedFile())); connect(ui->leFilePath, SIGNAL(returnPressed()), this, SLOT(reloadSelectedFile())); connect(ui->pbRefresh, SIGNAL(clicked()), this, SLOT(reloadSelectedFile())); //Column Management Related connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(addSelectedColumns())); connect(ui->pbRemove, SIGNAL(clicked()), this, SLOT(removeSelectedColumns())); connect(ui->pbMoveUp, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); connect(ui->pbMoveDown, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); QListWidgetItem *item = new QListWidgetItem("Name", ui->lwAvailableColumns); item->setToolTip("Movie Title; Can contain any character"); item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Name))); ui->lwAvailableColumns->addItem(item); item = new QListWidgetItem("Year", ui->lwAvailableColumns); item->setToolTip("Year when the movie came out; format: YYYY"); item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("([0-9]*)"), UserRoleData::Year))); ui->lwAvailableColumns->addItem(item); item = new QListWidgetItem("Quality", ui->lwAvailableColumns); item->setToolTip("Should be one of the following string: \"Xvid\", \"BDRIP\", \"720p\", or \"1080p\""); item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::Quality))); ui->lwAvailableColumns->addItem(item); item = new QListWidgetItem("IMDB Link", ui->lwAvailableColumns); item->setToolTip("Valid link to IMDB Page."); item->setData(Qt::UserRole, QVariant::fromValue(UserRoleData(QString("\"(.*)\""), UserRoleData::IMDB))); ui->lwAvailableColumns->addItem(item); QStringList selectedColumns; m_settings.beginGroup(IMPORT_GROUP); int size = m_settings.beginReadArray(SELECTED_COLUMNS_ARRAY); for(int i = 0; i < size; i++) { m_settings.setArrayIndex(i); selectedColumns.push_front(m_settings.value(SELECTED_COLUMNS_COLUMN_KEY).toString()); } m_settings.endArray(); ui->leFilePath->setText(m_settings.value(LAST_SELECTED_FILE_KEY).toString()); reloadSelectedFile(); m_settings.endGroup(); QStringList::iterator itr = selectedColumns.begin(); for(; itr != selectedColumns.end(); ++itr) { for(int i = 0; i < ui->lwAvailableColumns->count(); i++) { if(ui->lwAvailableColumns->item(i)->text() == *itr) { ui->lwColumnOrder->insertItem(0, ui->lwAvailableColumns->takeItem(i)); break; } } } }