Finish up
This commit is contained in:
parent
5efbdcbd6a
commit
0c466644ce
23 changed files with 958 additions and 154 deletions
45
src/main.cpp
45
src/main.cpp
|
|
@ -8,28 +8,47 @@
|
|||
#include <QDir>
|
||||
#include <QThread>
|
||||
#include <opencv2/core/mat.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cameras.h"
|
||||
#include "./ui/cameradialog.h"
|
||||
#include "profile.h"
|
||||
#include "./ui/mainwindow.h"
|
||||
#include "./ui/profiledialog.h"
|
||||
#include "imagepipeline.h"
|
||||
|
||||
const char* organziation = "UVOS";
|
||||
const char* application = "UVOS";
|
||||
const char* version = "UVOS";
|
||||
|
||||
std::vector<cam::Camera::Description> showCameraSelectionDialog()
|
||||
std::vector<cam::Camera::Description> showCameraSelectionDialog(bool* accepted = nullptr)
|
||||
{
|
||||
std::vector<cam::Camera::Description> ret;
|
||||
CameraDialog diag(cam::Camera::getAvailableCameras());
|
||||
|
||||
diag.show();
|
||||
if(diag.exec() == QDialog::Accepted)
|
||||
{
|
||||
ret = diag.getDescriptions();
|
||||
if(accepted)
|
||||
*accepted = true;
|
||||
}
|
||||
else if(accepted)
|
||||
{
|
||||
*accepted = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void showProfileDialog(Cameras* cameras)
|
||||
{
|
||||
qDebug()<<__FUNCTION__;
|
||||
cameras->stop();
|
||||
ProfileDialog diag(cameras);
|
||||
diag.show();
|
||||
diag.exec();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
|
@ -53,6 +72,14 @@ int main(int argc, char *argv[])
|
|||
uvosled led;
|
||||
int uvosledRet = uvosled_connect(&led);
|
||||
|
||||
if(uvosledRet >= 0)
|
||||
{
|
||||
uvosled_poweron(&led);
|
||||
// Give cameras some time to power on
|
||||
// TODO: figure out how to do this better
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
Cameras cameras(uvosledRet < 0 ? nullptr : &led);
|
||||
ImagePipeline pipe(&cameras);
|
||||
|
||||
|
|
@ -61,7 +88,16 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(&cameras, &Cameras::cameraAdded, &w, &MainWindow::addCamera);
|
||||
QObject::connect(&cameras, &Cameras::cameraRemoved, &w, &MainWindow::removeCamera);
|
||||
QObject::connect(&w, &MainWindow::sigCapture, [&cameras](){cameras.start(); cameras.trigger();});
|
||||
QObject::connect(&w, &MainWindow::sigChooseCameras, [&cameras](){cameras.setCameras(showCameraSelectionDialog());});
|
||||
|
||||
QObject::connect(&w, &MainWindow::sigChooseCameras, [&cameras]()
|
||||
{
|
||||
bool accepted;
|
||||
std::vector<cam::Camera::Description> descs = showCameraSelectionDialog(&accepted);
|
||||
if(accepted)
|
||||
cameras.setCameras(descs);
|
||||
});
|
||||
|
||||
QObject::connect(&w, &MainWindow::sigEditProfiles, [&cameras, &w](){showProfileDialog(&cameras); w.refreshProfiles();});
|
||||
QObject::connect(&pipe, &ImagePipeline::sigResult, w.mainImageViewer(), &CvImageViewer::setImage, Qt::QueuedConnection);
|
||||
|
||||
QObject::connect(&w, &MainWindow::sigProfile, [&pipe](QString name)
|
||||
|
|
@ -85,9 +121,14 @@ int main(int argc, char *argv[])
|
|||
cameras.setCameras(showCameraSelectionDialog());
|
||||
}
|
||||
|
||||
pipe.setProfile(w.getProfileName());
|
||||
|
||||
int ret = a.exec();
|
||||
|
||||
cameras.store(settings);
|
||||
|
||||
if(uvosledRet >= 0)
|
||||
uvosled_poweroff(&led);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue