mainny ui improcements

This commit is contained in:
uvos 2021-06-17 18:39:47 +02:00
parent 50777fe056
commit 86ec50575b
25 changed files with 819 additions and 264 deletions

View file

@ -9,6 +9,7 @@
#include <QThread>
#include <opencv2/core/mat.hpp>
#include <unistd.h>
#include <uvosunwrap/log.h>
#include "cameras.h"
#include "./ui/cameradialog.h"
@ -17,6 +18,7 @@
#include "./ui/profiledialog.h"
#include "imagepipeline.h"
const char* organziation = "UVOS";
const char* application = "UVOS";
const char* version = "UVOS";
@ -44,13 +46,18 @@ void showProfileDialog(Cameras* cameras)
{
qDebug()<<__FUNCTION__;
cameras->stop();
cameras->disable(true);
std::vector<cam::Camera::Description> descs = cameras->getCameras();
ProfileDialog diag(cameras);
diag.show();
diag.exec();
cameras->disable(false);
}
int main(int argc, char *argv[])
{
Log::level = Log::WARN;
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("UVOS");
QCoreApplication::setOrganizationDomain("uvos.xyz");
@ -61,11 +68,12 @@ int main(int argc, char *argv[])
splash.show();
QDir().mkpath(Profile::profileLocation());
QDir().mkpath(CameraSetup::camerasLocation());
qRegisterMetaType<cv::Mat>("cv::Mat");
qRegisterMetaType<size_t>("size_t");
qRegisterMetaType<Camera::Image>("Camera::Image");
qRegisterMetaType<Camera::Image>("Image");
qRegisterMetaType<std::vector<Camera::Image>>("std::vector<Camera::Image>");
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
@ -100,11 +108,16 @@ int main(int argc, char *argv[])
QObject::connect(&w, &MainWindow::sigEditProfiles, [&cameras, &w](){showProfileDialog(&cameras); w.refreshProfiles();});
QObject::connect(&pipe, &ImagePipeline::sigResult, w.mainImageViewer(), &CvImageViewer::setImage, Qt::QueuedConnection);
QObject::connect(&pipe, &ImagePipeline::sigInvalidProfile, &w, &MainWindow::profileInconpatible);
QObject::connect(&w, &MainWindow::sigProfile, [&pipe](QString name)
{
Profile profile;
profile.load(name);
if(profile.cameras.size() != 0)
qDebug()<<"loading profile"<<name<<"with"<<profile.cameras.size()<<"cameras and first camera"<<profile.cameras.at(0).id;
else
qDebug()<<"empty profile!!";
pipe.setProfile(profile);
});
@ -122,7 +135,17 @@ int main(int argc, char *argv[])
cameras.setCameras(showCameraSelectionDialog());
}
pipe.setProfile(w.getProfileName());
QString name = w.getProfileName();
if(!name.isEmpty())
{
Profile profile;
profile.load(w.getProfileName());
if(profile.cameras.size() != 0)
qDebug()<<"loading profile"<<name<<"with"<<profile.cameras.size()<<"cameras and first camera"<<profile.cameras.at(0).id;
else
qDebug()<<"empty profile!!";
pipe.setProfile(profile);
}
int ret = a.exec();