//Select button void Dialog::on_pushButton_clicked() { char buffer = ' '; //select file QModelIndex index = ui->treeView->currentIndex(); QString selectedFile = (model->filePath(index) ); std::string fileString = selectedFile.toStdString().c_str(); // set up file reader std::ifstream fin; fin.clear(); fin.open(fileString); // Check if file exists if(fin.good()) { // If yes, get the file from the selected folder AppInfo newApp; //create temp app manager->getApp(fin, newApp); // get the app from the file newApp.setPathToGarcon(fileString); manager->addApp(newApp); //put the app in the menu } // If no, don't do anything and print error message else QMessageBox::information(this, "ERROR", "INVALID FILE FORMAT"); fin.close(); //close window //need to re-eneable buttons? this->~Dialog(); }
Notification::Notification(const Compositor::NotificationData& data, ILXCompositor* parent) : Widget(parent->appWindow()), _compositor(parent), _notState(Init), _clicked(false) { ILOG_TRACE_W(ILX_NOTIFICATION); setInputMethod(PointerInput); if (!_bg) _bg = new Image(ILIXI_DATADIR"images/notify.png"); _client = data.client; _tag = data.tag; _text = data.body; _title = data.title; snprintf(_uuid, 37, "%s", data.uuid); if (strcmp(data.icon, "") != 0) _icon = new Image(data.icon, 64, 64); else { AppInfo* info = _compositor->appMan()->infoByPID(_client); if (info) _icon = new Image(info->icon(), 64, 64); else _icon = stylist()->defaultIcon(StyleHint::Cross); } _timer.sigExec.connect(sigc::mem_fun(this, &Notification::hide)); _animZ = new TweenAnimation(); _tweenZ = new Tween(Tween::SINE, Tween::EASE_OUT, 0, 1); _animZ->addTween(_tweenZ); _animZ->setDuration(400); _animZ->sigExec.connect(sigc::mem_fun(this, &Notification::tweenSlot)); _seq.addAnimation(_animZ); _animX = new TweenAnimation(); _tweenX = new Tween(Tween::SINE, Tween::EASE_OUT, 1, 0); _animX->addTween(_tweenX); _animX->setDuration(400); _animX->sigExec.connect(sigc::mem_fun(this, &Notification::tweenSlot)); _animX->sigFinished.connect(sigc::mem_fun(this, &Notification::tweenEndSlot)); _seq.addAnimation(_animX); setVisible(false); ILOG_DEBUG(ILX_NOTIFICATION, " -> body: %s\n", data.body); ILOG_DEBUG(ILX_NOTIFICATION, " -> client: %d\n", _client); ILOG_DEBUG(ILX_NOTIFICATION, " -> iconURL: %s\n", data.icon); ILOG_DEBUG(ILX_NOTIFICATION, " -> title: %s\n", data.title); ILOG_DEBUG(ILX_NOTIFICATION, " -> uuid: %s\n", data.uuid); }
//=================================================================================================== // // Function: Scribe2MEIEncoderDesc // Purpose: utility function to create basic Encoder Description for MEI header structure filed with // NeoScribe data // Used by: // //=================================================================================================== EncodingDesc* CScribeToNeoScribeXML::Scribe2MEIEncoderDesc() { /* - EncodingDescription - Application information - Declaration of Editorial Principles - Project Description - Sampling Declaration */ EncodingDesc* encodingDesc = new EncodingDesc; AppInfo* appInfo = new AppInfo; encodingDesc->addChild(appInfo); Application* application = new Application; appInfo->addChild(application); application->setId("xsl_scribe2neoscribexml"); application->setVersion("0.1"); application->setValue("Scribe2NeoScribeXML"); return encodingDesc; }
QVariantList DBusPebble::InstalledApps() const { QVariantList list; foreach (const QUuid &appId, m_pebble->installedAppIds()) { QVariantMap app; AppInfo info = m_pebble->appInfo(appId); app.insert("storeId", info.storeId()); app.insert("name", info.shortName()); app.insert("vendor", info.companyName()); app.insert("watchface", info.isWatchface()); app.insert("version", info.versionLabel()); app.insert("uuid", info.uuid().toString()); app.insert("hasSettings", info.hasSettings()); app.insert("icon", info.path() + "/list_image.png"); app.insert("systemApp", info.isSystemApp()); list.append(app); } return list; }
void AppCompositor::updateAppCompositorGeometry() { ILOG_TRACE_W(ILX_APPCOMPOSITOR); float w = _zoomFactor * width(); float h = _zoomFactor * height(); if (w == 0 || h == 0) return; AppInfo* info = _instance->appInfo(); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> name: %s\n", info->name().c_str()); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> w: %f h: %f\n", w, h); if (info) { if (info->appFlags() & APP_NO_MAINWINDOW) { int i = 0; ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> APP_NO_MAINWINDOW - ZoomFactor: %f\n", _zoomFactor); // calc bounding box. Rectangle bounds; for (WidgetList::iterator it = _children.begin(); it != _children.end(); ++it) { SurfaceView* view = dynamic_cast<SurfaceView*>(*it); if (view) { int x, y; view->dfbWindow()->GetPosition(view->dfbWindow(), &x, &y); Size s = view->preferredSize(); bounds.unite(Rectangle(x, y, s.width(), s.height())); } } // resize _hScale = width() < _compositor->getAppGeometry().width() ? w / _compositor->getAppGeometry().width() : 1; _vScale = height() < _compositor->getAppGeometry().height() ? h / _compositor->getAppGeometry().height() : 1; for (WidgetList::iterator it = _children.begin(); it != _children.end(); ++it) { SurfaceView* view = dynamic_cast<SurfaceView*>(*it); if (view) { int x, y; view->dfbWindow()->GetPosition(view->dfbWindow(), &x, &y); Size s = view->preferredSize(); view->setGeometry(x * _hScale, y * _vScale, s.width() * _hScale, s.height() * _vScale); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> window[%d]: %d, %d - %d x %d\n", i, view->x(), view->y(), view->width(), view->height()); ++i; } } } else { int i = 0; ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> APP_WITH_MAINWINDOW - ZoomFactor: %f\n", _zoomFactor); for (WidgetList::iterator it = _children.begin(); it != _children.end(); ++it) { SurfaceView* view = dynamic_cast<SurfaceView*>(*it); if (view) { if (i == 0) { view->setGeometry((width() - w) / 2, (height() - h) / 2, w, h); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> window[%d]: %d, %d - %d x %d\n", i, view->x(), view->y(), view->width(), view->height()); // Calculate scaling factors using mainwindow as base Size s = view->preferredSize(); _hScale = w / s.width(); _vScale = h / s.height(); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> hScale: %f vScale: %f\n", _hScale, _vScale); } else { int x, y; view->dfbWindow()->GetPosition(view->dfbWindow(), &x, &y); Size s = view->preferredSize(); view->setGeometry(x * _hScale, y * _vScale, s.width() * _hScale, s.height() * _vScale); ILOG_DEBUG(ILX_APPCOMPOSITOR, " -> window[%d]: %d, %d - %d x %d\n", i, view->x(), view->y(), view->width(), view->height()); } ++i; } } } } }
void AppDownloader::appJsonFetched() { QNetworkReply *reply = static_cast<QNetworkReply*>(sender()); reply->deleteLater(); if (reply->error() != QNetworkReply::NoError) { qWarning() << "Error fetching App Json" << reply->errorString(); return; } QJsonParseError error; QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error); if (error.error != QJsonParseError::NoError) { qWarning() << "Error parsing App Json" << error.errorString(); return; } QVariantMap map = jsonDoc.toVariant().toMap(); if (!map.contains("data") || map.value("data").toList().length() == 0) { qWarning() << "Unexpected json content:" << jsonDoc.toJson(); return; } QVariantMap appMap = map.value("data").toList().first().toMap(); QString pbwFileUrl = appMap.value("latest_release").toMap().value("pbw_file").toString(); if (pbwFileUrl.isEmpty()) { qWarning() << "pbw file url empty." << jsonDoc.toJson(); return; } QString appid = appMap.value("id").toString(); QUuid quuid = appMap.value("uuid").toUuid(); QDir dir; Pebble *p = (Pebble *)parent(); if(p->installedAppIds().contains(quuid)) { AppInfo ai = p->appInfo(quuid); QString exId = ai.storeId(); if(appid != exId && !dir.exists(m_storagePath+appid) && dir.exists(m_storagePath+exId)) { dir.rename(m_storagePath+exId,m_storagePath+appid); } else if(appid != exId) { qWarning() << "App exists but dir is out of sync:" << exId << "<!>" << appid; } } else { dir.mkpath(m_storagePath + appid); } QString iconFile = appMap.value("list_image").toMap().value("144x144").toString(); QNetworkRequest request(iconFile); QNetworkReply *imageReply = m_nam->get(request); qDebug() << "fetching image" << iconFile; connect(imageReply, &QNetworkReply::finished, [this, imageReply, appid]() { imageReply->deleteLater(); QString targetFile = m_storagePath + appid + "/list_image.png"; qDebug() << "saving image to" << targetFile; QFile f(targetFile); if (f.open(QFile::WriteOnly)) { f.write(imageReply->readAll()); f.close(); } }); appid += ("/v" + appMap.value("latest_release").toMap().value("version").toString() + ".pbw"); fetchPackage(pbwFileUrl, appid); }