Пример #1
0
void tst_QRawFont::textLayout()
{
    QFontDatabase fontDatabase;
    int id = fontDatabase.addApplicationFont(SRCDIR "testfont.ttf");
    QVERIFY(id >= 0);

    QString familyName = QString::fromLatin1("QtBidiTestFont");
    QFont font(familyName);
    font.setPixelSize(18.0);
    QCOMPARE(QFontInfo(font).family(), familyName);

    QTextLayout layout(QLatin1String("Foobar"));
    layout.setFont(font);
    layout.beginLayout();
    layout.createLine();
    layout.endLayout();

    QList<QGlyphRun> glyphRuns = layout.glyphRuns();
    QCOMPARE(glyphRuns.size(), 1);

    QGlyphRun glyphs = glyphRuns.at(0);

    QRawFont rawFont = glyphs.rawFont();
    QVERIFY(rawFont.isValid());
    QCOMPARE(rawFont.familyName(), familyName);
    QCOMPARE(rawFont.pixelSize(), 18.0);

    QVector<quint32> expectedGlyphIndices;
    expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86;

    QCOMPARE(glyphs.glyphIndexes(), expectedGlyphIndices);

    QVERIFY(fontDatabase.removeApplicationFont(id));
}
Пример #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow), device(NULL), preseed(NULL)

{
    ui->setupUi(this);

    /* Set up logging */
    logger = new Logger();
    logger->addLine("Starting OSMC installer");
    /* UI set up */
    #ifdef Q_WS_QWS
    QWSServer *server = QWSServer::instance();
    if(server)
    {
        server->setCursorVisible(false);
        server->setBackground(QBrush(Qt::black));
        this->setWindowFlags(Qt::Tool|Qt::CustomizeWindowHint);
    }
    #endif
    this->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, this->size(), qApp->desktop()->availableGeometry()));
    QFontDatabase fontDatabase;
    fontDatabase.addApplicationFont(":/assets/resources/SourceSansPro-Regular.ttf");

    /* Populate target list map */
    targetList = new TargetList();
    utils = new Utils(logger);
}
Пример #3
0
void tst_QRawFont::fromFont()
{
    QFETCH(QString, fileName);
    QFETCH(QFont::HintingPreference, hintingPreference);
    QFETCH(QString, familyName);
    QFETCH(QFontDatabase::WritingSystem, writingSystem);

    QFontDatabase fontDatabase;
    int id = fontDatabase.addApplicationFont(fileName);
    QVERIFY(id >= 0);

    QFont font(familyName);
    font.setHintingPreference(hintingPreference);
    font.setPixelSize(26.0);

    QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
    QVERIFY(rawFont.isValid());

#ifdef Q_WS_QPA
    QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort);
