//////////////////////////// Loader UI //////////////////////////////////
| 86 | |
| 87 | ///////////////////////////////// Loader UI ////////////////////////////////// |
| 88 | Loader::Loader(Application *app) |
| 89 | { |
| 90 | QFont font; |
| 91 | static QPixmap background(QString(":/icons/splash.png")); |
| 92 | |
| 93 | this->suscan = Suscan::Singleton::get_instance(); |
| 94 | this->app = app; |
| 95 | |
| 96 | // Init CURL |
| 97 | #ifdef HAVE_CURL |
| 98 | if (curl_global_init(CURL_GLOBAL_ALL) != 0) { |
| 99 | fprintf(stderr, "*** CURL Initialization failed ***\n"); |
| 100 | exit(EXIT_FAILURE); |
| 101 | } |
| 102 | #endif // HAVE_CURL |
| 103 | |
| 104 | // Allocate resources |
| 105 | this->flushLog(); |
| 106 | this->initThread = std::make_unique<InitThread>(this); |
| 107 | |
| 108 | font.setBold(true); |
| 109 | font.setPixelSize(12); |
| 110 | font.setStretch(125); |
| 111 | |
| 112 | this->setPixmap(background); |
| 113 | this->setFont(font); |
| 114 | this->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::SplashScreen); |
| 115 | this->finish(this->app); |
| 116 | |
| 117 | // Connect thread to this object |
| 118 | connect( |
| 119 | this->initThread.get(), |
| 120 | SIGNAL(done(void)), |
| 121 | this, |
| 122 | SLOT(handleDone(void)), |
| 123 | Qt::QueuedConnection); |
| 124 | |
| 125 | connect( |
| 126 | this->initThread.get(), |
| 127 | SIGNAL(change(const QString &)), |
| 128 | this, |
| 129 | SLOT(handleChange(const QString &)), |
| 130 | Qt::QueuedConnection); |
| 131 | |
| 132 | connect( |
| 133 | this->initThread.get(), |
| 134 | SIGNAL(failure(const QString &)), |
| 135 | this, |
| 136 | SLOT(handleFailure(const QString &)), |
| 137 | Qt::QueuedConnection); |
| 138 | } |
| 139 | |
| 140 | void |
| 141 | Loader::flushLog(void) |