void AbstractController::removeCategory(QString name) { QList<MediaSPointer> zeus = m_categories[name]->associations().values(); m_categories.take(name); foreach(auto hera, zeus) removeMedia(name, hera->name()); }
ScreenTab::ScreenTab(QWidget *parent) : QWidget(parent), ui(new Ui::ScreenTab), _currentMedia(NULL), _screen(NULL), _desktopMediaPlayer(new DesktopMediaPlayer(this)) { ui->setupUi(this); setScreen(new Screen(this)); // ui->currentDisplaySpinBox->setMaximum(QApplication::desktop()->screenCount() - 1); ui->splitter->setStretchFactor(0, 1); ui->splitter->setSizes(QList<int>() << 10000 << 1); setContextMenuPolicy(Qt::PreventContextMenu); addAction(ui->actionStartStopPlaying); ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::FilePatch, QHeaderView::Stretch); ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::NumberToShow, QHeaderView::ResizeToContents); ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::RandomWeigth, QHeaderView::ResizeToContents); ui->mediaListTableView->addAction(ui->actionAddMedia); ui->mediaListTableView->addAction(ui->actionAddExtension); ui->mediaListTableView->addAction(ui->actionRemoveRow); ui->mediaListTableView->addAction(ui->actionMoveMediaUp); ui->mediaListTableView->addAction(ui->actionMoveMediaDown); ui->mediaListTableView->setContextMenuPolicy(Qt::ActionsContextMenu); connect(ui->actionAddMedia, SIGNAL(triggered()), this, SLOT(addMedia())); connect(ui->actionAddExtension, SIGNAL(triggered()), this, SLOT(addExtension())); connect(ui->actionRemoveRow, SIGNAL(triggered()), this, SLOT(removeMedia())); connect(ui->actionMoveMediaUp, SIGNAL(triggered()), this, SLOT(moveMediaUp())); connect(ui->actionMoveMediaDown, SIGNAL(triggered()), this, SLOT(moveMediaDown())); connect(ui->actionStartStopPlaying, SIGNAL(triggered()), this, SLOT(startStopPlaying())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save())); connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load())); // connect(ui->currentDisplaySpinBox, SIGNAL(valueChanged(int)), this, SLOT(onCurrentDisplaySpinBoxChanged(int))); connect(_desktopMediaPlayer, SIGNAL(graphicSceneChanged(QGraphicsScene*)), this, SLOT(setSceneToPreview(QGraphicsScene*))); connect(_desktopMediaPlayer, SIGNAL(escKeyPressed()), this, SLOT(stopPlaying())); mediaListSelectedChanded(QItemSelection(), QItemSelection()); //Законектим изменение данных в энжайне расширений со слотом обновления расширений connect(MDVPlayerApplication::instance(), SIGNAL(extensionEngineDataChanged()), this, SLOT(updateExtensions())); onCurrentDisplaySpinBoxChanged(1); // onCurrentDisplaySpinBoxChanged(ui->currentDisplaySpinBox->value()); }
void Settings::accept() { QMap<QString, QString> hermes; hermes["language"] = language(); hermes["seeMedia"] = seeMedia(); hermes["addMedia"] = addMedia(); hermes["removeMedia"] = removeMedia(); hermes["seeCategory"] = seeCategory(); hermes["addCategory"] = addCategory(); hermes["removeCategory"] = removeCategory(); hermes["newData"] = newData(); hermes["loadData"] = loadData(); hermes["saveData"] = saveData(); hermes["saveAsData"] = saveAsData(); hermes["quit"] = quit(); hermes["search"] = search(); hermes["users"] = users(); hermes["settings"] = settings(); emit s_setting(hermes); close(); }
MainController::MainController(): m_mw(new MainWindow), m_search(m_mw) { connect(m_mw, SIGNAL(s_save(QString)), this, SLOT(save(QString))); connect(m_mw, SIGNAL(s_load(QString)), this, SLOT(load(QString))); connect(m_mw, SIGNAL(s_newBase()), this, SLOT(newBase())); connect(m_mw, SIGNAL(s_addCategory(QString)), this, SLOT(newCategory(QString))); connect(m_mw, SIGNAL(s_removeCategory(QString)), this, SLOT(removeCategory(QString))); connect(m_mw, SIGNAL(s_seeCategory()), this, SLOT(editCategory())); connect(m_mw, SIGNAL(s_showCategory()), this, SLOT(showCategory())); connect(m_mw, SIGNAL(s_addMedia(QString)), this, SLOT(newMedia(QString))); connect(m_mw, SIGNAL(s_removeMedia(QString,QString)), this, SLOT(removeMedia(QString,QString))); connect(m_mw, SIGNAL(s_seeMedia()), this, SLOT(editMedia())); connect(m_mw, SIGNAL(s_showUser()), this, SLOT(setUser())); connect(m_mw, SIGNAL(s_search()), this, SLOT(search())); connect(&m_search, SIGNAL(s_find(QList<MediaSPointer>)), this, SLOT(showSearch(QList<MediaSPointer>))); connect(m_mw, SIGNAL(s_settings()), this, SLOT(settings())); m_mw->setShortcut(SettingsController::settings()); SettingsController artemis; artemis.newSettings(SettingsController::settings()); if(UserController::userCount() == 0) UserController().exec(); else UserController::connectUser(); }
void MediaController::change(QTreeWidgetItem* root, QString old) { removeMedia(m_media->category()->name(), old); *m_media = *generate(root); addMedia(m_media); }