GlTraceSettingsDialog::GlTraceSettingsDialog(GlTraceFilterModel *model, QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);

	treeView->setEditTriggers(QAbstractItemView::CurrentChanged | 
                              QAbstractItemView::SelectedClicked);
	treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
	treeView->setSelectionMode(QAbstractItemView::SingleSelection);

    m_pGlTraceModel = model;

    m_pViewFilter = new GlTraceSettingsViewFilter(m_pGlTraceModel);
    m_pViewFilter->setSourceModel(m_pGlTraceModel);

	treeView->setModel(m_pViewFilter);



    connect(leSearch, SIGNAL(textChanged(const QString &)),
            m_pViewFilter, SLOT(setFilterWildcard(const QString &)));

    connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), 
            SIGNAL(pressed()),
            this, SLOT(resetToDefaults()));

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptSettings()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectSettings()));

    connect(buttonBox->button(QDialogButtonBox::Reset), 
            SIGNAL(pressed()),
            this, SLOT(rejectSettings()));
}
示例#2
0
WasapiEngine::WasapiEngine()
: AudioEngine("WASAPI")
, confWidget(new QWidget)
, deviceSelector(new QComboBox(confWidget.get()))
, exclusive_(new QCheckBox(QObject::tr("Exclusive mode"), confWidget.get()),
             "wasapiengine/exclusive", false)
, pAudioClient()
, pRenderClient()
, pAudioClock()
, eventHandle_(0)
, pos_(0)
, posFrames(0)
, deviceIndex(0)
, nchannels_(2)
, bufferFrameCount(0)
, started(false)
{
	fillDeviceSelector(deviceSelector);

	{
		QVBoxLayout *const mainLayout = new QVBoxLayout(confWidget.get());
		mainLayout->setMargin(0);

		if (deviceSelector->count() > 1) {
			QHBoxLayout *hlayout = new QHBoxLayout;
			mainLayout->addLayout(hlayout);
			hlayout->addWidget(new QLabel(QObject::tr("WASAPI device:")));
			hlayout->addWidget(deviceSelector);
		} else
			deviceSelector->hide();

		mainLayout->addWidget(exclusive_.checkBox());
	}

	{
		QSettings settings;
		settings.beginGroup("wasapiengine");
		deviceIndex = settings.value("deviceIndex", deviceIndex).toUInt();
		if (deviceIndex >= static_cast<uint>(deviceSelector->count()))
			deviceIndex = 0;

		settings.endGroup();
	}

	rejectSettings();
}
示例#3
0
Direct3DBlitter::Direct3DBlitter(VideoBufferLocker vbl, QWidget *parent)
: BlitterWidget(vbl, "Direct3D", 2, parent)
, confWidget(new QWidget)
, adapterSelector(new QComboBox(confWidget.get()))
, vblankblit_(new QCheckBox(tr("Wait for vertical blank"), confWidget.get()),
              "direct3dblitter/vblankblit", false)
, flipping_(new QCheckBox(tr("Exclusive full screen"), confWidget.get()),
            "direct3dblitter/flipping", false)
, vblankflip_(new QCheckBox(tr("Flip during vertical blank"), confWidget.get()),
              "direct3dblitter/vblankflip", true)
, triplebuf_(new QCheckBox(tr("Triple buffering"), confWidget.get()),
             "direct3dblitter/triplebuf", false)
, bf_(new QCheckBox(tr("Bilinear filtering"), confWidget.get()),
      "direct3dblitter/bf", true)
, d3d9handle()
, d3d()
, device()
, vertexBuffer()
, stexture()
, vtexture()
, lastblank(0)
, backBufferWidth(1)
, backBufferHeight(1)
, clear(0)
, dhz(600)
, swapInterval(0)
, adapterIndex(0)
, exclusive(false)
, windowed(false)
, drawn(false)
{
	setAttribute(Qt::WA_PaintOnScreen, true);

	if ((d3d9handle = LoadLibraryA("d3d9.dll"))) {
		typedef IDirect3D9 * (WINAPI *Direct3DCreate9Ptr)(UINT);
		Direct3DCreate9Ptr const direct3DCreate9 =
			reinterpret_cast<Direct3DCreate9Ptr>(GetProcAddress(d3d9handle,
			                                                    "Direct3DCreate9"));
		if (direct3DCreate9 && (d3d = direct3DCreate9(D3D_SDK_VERSION))) {
			unsigned const adapterCount = d3d->GetAdapterCount();
			for (unsigned i = 0; i < adapterCount; ++i) {
				D3DADAPTER_IDENTIFIER9 adapterId;
				if (FAILED(d3d->GetAdapterIdentifier(i, 0, &adapterId)))
					break;

				adapterSelector->addItem(adapterId.Description);
			}
		}
	}

	if (adapterSelector->count() < 1)
		adapterSelector->addItem(QString());

	QSettings settings;
	adapterIndex = settings.value("direct3dblitter/adapterIndex", adapterIndex).toUInt();
	if (adapterIndex >= static_cast<uint>(adapterSelector->count()))
		adapterIndex = 0;

	{
		QVBoxLayout *const mainLayout = new QVBoxLayout(confWidget.get());
		mainLayout->setMargin(0);

		if (adapterSelector->count() > 1) {
			QHBoxLayout *hlayout = new QHBoxLayout;
			mainLayout->addLayout(hlayout);
			hlayout->addWidget(new QLabel(tr("Direct3D adapter:")));
			hlayout->addWidget(adapterSelector);
		} else
			adapterSelector->hide();

		mainLayout->addWidget(vblankblit_.checkBox());
		vblankblit_.checkBox()->setToolTip(
			tr("Prevents tearing. Does not work well on all systems.\n"
			   "Ignored when exclusive full screen or DWM composition is active."));
		mainLayout->addWidget(flipping_.checkBox());
		flipping_.checkBox()->setToolTip(tr("Grabs device for better performance when full screen."));

		{
			QHBoxLayout *l = new QHBoxLayout;
			mainLayout->addLayout(l);
			l->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin));
			l->addWidget(vblankflip_.checkBox());
			vblankflip_.checkBox()->setToolTip(tr("Prevents tearing. Recommended."));
		}

		mainLayout->addWidget(triplebuf_.checkBox());
		triplebuf_.checkBox()->setToolTip(
			tr("Attempts to improve video flow at the cost of increased latency."));
		mainLayout->addWidget(bf_.checkBox());
	}

	vblankflip_.checkBox()->setEnabled(flipping_.checkBox()->isChecked());
	connect(flipping_.checkBox(), SIGNAL(toggled(bool)),
	        vblankflip_.checkBox(), SLOT(setEnabled(bool)));
	rejectSettings();
}