stashing temp. camera work
This commit is contained in:
parent
adb78e2641
commit
4ec22dda9e
|
@ -169,7 +169,7 @@ void CameraManager::deInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraManager::start()
|
void CameraManager::start()
|
||||||
{
|
{printf("[%d] [%d] START\n", num, startNum);
|
||||||
startNum++;
|
startNum++;
|
||||||
if (startNum > 1) return;
|
if (startNum > 1) return;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void CameraManager::start()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraManager::stop()
|
void CameraManager::stop()
|
||||||
{
|
{printf("[%d] [%d] STOP\n", num, startNum-1);
|
||||||
startNum--;
|
startNum--;
|
||||||
if (startNum > 0) return;
|
if (startNum > 0) return;
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "Platform.h"
|
|
||||||
#include "Config.h"
|
|
||||||
|
|
||||||
#include "CameraSettingsDialog.h"
|
#include "CameraSettingsDialog.h"
|
||||||
#include "ui_CameraSettingsDialog.h"
|
#include "ui_CameraSettingsDialog.h"
|
||||||
|
@ -66,11 +64,17 @@ void CameraPreviewPanel::paintEvent(QPaintEvent* event)
|
||||||
CameraSettingsDialog::CameraSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CameraSettingsDialog)
|
CameraSettingsDialog::CameraSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::CameraSettingsDialog)
|
||||||
{
|
{
|
||||||
previewPanel = nullptr;
|
previewPanel = nullptr;
|
||||||
|
currentCfg = nullptr;
|
||||||
currentCam = nullptr;
|
currentCam = nullptr;
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
oldCamSettings[i] = Config::Camera[i];
|
||||||
|
}
|
||||||
|
|
||||||
ui->cbCameraSel->addItem("DSi outer camera");
|
ui->cbCameraSel->addItem("DSi outer camera");
|
||||||
ui->cbCameraSel->addItem("DSi inner camera");
|
ui->cbCameraSel->addItem("DSi inner camera");
|
||||||
|
|
||||||
|
@ -91,6 +95,7 @@ CameraSettingsDialog::CameraSettingsDialog(QWidget* parent) : QDialog(parent), u
|
||||||
|
|
||||||
ui->cbPhysicalCamera->addItem(name, cameraInfo.deviceName());
|
ui->cbPhysicalCamera->addItem(name, cameraInfo.deviceName());
|
||||||
}
|
}
|
||||||
|
ui->rbPictureCamera->setEnabled(ui->cbPhysicalCamera->count() > 0);
|
||||||
|
|
||||||
grpInputType = new QButtonGroup(this);
|
grpInputType = new QButtonGroup(this);
|
||||||
grpInputType->addButton(ui->rbPictureNone, 0);
|
grpInputType->addButton(ui->rbPictureNone, 0);
|
||||||
|
@ -115,7 +120,11 @@ CameraSettingsDialog::~CameraSettingsDialog()
|
||||||
|
|
||||||
void CameraSettingsDialog::on_CameraSettingsDialog_accepted()
|
void CameraSettingsDialog::on_CameraSettingsDialog_accepted()
|
||||||
{
|
{
|
||||||
//
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
camManager[i]->stop();
|
||||||
|
}
|
||||||
|
|
||||||
Config::Save();
|
Config::Save();
|
||||||
|
|
||||||
closeDlg();
|
closeDlg();
|
||||||
|
@ -123,7 +132,13 @@ void CameraSettingsDialog::on_CameraSettingsDialog_accepted()
|
||||||
|
|
||||||
void CameraSettingsDialog::on_CameraSettingsDialog_rejected()
|
void CameraSettingsDialog::on_CameraSettingsDialog_rejected()
|
||||||
{
|
{
|
||||||
//
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
camManager[i]->stop();
|
||||||
|
camManager[i]->deInit();
|
||||||
|
Config::Camera[i] = oldCamSettings[i];
|
||||||
|
camManager[i]->init();
|
||||||
|
}
|
||||||
|
|
||||||
closeDlg();
|
closeDlg();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +152,10 @@ void CameraSettingsDialog::on_cbCameraSel_currentIndexChanged(int id)
|
||||||
currentCam->stop();
|
currentCam->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentId = id;
|
||||||
|
currentCfg = &Config::Camera[id];
|
||||||
currentCam = camManager[id];
|
currentCam = camManager[id];
|
||||||
|
populateCamControls(id);
|
||||||
previewPanel->setCurrentCam(currentCam);
|
previewPanel->setCurrentCam(currentCam);
|
||||||
|
|
||||||
currentCam->start();
|
currentCam->start();
|
||||||
|
@ -145,5 +163,108 @@ void CameraSettingsDialog::on_cbCameraSel_currentIndexChanged(int id)
|
||||||
|
|
||||||
void CameraSettingsDialog::onChangeInputType(int type)
|
void CameraSettingsDialog::onChangeInputType(int type)
|
||||||
{
|
{
|
||||||
printf("INPUT = %d\n", type);
|
if (!currentCfg) return;
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->stop();
|
||||||
|
currentCam->deInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentCfg->InputType = type;
|
||||||
|
|
||||||
|
ui->txtSrcImagePath->setEnabled(type == 1);
|
||||||
|
ui->btnSrcImageBrowse->setEnabled(type == 1);
|
||||||
|
ui->cbPhysicalCamera->setEnabled((type == 2) && (ui->cbPhysicalCamera->count()>0));
|
||||||
|
|
||||||
|
currentCfg->ImagePath = ui->txtSrcImagePath->text().toStdString();
|
||||||
|
|
||||||
|
if (ui->cbPhysicalCamera->count() > 0)
|
||||||
|
currentCfg->CamDeviceName = ui->cbPhysicalCamera->currentData().toString().toStdString();
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->init();
|
||||||
|
currentCam->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraSettingsDialog::on_txtSrcImagePath_textChanged()
|
||||||
|
{
|
||||||
|
if (!currentCfg) return;
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->stop();
|
||||||
|
currentCam->deInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentCfg->ImagePath = ui->txtSrcImagePath->text().toStdString();
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->init();
|
||||||
|
currentCam->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraSettingsDialog::on_btnSrcImageBrowse_clicked()
|
||||||
|
{
|
||||||
|
QString file = QFileDialog::getOpenFileName(this,
|
||||||
|
"Select image file...",
|
||||||
|
QString::fromStdString(EmuDirectory),
|
||||||
|
"Image files (*.png *.jpg *.jpeg *.bmp);;Any file (*.*)");
|
||||||
|
|
||||||
|
if (file.isEmpty()) return;
|
||||||
|
|
||||||
|
ui->txtSrcImagePath->setText(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraSettingsDialog::on_cbPhysicalCamera_currentIndexChanged(int id)
|
||||||
|
{
|
||||||
|
if (!currentCfg) return;
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->stop();
|
||||||
|
currentCam->deInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentCfg->CamDeviceName = ui->cbPhysicalCamera->itemData(id).toString().toStdString();
|
||||||
|
|
||||||
|
if (currentCam)
|
||||||
|
{
|
||||||
|
currentCam->init();
|
||||||
|
currentCam->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraSettingsDialog::populateCamControls(int id)
|
||||||
|
{
|
||||||
|
Config::CameraConfig& cfg = Config::Camera[id];
|
||||||
|
|
||||||
|
int type = cfg.InputType;
|
||||||
|
if (type < 0 || type >= grpInputType->buttons().count()) type = 0;
|
||||||
|
grpInputType->button(type)->setChecked(true);
|
||||||
|
|
||||||
|
ui->txtSrcImagePath->setText(QString::fromStdString(cfg.ImagePath));
|
||||||
|
|
||||||
|
bool deviceset = false;
|
||||||
|
QString device = QString::fromStdString(cfg.CamDeviceName);
|
||||||
|
for (int i = 0; i < ui->cbPhysicalCamera->count(); i++)
|
||||||
|
{
|
||||||
|
QString itemdev = ui->cbPhysicalCamera->itemData(i).toString();
|
||||||
|
if (itemdev == device)
|
||||||
|
{
|
||||||
|
ui->cbPhysicalCamera->setCurrentIndex(i);
|
||||||
|
deviceset = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!deviceset)
|
||||||
|
ui->cbPhysicalCamera->setCurrentIndex(0);
|
||||||
|
|
||||||
|
onChangeInputType(type);
|
||||||
|
|
||||||
|
ui->chkFlipPicture->setChecked(cfg.XFlip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
#include "CameraManager.h"
|
#include "CameraManager.h"
|
||||||
|
|
||||||
namespace Ui { class CameraSettingsDialog; }
|
namespace Ui { class CameraSettingsDialog; }
|
||||||
|
@ -86,16 +87,24 @@ private slots:
|
||||||
void on_CameraSettingsDialog_rejected();
|
void on_CameraSettingsDialog_rejected();
|
||||||
|
|
||||||
void on_cbCameraSel_currentIndexChanged(int id);
|
void on_cbCameraSel_currentIndexChanged(int id);
|
||||||
|
|
||||||
void onChangeInputType(int type);
|
void onChangeInputType(int type);
|
||||||
|
void on_txtSrcImagePath_textChanged();
|
||||||
|
void on_btnSrcImageBrowse_clicked();
|
||||||
|
void on_cbPhysicalCamera_currentIndexChanged(int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CameraSettingsDialog* ui;
|
Ui::CameraSettingsDialog* ui;
|
||||||
|
|
||||||
QButtonGroup* grpInputType;
|
QButtonGroup* grpInputType;
|
||||||
|
|
||||||
CameraPreviewPanel* previewPanel;
|
CameraPreviewPanel* previewPanel;
|
||||||
|
|
||||||
|
int currentId;
|
||||||
|
Config::CameraConfig* currentCfg;
|
||||||
CameraManager* currentCam;
|
CameraManager* currentCam;
|
||||||
|
|
||||||
|
Config::CameraConfig oldCamSettings[2];
|
||||||
|
|
||||||
|
void populateCamControls(int id);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CAMERASETTINGSDIALOG_H
|
#endif // CAMERASETTINGSDIALOG_H
|
||||||
|
|
|
@ -98,7 +98,20 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" rowspan="2">
|
<item row="2" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" rowspan="3">
|
||||||
<widget class="QGroupBox" name="grpPreview">
|
<widget class="QGroupBox" name="grpPreview">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Preview</string>
|
<string>Preview</string>
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct Teakra::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset() {
|
void Reset() {
|
||||||
shared_memory.raw.fill(0);
|
shared_memory.raw.fill(0); // BAD!!!!
|
||||||
miu.Reset();
|
miu.Reset();
|
||||||
apbp_from_cpu.Reset();
|
apbp_from_cpu.Reset();
|
||||||
apbp_from_dsp.Reset();
|
apbp_from_dsp.Reset();
|
||||||
|
|
Loading…
Reference in New Issue