Ejemplo n.º 1
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    qDebug() << "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
    QApplication *app = MDeclarativeCache::qApplication(argc, argv);
    app->setOrganizationName("frals");
    app->setOrganizationDomain("frals.se");
    app->setApplicationName("lpmcustomizer");

    QFont font = QFont("Nokia Pure Text Light");
    app->setFont(font);

    QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();
    QDeclarativeContext *ctx = view->rootContext();

    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view->setInputMethodHints(Qt::ImhNoPredictiveText);

    qmlRegisterType<GalleryItem>("LPM", 1, 0, "GalleryItem");

    PlatformIntegration *p = new PlatformIntegration(ctx);
    ImageGenerator *ig = new ImageGenerator();
    ImageSaver *is = new ImageSaver(ig);

    QObject::connect(is, SIGNAL(imageSaved(QString)), p, SLOT(onImageSaved(QString)));

    view->engine()->addImageProvider(QString("logocreator"), ig);

    ctx->setContextProperty("platform", p);
    ctx->setContextProperty("imageSaver", is);

    p->updateGallery();

    QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));

//    QString pathInInstallDir = QCoreApplication::applicationDirPath()
//            + QLatin1String("/../") + "qml/lpmcustomizer";

    view->setSource(QUrl("qrc:/qml/main.qml"));
    view->showFullScreen();

//    QmlApplicationViewer viewer;
//    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
//    viewer.setMainQmlFile(QLatin1String("qml/LPMCustomizer/main.qml"));
//    viewer.showExpanded();

    return app->exec();
}
Ejemplo n.º 2
0
void FilteredImage::saveImage()
{
    applyCurrentFilter();

    QDir dir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));

    if(!dir.cd("filters"))
    {
        dir.mkdir("filters");
        dir.cd("filters");
    }

    QString filename = QString::number(QDateTime::currentMSecsSinceEpoch()) + ".jpg";

    m_image.save(dir.absolutePath() + "/" + filename,"JPG");

    emit imageSaved(filename);
}
Ejemplo n.º 3
0
void ExportManager::doSave(const QUrl &url, bool notify)
{
    if (mSavePixmap.isNull()) {
        emit errorMessage(i18n("Cannot save an empty screenshot image."));
        return;
    }

    QUrl savePath = url.isValid() ? url : getAutosaveFilename();
    if (save(savePath)) {
        QDir dir(savePath.path());
        dir.cdUp();
        setSaveLocation(dir.absolutePath());

        emit imageSaved(savePath);
        if (notify) {
            emit forceNotify(savePath);
        }
    }
}
Ejemplo n.º 4
0
void QmlScanner::saveImage(QString path) {
     //imwrite( path, gray_image );
    // TODO save

    imageSaved(QUrl(path));
}