Revert "run splash on own thread"
This reverts commit 0f1a6f1ba0cb29eb2d4da7529c8a828cb07645da.
This commit is contained in:
@ -53,5 +53,5 @@ set(PROJECT_SOURCES
|
||||
|
||||
add_executable(MAClient ${PROJECT_SOURCES})
|
||||
target_compile_options(MAClient PRIVATE "-std=gnu++17" "-Wall" "-O2" "-fno-strict-aliasing")
|
||||
target_link_libraries(MAClient PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent ${OpenCV_LIBS} -luvoscam -luvosled -luvosunwrap -pthread)
|
||||
target_link_libraries(MAClient PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Concurrent ${OpenCV_LIBS} -luvoscam -luvosled -luvosunwrap)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS} src src/ui)
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <QDebug>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <unistd.h>
|
||||
#include <QTimer>
|
||||
|
||||
Cameras::Cameras(uvosled* led): led_(led)
|
||||
@ -81,7 +80,8 @@ bool Cameras::addCamera(const cam::Camera::Description& desc)
|
||||
camera->cam()->setAcquisitionMode(cam::Camera::MODE_FREE);
|
||||
camera->cam()->setFrameRate(10);
|
||||
camera->cam()->startAcquisition();
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds(200));
|
||||
struct timespec tv = {0, 200000000};
|
||||
nanosleep(&tv, nullptr);
|
||||
camera->cam()->stopAcquisition();
|
||||
cameras_.pop_back();
|
||||
camera = nullptr;
|
||||
@ -97,7 +97,7 @@ bool Cameras::addCamera(const cam::Camera::Description& desc)
|
||||
camera->cam()->setAcquisitionMode(cam::Camera::MODE_FREE);
|
||||
camera->cam()->setFrameRate(10);
|
||||
camera->cam()->startAcquisition();
|
||||
QTimer::singleShot(5000, [this, camera](){finishAddCamera(camera);});
|
||||
QTimer::singleShot(5000, [camera, this](){finishAddCamera(camera);});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
37
src/main.cpp
37
src/main.cpp
@ -6,8 +6,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QSplashScreen>
|
||||
#include <QDir>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <QThread>
|
||||
#include <opencv2/core/mat.hpp>
|
||||
#include <unistd.h>
|
||||
#include <uvosunwrap/log.h>
|
||||
@ -24,8 +23,6 @@ const char* organziation = "UVOS";
|
||||
const char* application = "UVOS";
|
||||
const char* version = "UVOS";
|
||||
|
||||
std::atomic<bool> closeSplash = false;
|
||||
|
||||
std::vector<cam::Camera::Description> showCameraSelectionDialog(bool* accepted = nullptr)
|
||||
{
|
||||
std::vector<cam::Camera::Description> ret;
|
||||
@ -57,34 +54,24 @@ void showProfileDialog(Cameras* cameras)
|
||||
cameras->disable(false);
|
||||
}
|
||||
|
||||
void showSplash()
|
||||
{
|
||||
QSplashScreen splash(QPixmap(":/images/splash.png"));
|
||||
splash.show();
|
||||
while(!closeSplash)
|
||||
{
|
||||
splash.repaint();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Log::level = Log::WARN;
|
||||
|
||||
QApplication a(argc, argv);
|
||||
QCoreApplication::setOrganizationName("UVOS");
|
||||
QCoreApplication::setOrganizationDomain("uvos.xyz");
|
||||
QCoreApplication::setApplicationName("LubircantThiknessMapperUi");
|
||||
QCoreApplication::setApplicationVersion("0.1");
|
||||
|
||||
std::thread splashThred(&showSplash);
|
||||
|
||||
uvosled led;
|
||||
int uvosledRet = uvosled_connect(&led);
|
||||
int ret;
|
||||
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QCoreApplication::setOrganizationName("UVOS");
|
||||
QCoreApplication::setOrganizationDomain("uvos.xyz");
|
||||
QCoreApplication::setApplicationName("LubircantThiknessMapperUi");
|
||||
QCoreApplication::setApplicationVersion("0.1");
|
||||
|
||||
QSplashScreen splash(QPixmap(":/images/splash.png"));
|
||||
splash.show();
|
||||
|
||||
QDir().mkpath(Profile::profileLocation());
|
||||
|
||||
qRegisterMetaType<cv::Mat>("cv::Mat");
|
||||
@ -101,7 +88,7 @@ int main(int argc, char *argv[])
|
||||
uvosled_poweron(&led);
|
||||
// Give cameras some time to power on
|
||||
// TODO: figure out how to do this better
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
Cameras cameras(uvosledRet < 0 ? nullptr : &led);
|
||||
@ -140,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
cameras.load(settings);
|
||||
|
||||
closeSplash = true;
|
||||
splash.hide();
|
||||
w.show();
|
||||
|
||||
if(uvosledRet < 0)
|
||||
|
Reference in New Issue
Block a user