#endif

    QCOMPARE(rawFont.familyName(), familyName);
    QCOMPARE(rawFont.pixelSize(), 26.0);

    QVERIFY(fontDatabase.removeApplicationFont(id));
}
Пример #4
0
QFont Theme::font(const QString& name)
{
    if(!d->fontsAdded) {
        QDir fontDir(d->basePath + '/' + d->fontPath);
        QStringList entries = fontDir.entryList(QDir::Files);
        QFontDatabase db;
        Q_FOREACH(const QString &entry, entries) {
            d->addedFonts.append(db.addApplicationFont(fontDir.absoluteFilePath(entry)));
        }
Пример #5
0
Application::Application(int& _argc, char** _argv) :
	QApplication(_argc, _argv),
	m_applicationManager(0)
{
	//
	// Настроим информацию о приложении
	//
	setOrganizationName("DimkaNovikov labs.");
	setOrganizationDomain("dimkanovikov.pro");
	setApplicationName("Scenarist");
	setApplicationVersion("0.6.0 beta 6");

	//
	// Настроим стиль отображения внешнего вида приложения
	//
	setStyle(QStyleFactory::create("Fusion"));

	//
	// Загрузим шрифты в базу шрифтов программы, если их там ещё нет
	//
	QFontDatabase fontDatabase;
	fontDatabase.addApplicationFont(":/Fonts/Courier New");
	fontDatabase.addApplicationFont(":/Fonts/Courier Prime");
	fontDatabase.addApplicationFont(":/Fonts/Courier Prime Bold");
	fontDatabase.addApplicationFont(":/Fonts/Courier Prime Italic");
	fontDatabase.addApplicationFont(":/Fonts/Courier Prime Bold Italic");

	//
	// Настроим перевод приложения
	//
	initTranslation();

	//
	// Настроим таймер определения простоя приложения
	//
	m_idleTimer.setInterval(3000);
	connect(&m_idleTimer, &QTimer::timeout, [=] {
		if (m_applicationManager != 0) {
			postEvent(m_applicationManager, new QEvent(QEvent::User));
		}
	});
	m_idleTimer.start();
}
Пример #6
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    QFontDatabase fonts;
    fonts.addApplicationFont(":fonts/NEUROPOL.ttf");
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}
BabelMainWindow::BabelMainWindow(void)
	:	QMainWindow(), mCentralWidget(new QStackedWidget), mFlyer(new BabelFlyer),
		mSignup(new BabelInscription), mSetting(new BabelSetting), mMain(new BabelMain), mUpdate(new BabelUpdate)
{
	// Load and set font
    this->setWindowTitle("Studio Babel :: VOIP-Epitech 2017");
	QFontDatabase	fontDb;
	QString	openSansLightPath = "fonts/OpenSans-Light.ttf";
	if (fontDb.addApplicationFont(openSansLightPath) != -1)
	{
		QFont	openSansLightFont = fontDb.font("Open Sans Light", "Normal", -1);
		mSignup->setFont(openSansLightFont);
		mSetting->setFont(openSansLightFont);
		mMain->setFont(openSansLightFont);
	}

	// set central widget
	setCentralWidget(mCentralWidget);
	mCentralWidget->addWidget(mMain);
	mCentralWidget->addWidget(mFlyer);
	mCentralWidget->addWidget(mUpdate);
	mCentralWidget->addWidget(mSignup);
	mCentralWidget->addWidget(mSetting);
	mMain->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	mFlyer->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	mUpdate->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	mSignup->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	mSetting->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

	QObject::connect(mSetting,	SIGNAL(exit()),											this, SLOT(displayFlyer()));
	QObject::connect(mSetting,	SIGNAL(askForConnection(const QString &, int)),			this, SLOT(connectionToServer(const QString &, int)));
	QObject::connect(mSignup,	SIGNAL(exit()),											this, SLOT(displayFlyer()));
	QObject::connect(mSignup,	SIGNAL(askForRegistration(const Contact &)),			this, SLOT(createAccount(const Contact &)));
	QObject::connect(mSignup,	SIGNAL(displayInformation(const QString &)),			this, SLOT(displayInformation(const QString &)));
	QObject::connect(mFlyer,	SIGNAL(displayRegistration()),							this, SLOT(displaySignUp()));
	QObject::connect(mFlyer,	SIGNAL(displaySettings()),								this, SLOT(displayOptions()));
	QObject::connect(mFlyer,	SIGNAL(askForAuthentication(const Contact &)),			this, SLOT(connexionToAccount(const Contact &)));
	QObject::connect(mUpdate,	SIGNAL(exit()),											this, SLOT(displayHome()));
	QObject::connect(mUpdate,	SIGNAL(updateContactInfo(Contact &)),					this, SLOT(updateContactInfo(Contact &)));
	QObject::connect(mMain,		SIGNAL(addContact(const Contact &)),					this, SLOT(addNewContact(const Contact &)));
	QObject::connect(mMain,		SIGNAL(deleteContact(const Contact &)),					this, SLOT(deleteContact(const Contact &)));
	QObject::connect(mMain,		SIGNAL(sendMessage(const Contact &, const QString &)),	this, SLOT(sendMessage(const Contact &, const QString &)));
	QObject::connect(mMain,		SIGNAL(callContact(const Contact &)),					this, SLOT(callContact(const Contact &)));
	QObject::connect(mMain,		SIGNAL(closeCall(const Contact &)),						this, SLOT(closeCall(const Contact &)));
	QObject::connect(mMain,		SIGNAL(logout()),										this, SLOT(disconnectionToAccount()));
	QObject::connect(mMain,		SIGNAL(updateContactInfo()),							this, SLOT(displayUpdate()));
}
Пример #8
0
Adafruit_SSD1306::Adafruit_SSD1306(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowTitle("Adafruit OLED emulator");
    this->setFixedSize(256,128);
    this->setWindowIcon(QIcon(":/res/icon"));

    //create the buffer
    buffer = new QPixmap*[2];
    for (int i = 0; i < 2; ++i) {
        buffer[i] = new QPixmap(screenWidth,screenHeight);
        buffer[i]->fill(BLACK);
    }

    writeBuffer = buffer[0];
    dispBuffer = buffer[1];
    writeBufferID = 0;
    dispBufferID = 1;

    //initialite
    screenWidth = 128;
    screenHeight = 64;

    emulatorZoom = 2;

    cursorX = 0;
    cursorY = 0;
    textColor = BLACK;
    textSize = 1;

    //checkers
    began = false;
    initialized = false;

    speedEmultaion = true;

    //font
    QFontDatabase fontDB;
    fontDB.addApplicationFont(":/font/pixelmix");
    pixelFont.setFamily("pixelmix");
    pixelFont.setStyleStrategy(QFont::NoAntialias);
    pixelFont.setStyleHint(QFont::Monospace);
    //pixelFont.setPointSize(10);
    pixelFont.setFixedPitch(true);
    pixelFont.setPixelSize(8);
}
Пример #9
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    #ifdef Q_OS_MAC
    utils::writeLog("OSMC Installer running on Mac OS X");
    #endif
    #if defined(Q_OS_WIN32) || defined(Q_OS_WIN)
    utils::writeLog("OSMC Installer running on Windows");
    #endif
    #ifdef Q_OS_LINUX
    utils::writeLog("OSMC Installer running on Linux");
    #endif
    QFontDatabase fontDatabase;
    fontDatabase.addApplicationFont(":/assets/resources/SourceSansPro-Regular.ttf");
    MainWindow w;
    w.show();
    
    return a.exec();
}
Пример #10
0
void tst_QRawFont::unsupportedWritingSystem()
{
    QFETCH(QFont::HintingPreference, hintingPreference);

    QFontDatabase fontDatabase;
    int id = fontDatabase.addApplicationFont(QLatin1String(SRCDIR "testfont.ttf"));

    QFont font("QtBidiTestFont");
    font.setHintingPreference(hintingPreference);
    font.setPixelSize(12.0);

    QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any);
    QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
    QCOMPARE(rawFont.pixelSize(), 12.0);

    rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew);
    QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont"));
    QCOMPARE(rawFont.pixelSize(), 12.0);

    QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic);

    QTextLayout layout;
    layout.setFont(font);
    layout.setText(arabicText);
    layout.beginLayout();
    layout.createLine();
    layout.endLayout();

    QList<QGlyphRun> glyphRuns = layout.glyphRuns();
    QCOMPARE(glyphRuns.size(), 1);

    QGlyphRun glyphs = glyphRuns.at(0);
    QRawFont layoutFont = glyphs.rawFont();
    QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
    QCOMPARE(layoutFont.pixelSize(), 12.0);

    rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic);
    QCOMPARE(rawFont.familyName(), layoutFont.familyName());
    QCOMPARE(rawFont.pixelSize(), 12.0);

    fontDatabase.removeApplicationFont(id);
}
Пример #11
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("Dragly");
    QCoreApplication::setOrganizationDomain("dragly.org");
    QCoreApplication::setApplicationName("Sanntid");
