Beispiel #1
0
MqsConfig::MqsConfig(QWidget *parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
{
	ui.setupUi(this);

	updateEncoders();
	updateChannels();
	updateResolutions();
    vector<string> suported_channels = ChannelManager::getSuportedPlugins();
	for(unsigned int i = 0; i < suported_channels.size(); ++i)
	{
		QAction* act = new QAction(suported_channels[i].c_str(), 0);
		add_channel_menu.addAction(act);
		connect(act, SIGNAL(triggered()), this, SLOT(onCreateChannel()));
	}

    QSqlRecord plugin_path_rec = settings->query("SELECT value as plugin_path FROM property WHERE name = 'plugin_path'").record();
    QSqlRecord screen_shot_path_rec = settings->query("SELECT value as screen_shot_path FROM property WHERE name = 'screen_shot_path'").record();
    ui.line_plugin_path->setText(plugin_path_rec.value("plugin_path").toString());
    ui.line_screen_shot_path->setText(screen_shot_path_rec.value("screen_shot_path").toString());

    QObject::connect(this, SIGNAL(updateMain(GUIUpdate)), parent, SLOT(updateMain(GUIUpdate)));

	QObject::connect(ui.button_add_channel, SIGNAL(clicked()), this, SLOT(onAddChannel()));
	QObject::connect(ui.button_edit_channel, SIGNAL(clicked()), this, SLOT(onEditChannel()));
	QObject::connect(ui.button_remove_channel, SIGNAL(clicked()), this, SLOT(onRemoveChannel()));

	QObject::connect(ui.button_add_encoder, SIGNAL(clicked()), this, SLOT(onAddEncoder()));
	QObject::connect(ui.button_edit_encoder, SIGNAL(clicked()), this, SLOT(onEditEncoder()));
	QObject::connect(ui.button_remove_encoder, SIGNAL(clicked()), this, SLOT(onRemoveEncoder()));

	QObject::connect(ui.list_resolutions, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(onResolutionItemChanged(QListWidgetItem *)));
	QObject::connect(ui.button_clearall_resolutions, SIGNAL(clicked()), this, SLOT(onClearAllResolutions()));
	QObject::connect(ui.button_sellectall_resolutions, SIGNAL(clicked()), this, SLOT(onSellectAllResolutions()));
	QObject::connect(ui.button_loaddefaults_resolutions, SIGNAL(clicked()), this, SLOT(onLoadDefaultResolutions()));
	QObject::connect(ui.button_add_resolutions, SIGNAL(clicked()), this, SLOT(onAddResolutions()));
	QObject::connect(ui.button_remove_resolutions, SIGNAL(clicked()), this, SLOT(onRemoveResolutions()));
	QObject::connect(ui.button_edit_resolutions, SIGNAL(clicked()), this, SLOT(onEditResolutions()));
	QObject::connect(ui.line_screen_shot_path, SIGNAL(textChanged(const QString &)), this, SLOT(onEditScreenShotPath(const QString &)));
	QObject::connect(ui.line_plugin_path, SIGNAL(textChanged(const QString &)), this, SLOT(onEditPluginPath(const QString &)));
	QObject::connect(ui.select_plugins_dir, SIGNAL(clicked()), this, SLOT(onSelectPluginPath()));
	QObject::connect(ui.select_screenshot_dir, SIGNAL(clicked()), this, SLOT(onSelectScreenShotPath()));

	QObject::connect(ui.list_encoders, SIGNAL(currentTextChanged(const QString &)), this, SLOT(onEncoderSelect(const QString &)));
}
Beispiel #2
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
ChannelModel::pFutureChannel_type 
ChannelModel::createChannel(Common::I_Session& _session, const std::string& _name, const std::string& _description)
{
    /// TODO Check session (i.e. session user) against permissions.

    /// TODO Make this async
    pFutureChannel_type returnValue(new FutureChannel_type);

    // Get the data map.
    Community::Chat::I_ChatChannelDataMap::pChatChannelDataMap_type pChannelDM =
        Community::Chat::I_ChatChannelDataMap::create(
            m_service.getApplicationServer().getDatabaseConnection(
                m_service.getDatabaseConnectionName()
            )
        );

    // Create a new domain object.
    Community::Chat::I_ChatChannelDataMap::pChatChannelDomainObject_type pChannelDO =
        pChannelDM->createNew();

    // Populate the values.
    pChannelDO->getName()           = _name;
    pChannelDO->getDescription()    = _description;

    // Update the object (and in this case, insert it).
    boost::uint64_t newChannelId    = pChannelDM->update(pChannelDO)->getValue();
    pChannelDO->getChatChannelId()  = newChannelId;

    Channel* pRawChannel = new Channel(m_service, pChannelDO);

    pChannel_type pChannel(
        pRawChannel,
        &destroyChannel
    );

    m_channels[_name] = pChannel;

    onAddChannel(pChannel);

    returnValue->setValue(pChannel);

    return returnValue;
}