The slots are like this:
connect(ZoomSlider, SIGNAL(sliderPressed()), this, SLOT(DoAbort()));
connect(ZoomSlider, SIGNAL(sliderReleased()), this, SLOT(Restart()));
connect(ZoomSlider, SIGNAL(sliderPressed()), this, SLOT(DoAbort()));
connect(ZoomSlider, SIGNAL(sliderReleased()), this, SLOT(Restart()));
To copy to clipboard, switch view to plain text mode
The camera is doing live imaging, and pressing the slider aborts this.
The camera should not be active when the slider is moved.
The camera should restart the live imaging with new parameters when the slider is released at its new position.
The Stop:
void
CameraWindow::DoAbort() {
int rc=0;
if(busy) return;
printf("\nAborting...");
aborting = true;
if(LiveThread->isRunning()) {
busy = true;
rc = AbortCameraLive(); // camera SDK call
LiveThread->wait();
// The camera thread will emit busy=false when finished and ready to reset.
}
CameraExit(); // camera SDK call
inited = false;
CameraInit(); // camera SDK call
aborting = false;
void
CameraWindow::DoAbort() {
int rc=0;
if(busy) return;
printf("\nAborting...");
aborting = true;
if(LiveThread->isRunning()) {
busy = true;
rc = AbortCameraLive(); // camera SDK call
LiveThread->wait();
// The camera thread will emit busy=false when finished and ready to reset.
while(busy) QApplication::processEvents();
}
CameraExit(); // camera SDK call
inited = false;
CameraInit(); // camera SDK call
aborting = false;
To copy to clipboard, switch view to plain text mode
And the Restart:
void
CameraWindow::Restart()
{
if(busy) return;
if(aborting) return;
zoomcontrol = ZoomSlider->value();
DelayedLiveDisplay.start(500); // safer
}
void
CameraWindow::Restart()
{
if(busy) return;
if(aborting) return;
zoomcontrol = ZoomSlider->value();
DelayedLiveDisplay.start(500); // safer
}
To copy to clipboard, switch view to plain text mode
There are surely many ways to do this, but now I am concentrating to get this scheme robust so that sloppy clicking around will not stall the camera.
Bookmarks