#ifdef Q_OS_ANDROID
//    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, "/sdcard/.config/Dragly/Sanntid.conf");
#endif
    // IMPORTANT: This must match the Android package name for QSettings to work on Android.
    qmlRegisterType<Settings>("org.dragly.sanntid", 1, 0, "SettingsStorage");

    QGuiApplication app(argc, argv);

    QTranslator qtTranslator;
    qtTranslator.load("qt_" + QLocale::system().name(),
            QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    app.installTranslator(&qtTranslator);

    QTranslator myappTranslator;
    qDebug() << ":/sanntid_" + QLocale::system().name();
    if(!myappTranslator.load(":/sanntid_" + QLocale::system().name())) {
        qDebug() << "Failed to load translation file!";
    }
    app.installTranslator(&myappTranslator);

    qDebug() << "Current locale: " << QLocale::system();

    QQmlApplicationEngine engine(QUrl("qrc:/qml/sanntid/main.qml"));

    QFontDatabase database;
    if(!database.addApplicationFont(":/fonts/ubuntu/Ubuntu-R.ttf")) {
        qWarning() << "Could not load Ubuntu font!";
    }
    app.setFont(QFont("Ubuntu"));

//    QPixmap nullCursor(16, 16);
//    nullCursor.fill(Qt::transparent);
//    app.setOverrideCursor(QCursor(nullCursor));

    return app.exec();
}
Пример #12
0
void tst_QRawFont::fromFont()
{
    QFETCH(QString, fileName);
    QFETCH(QFont::HintingPreference, hintingPreference);
    QFETCH(QString, familyName);
    QFETCH(QFontDatabase::WritingSystem, writingSystem);

    QFontDatabase fontDatabase;
    int id = fontDatabase.addApplicationFont(fileName);
    QVERIFY(id >= 0);

    QFont font(familyName);
    font.setHintingPreference(hintingPreference);
    font.setPixelSize(26.0);

    QRawFont rawFont = QRawFont::fromFont(font, writingSystem);
    QVERIFY(rawFont.isValid());
    QCOMPARE(rawFont.familyName(), familyName);
    QCOMPARE(rawFont.pixelSize(), 26.0);

    QVERIFY(fontDatabase.removeApplicationFont(id));
}
Пример #13
0
void wFileProps::createGUI() {

	QString mimeType = getMimeType( fileName );

	QFontDatabase fdb = QFontDatabase();
	fdb.addApplicationFont( ":/fonts/ArchitectsDaughter.ttf" );
	setStyleSheet( "font-family: Architects Daughter; font-size: 10;" );

	iconLbl = new QLabel();
	iconLbl->setPixmap( getPixmap( fileName ).scaled( 64, 64, Qt::KeepAspectRatio ) );

	nameLbl = new QLabel();
	nameLbl->setText( "<b>" + QFileInfo( fileName ).fileName() + "</b>" );
	nameLbl->setFont( QFont( "Architects Daughter", 15 ) );

	linesLbl = new QLabel( lines );
	wordsLbl = new QLabel( words );
	charsLbl= new QLabel( chars );

	if ( !noFileProps ) {
		typeLbl = new QLabel( mimeType );
		sizeLbl = new QLabel( formatSize( getSize( fileName ) ) );
		locLbl = new QLabel( QFileInfo( fileName ).absolutePath() );

		time1Lbl = new QLabel( QFileInfo( fileName ).created().toString( "ddd MMM dd, yyyy hh:mm:ss" ) );
		time2Lbl = new QLabel( QFileInfo( fileName ).lastRead().toString( "ddd MMM dd, yyyy hh:mm:ss" ) );
		time3Lbl = new QLabel( QFileInfo( fileName ).lastModified().toString( "ddd MMM dd, yyyy hh:mm:ss" ) );
	}

	QPushButton *closeBtn = new QPushButton();
	closeBtn->setText( "&Close" );
	connect( closeBtn, SIGNAL( clicked() ), this, SLOT( close() ) );

	QVBoxLayout *baseLyt = new QVBoxLayout();
	QHBoxLayout *nameLyt = new QHBoxLayout();
	QFormLayout *textInfoLyt = new QFormLayout();
	QFormLayout *fileInfoLyt = new QFormLayout();
	QHBoxLayout *btnLyt = new QHBoxLayout();

	nameLyt->setAlignment( Qt::AlignCenter );
	nameLyt->addWidget( iconLbl );
	nameLyt->addWidget( nameLbl );

	textInfoLyt->addRow( new QLabel( "<b>Lines: </b>" ), linesLbl );
	textInfoLyt->addRow( new QLabel( "<b>Words: </b>" ), wordsLbl );
	textInfoLyt->addRow( new QLabel( "<b>Chars: </b>" ), charsLbl );
	textInfoLyt->setFormAlignment( Qt::AlignHCenter | Qt::AlignTop );

	if ( !noFileProps ) {
		fileInfoLyt->addRow( new QLabel( "<b>Type: </b>" ), typeLbl );
		fileInfoLyt->addRow( new QLabel( "<b>Size: </b>" ), sizeLbl );
		fileInfoLyt->addRow( new QLabel( "<b>Location: </b>" ), locLbl );
		fileInfoLyt->addRow( new QLabel( "<b>Created: </b>" ), time1Lbl );
		fileInfoLyt->addRow( new QLabel( "<b>Accessed: </b>" ), time2Lbl );
		fileInfoLyt->addRow( new QLabel( "<b>Modified: </b>" ), time3Lbl );
	}

	btnLyt->addStretch( 0 );
	btnLyt->addWidget( closeBtn );
	btnLyt->addStretch( 0 );

	QFrame *textFrame = new QFrame();
	textFrame->setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
	textFrame->setLayout( textInfoLyt );

	QFrame *fileFrame = new QFrame();
	fileFrame->setFrameStyle( QFrame::StyledPanel | QFrame::Plain );
	fileFrame->setLayout( fileInfoLyt );

	baseLyt->addLayout( nameLyt );
	baseLyt->addStretch( 0 );
	baseLyt->addWidget( textFrame );
	if ( !noFileProps ) {
		baseLyt->addStretch( 0 );
		baseLyt->addWidget( fileFrame );
	}
	baseLyt->addStretch( 0 );
	baseLyt->addLayout( btnLyt );

	setLayout( baseLyt );
};
Пример #14
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    qDebug()<<"Begin Program\n";

    QFontDatabase fontDB;
    fontDB.addApplicationFont(":/Fonts/CMR_Regular.ttf");
    fontDB.addApplicationFont(":/Fonts/CMR_Bold.ttf");
    fontDB.addApplicationFont(":/Fonts/CMR_Italic.ttf");
    fontDB.addApplicationFont(":/Fonts/CMR_BoldItalic.ttf");
    QFont CMRFont = QFont("Computer Modern Roman");
    QApplication::setFont(CMRFont);




    //Create the central widget where the other frames will be inserted
    QWidget *wdgMain = new QWidget(this);
    qDebug()<<"Widget Initaited";
    setCentralWidget(wdgMain);

    //Create the outermost Layout to divide between the table, the preview and the buttons
    //QGridLayout *mainLayout = new QGridLayout;
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->setSpacing(10);
    mainLayout->setContentsMargins(15,5,15,10);


    //The frame for the buttons is created and the ADD Record REMOVE Record and MODIFY Button are added in a QHBOX
    QFrame *frmButtons = new QFrame();
    frmButtons->setFrameStyle(QFrame::Box | QFrame::Raised);
    frmButtons->setLineWidth(1);

    //QPushButton *btnAddRecord = new QPushButton("AddRecord",frmButtons);
    btnAddRecord->setEnabled(false);
    //QPushButton *btnRemoveRecord = new QPushButton("Remove Record",frmButtons);
    btnRemoveRecord->setEnabled(false);
    //QPushButton *btnModifyRecord = new QPushButton("Modify Record",frmButtons);
    btnModifyRecord->setEnabled(false);
    //QPushButton *btnPrint = new QPushButton("Export",frmButtons);
    btnPrint->setEnabled(false);

    QHBoxLayout *btnLayout = new QHBoxLayout;
    btnLayout->addWidget(btnAddRecord);
    btnLayout->addWidget(btnRemoveRecord);
    btnLayout->addWidget(btnModifyRecord);
    btnLayout->addWidget(btnPrint);
    frmButtons->setLayout(btnLayout);

    //The frame for the preview is created



    frmPreview->setLayout(prwLayout);


    //The Table viewer is created without grid and is added to the main layout
    dbTableView=new QTableView(this);
    dbTableView->setShowGrid(false);
    dbTableView->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
    //mainLayout->addWidget(dbTableView,0,0,5,4);
    //The left frame is created and the table and button frames are added
    QVBoxLayout *lftLayout = new QVBoxLayout;
    lftLayout->addWidget(dbTableView);
    lftLayout->addWidget(frmButtons);
    //The main layout is created by adding the left layout and the preview widget
    mainLayout->addLayout(lftLayout);
    mainLayout->addWidget(scrPreview);

    //A value is given to the database and a connetion is made using the custom CreatConnection
    //dbName="/Users/Castro/Documents/Svago/Programmazione/Qt/database/movies.sqlite";
    //CreateConnection(dbName); //Go to method, return bool
    //QSqlQuery querytest (q.createUpdate("Main_table",Update,Where),db);




    //Ther preview frame is populated with the labeled text
    //preview field is enabeled in order to navigate throught he preview fields array

    //The scroll area is set to a fixed width wich allowes to view the whole contents without scrolling to the side
    frmPreview->setMinimumWidth(prwLayout->sizeHint().width());
    scrPreview->setWidget(frmPreview);
    scrPreview->setFixedWidth(frmPreview->width()+20);

    wdgMain->setLayout(mainLayout);
    wdgMain->show();
    createActions();
    createMenu();
    //The table view signal "current changed" is connected to the slot which changes the selected record
    //connect(dbTableView->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            //SLOT(currentSelectionChanged(const QModelIndex &)));
    connect(dbTableView,SIGNAL(doubleClicked(QModelIndex)),SLOT(recordDoubleClicked(const QModelIndex)));
    connect(dbmodel, SIGNAL(modelReset()), this, SLOT(modelHasReset()));
    connect(dbmodel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), this, SLOT(dataChangeEmitted()));
    //connect(dbmodel,SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInsertedEmitted(QModelIndex,int,int)));
    connect(btnAddRecord,SIGNAL(clicked()),SLOT(createNewRecord()));
    connect(btnRemoveRecord,SIGNAL(clicked()),SLOT(deleteRecord()));
    connect(btnModifyRecord,SIGNAL(clicked()),SLOT(updateRecord()));
    connect(btnPrint,SIGNAL(clicked()),this,SLOT(printRecord()));

    QDesktopWidget dw;
    QRect dwRect = dw.availableGeometry(this);
            //dw.availablegeometry(this);

    resize(dwRect.size()*0.7);
    //QRect mwRect = this->geometry();
    move(0.15*dwRect.width(),0.15*dwRect.height());


}
Пример #15
0
int main(int argc, char *argv[])
{
    QFile logfile2("C:/i8910tuninglog.txt");
    QTextStream log2(&logfile2);
    if (!logfile2.open(QIODevice::Append | QIODevice::WriteOnly)) return 1;
#ifdef Q_OS_SYMBIAN
    QApplication::setGraphicsSystem("openvg");
#endif

    QApplication app(argc, argv);

#ifdef Q_OS_SYMBIAN

    //LEAVES IF E: DRIVE IS BUSY (I.E. PHONE IS PLUGGED IN USB MASS STORAGE MODE)
    RFs fsSession;
    CleanupClosePushL(fsSession);
    User::LeaveIfError(fsSession.Connect());
    TVolumeInfo volumeInfo;
    TInt err=fsSession.Volume(volumeInfo,EDriveE);
    if (err==KErrNotReady)
    {
        fsSession.Close();
        CleanupStack::PopAndDestroy();
        QPixmap pixmap(":/images/exitsplash.png");
        QSplashScreen splash(pixmap);
        splash.showFullScreen();
        User::After(5000000);
        app.quit();
    }
    fsSession.Close();
    CleanupStack::PopAndDestroy();
#endif

    QPixmap pixmap(":/images/splashscreen.png");
    QSplashScreen splash(pixmap);
    splash.showFullScreen();


    QFontDatabase fontdb;
    int bella = fontdb.addApplicationFont("E:/data/SymbianTuning/SegoeWP.ttf");
    qDebug() << QString::number(bella);
    QFont fontnew = fontdb.font("Segoe WP", "Normal", 7);
    app.setFont(fontnew);

    QDeclarativeView view;
#ifdef Q_OS_SYMBIAN
    //view.setAttribute(Qt::WA_NoSystemBackground);
#endif

    view.rootContext()->setContextProperty("i8910tuning", new i8910tuning(0, &logfile2, &log2));
    view.setSource(QUrl("qrc:/Page.qml"));

    QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit()));


#ifdef Q_OS_SYMBIAN
    CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
    TRAPD(error,
          if (appUi) {
          // Lock application orientation into landscape
          appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
}
);