コード例 #1
0
ファイル: about.cpp プロジェクト: pnkfelix/glx-gle
QWidget* AboutBox::createLicensePanel()
{
	// Create a label to display readme.txt
	QTextEdit* label = new QTextEdit();
	label->setReadOnly(true);
	QString fileName(QString::fromUtf8(m_gleInterface->getManualLocation().c_str()));
	fileName.resize(fileName.lastIndexOf(QDir::separator()));
	fileName += QDir::separator();
	fileName += tr("LICENSE.txt");
   GLEInterface* iface = GLEGetInterfacePointer();
   std::string licenseFileTxt;
   bool res = iface->readFileOrGZIPTxt(fileName.toUtf8().constData(), &licenseFileTxt);
   if (res) {
		QFont font;
		// Set the font to be fixed pitch
		font.setFixedPitch(true);
		font.setFamily("Courier");
      font.setStretch(QFont::Condensed);
		label->setLineWrapMode(QTextEdit::NoWrap);
		label->setFont(font);
		label->setTextColor(Qt::black);
		// Get the text and put it in the label
		label->setPlainText(licenseFileTxt.c_str());
		QFontMetrics fm(font);
		m_minWidth = fm.width("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
	} else {
		label->setPlainText(tr("File not found: '%1'").arg(fileName));
	}
	return label;
}
コード例 #2
0
JulyUrl::JulyUrl(QWidget *parent, int x, int y, int w, int h, QString link)
	: QLabel(parent)
{
	startRect=QRect(x,y,w,h);
	setGeometry(startRect);
	zoomTimer = new QTimer(this);
	connect(zoomTimer,SIGNAL(timeout()),this,SLOT(zoom()));
	udNormalFont=0;
	isAnimating=false;
	add=2;
	text=link;;
	QFont font;
	font.setFamily("Arial");
	font.setPixelSize(46);
	font.setStretch(60);
	double textWidth=QFontMetrics(font).width(link);
	pixmap1 = QPixmap(400,100);
	pixmap1.fill(Qt::transparent);
	QPainter painter(&pixmap1);
	painter.setPen(Qt::blue);
	painter.setFont(font);
	painter.drawText(QRectF(0,0,400,100),Qt::AlignCenter,text);
	pixmap2=pixmap1;
	QPixmap line(textWidth,4);
	line.fill(Qt::blue);
	painter.drawPixmap((400-textWidth)/2,84,line);
	setPixmap(pixmap1);
	notPressing=true;
	setScaledContents(true);	
}
コード例 #3
0
  /*!
     * \class TextCursorChangeFontStretch
   * \author Anders Fernström
   * \date 2005-11-03
   * \date 2005-11-04 (update)
     *
     * \brief Command for changing font stretch
   *
   * 2005-11-04 AF, implemented the function
     */
  void TextCursorChangeFontStretch::execute()
  {
    QTextCursor cursor( document()->getCursor()->currentCell()->textCursor() );
    if( !cursor.isNull() )
    {
      QTextCharFormat format = cursor.charFormat();
      QFont font = format.font();

      int oldStretch = font.stretch();
      if( oldStretch != stretch_ )
      {
        font.setStretch( stretch_ );
        format.setFont( font );

        cursor.mergeCharFormat ( format );

        if( oldStretch == cursor.charFormat().font().stretch() )
        {
          // 2006-01-30 AF, add message box
          QString msg = "QT was unable to stretch the font";
          QMessageBox::warning( 0, "Warning", msg, "OK" );
        }
      }
    }

  }
コード例 #4
0
void radeon_profile::addRuntimeWidgets() {
    // add button for manual refresh glx info, connectors, mod params
    QPushButton *refreshBtn = new QPushButton();
    refreshBtn->setIcon(QIcon(":/icon/symbols/refresh.png"));
    ui->tabs_systemInfo->setCornerWidget(refreshBtn);
    refreshBtn->setIconSize(QSize(20,20));
    refreshBtn->show();
    connect(refreshBtn,SIGNAL(clicked()),this,SLOT(refreshBtnClicked()));

    ui->label_version->setText(tr("version %n", NULL, appVersion));

    // version label
    QLabel *l = new QLabel("v. " +QString().setNum(appVersion),this);
    QFont f;
    f.setStretch(QFont::Unstretched);
    f.setWeight(QFont::Bold);
    f.setPointSize(8);
    l->setFont(f);
    ui->mainTabs->setCornerWidget(l,Qt::BottomRightCorner);
    l->show();

    // button on exec pages
    QPushButton *btnBackProfiles = new QPushButton();
    btnBackProfiles->setText(tr("Back to profiles"));
    ui->tabs_execOutputs->setCornerWidget(btnBackProfiles);
    btnBackProfiles->show();
    connect(btnBackProfiles,SIGNAL(clicked()),this,SLOT(btnBackToProfilesClicked()));

    // set pwm buttons in group
    QButtonGroup *pwmGroup = new QButtonGroup();
    pwmGroup->addButton(ui->btn_pwmAuto);
    pwmGroup->addButton(ui->btn_pwmFixed);
    pwmGroup->addButton(ui->btn_pwmProfile);
}
コード例 #5
0
static QFont PothosPlotTitleFont(void)
{
    QFont f;
    f.setPointSize(8);
    f.setWeight(QFont::Bold);
    f.setStretch(QFont::SemiExpanded);
    return f;
}
コード例 #6
0
/***********************************************************************
 * Custom Fonts for styling
 **********************************************************************/
static QFont PothosPlotAxisFont(void)
{
    QFont f;
    f.setPointSize(7);
    f.setWeight(QFont::Normal);
    f.setStretch(QFont::SemiCondensed);
    return f;
}
コード例 #7
0
void QToasterBrowserLCD::setFonts()
{
  QFont font;
  font.setFamily(QStringLiteral("Ubuntu"));

  font.setStretch(95);
  font.setWeight(QFont::Bold);
  font.setPixelSize(13);
  ui->bassLabel->setFont(font);
  ui->middleLabel->setFont(font);
  ui->trebleLabel->setFont(font);
  ui->presenceLabel->setFont(font);

  font.setPixelSize(11);
  ui->rigAuthorEdit->setFont(font);

  font.setPixelSize(10);
  ui->browserViewComboBox->setFont(font);

  font.setWeight(QFont::Normal);
  font.setStretch(QFont::Unstretched);
  ui->bassValueLabel->setFont(font);
  ui->middleValueLabel->setFont(font);
  ui->trebleValueLabel->setFont(font);
  ui->presenceValueLabel->setFont(font);
  ui->ampNameEdit->setFont(font);
  ui->rigTypeEdit->setFont(font);

  font.setWeight(QFont::Light);
  font.setStretch(92);
  ui->stompAEdit->setFont(font);
  ui->stompBEdit->setFont(font);
  ui->stompCEdit->setFont(font);
  ui->stompDEdit->setFont(font);
  ui->stompXEdit->setFont(font);
  ui->stompModEdit->setFont(font);
  ui->delayEdit->setFont(font);
  ui->reverbEdit->setFont(font);

  font.setWeight(QFont::Bold);
  font.setPixelSize(22);
  font.setStretch(QFont::Unstretched);
  ui->rigNameEdit->setFont(font);
}
コード例 #8
0
ファイル: widget.cpp プロジェクト: ptrxyz/twmn
void Widget::setupFont()
{
    Message& m = m_messageQueue.front();
    QFont font;
    QString name = m.data["fn"]->toString();
    // Trick to detect a font in XFD format.
    if (name.count('-') >= 4)
        font.setRawName(name);
    else {
        font.setPixelSize(m.data["fs"]->toInt());
        font.setFamily(name);
    }
    QString ss( m.data["fv"]->toString() );
    if (ss == "oblique")
		font.setStyle( QFont::StyleOblique );
	else if (ss == "italic")
		font.setStyle( QFont::StyleItalic );
	else if (ss == "ultra-light")
		font.setWeight( 13 );
	else if (ss == "light")
		font.setWeight( QFont::Light );
	else if (ss == "medium")
		font.setWeight( 50 );
	else if (ss == "semi-bold")
		font.setWeight( QFont::DemiBold );
	else if (ss == "bold")
		font.setWeight( QFont::Bold );
	else if (ss == "ultra-bold")
		font.setWeight( QFont::Black );
	else if (ss == "heavy")
		font.setWeight( 99 );
	else if (ss == "ultra-condensed")
		font.setStretch( QFont::UltraCondensed );
	else if (ss == "extra-condensed")
		font.setStretch( QFont::ExtraCondensed );
	else if (ss == "condensed")
		font.setStretch( QFont::Condensed );
	else if (ss == "semi-condensed")
		font.setStretch( QFont::SemiCondensed );
	else if (ss == "semi-expanded")
		font.setStretch( QFont::SemiExpanded );
	else if (ss == "expanded")
		font.setStretch( QFont::Expanded );
	else if (ss == "extra-expanded")
		font.setStretch( QFont::ExtraExpanded );
	else if (ss == "ultra-expanded")
		font.setStretch( QFont::UltraExpanded );
    QApplication::setFont(font);
}
コード例 #9
0
ファイル: options.cpp プロジェクト: f0x/kcd
void Options::updateAlbumTitle(QString title)
{
   Plasma::Theme *theme = Plasma::Theme::defaultTheme();
   QFont font = theme->font(Plasma::Theme::DefaultFont);
   QFontMetricsF fm(font);
   kDebug() << title;
   m_albumText->setText(fm.elidedText(title, Qt::ElideMiddle, m_albumText->size().width()));
   
   font.setBold(true);
   font.setItalic(true);
   font.setStretch(110);
   m_albumText->nativeWidget()->setFont(font);
   //m_albumText->setText(title);
}
コード例 #10
0
void tst_QFont::resolve()
{
    QFont font;
    font.setPointSize(font.pointSize() * 2);
    font.setItalic(false);
    font.setWeight(QFont::Normal);
    font.setUnderline(false);
    font.setStrikeOut(false);
    font.setOverline(false);
    font.setStretch(QFont::Unstretched);

    QFont font1;
    font1.setWeight(QFont::Bold);
    QFont font2 = font1.resolve(font);

    QVERIFY(font2.weight() == font1.weight());

    QVERIFY(font2.pointSize() == font.pointSize());
    QVERIFY(font2.italic() == font.italic());
    QVERIFY(font2.underline() == font.underline());
    QVERIFY(font2.overline() == font.overline());
    QVERIFY(font2.strikeOut() == font.strikeOut());
    QVERIFY(font2.stretch() == font.stretch());

    QFont font3;
    font3.setStretch(QFont::UltraCondensed);
    QFont font4 = font3.resolve(font1).resolve(font);

    QVERIFY(font4.stretch() == font3.stretch());

    QVERIFY(font4.weight() == font.weight());
    QVERIFY(font4.pointSize() == font.pointSize());
    QVERIFY(font4.italic() == font.italic());
    QVERIFY(font4.underline() == font.underline());
    QVERIFY(font4.overline() == font.overline());
    QVERIFY(font4.strikeOut() == font.strikeOut());


    QFont f1,f2,f3;
    f2.setPointSize(45);
    f3.setPointSize(55);

    QFont f4 = f1.resolve(f2);
    QCOMPARE(f4.pointSize(), 45);
    f4 = f4.resolve(f3);
    QCOMPARE(f4.pointSize(), 55);
}
コード例 #11
0
ファイル: ChannelsWidgets.cpp プロジェクト: LiveMix/LiveMix
QLabel* InfoWidget::createLabel(int p_iHeight, ElementType p_eType, QString p_rRefChannel)
{
    QLabel *lab = new QLabel(m_pMatrix->getMediumDisplayFunction(IN, "", p_eType, p_rRefChannel, true));
    lab->setToolTip(m_pMatrix->getDisplayFunction(IN, "", p_eType, p_rRefChannel, true));
    lab->setWordWrap(true);
    QFont font;
    font.setPixelSize(11);
    font.setStretch(QFont::SemiCondensed);
    lab->setFont(font);

    if (!m_rLabels.contains(p_eType)) {
        m_rLabels.insert(p_eType, new QMap<QString, QLabel*>);
    }
    m_rLabels[p_eType]->insert(p_rRefChannel, lab);
    lab->setFixedSize(INFO_WIDTH, p_iHeight);
    if (!m_pMatrix->isVisible(p_eType, p_rRefChannel)) {
        lab->setVisible(false);
    }
    return lab;
}
コード例 #12
0
ファイル: HomeScreen.cpp プロジェクト: efcheong/kinetris
void HomeScreen::initSprite()
{
	_sprite = new QGraphicsWidget();

	QGraphicsItem* item;
	QGraphicsSimpleTextItem* text;
	QGraphicsProxyWidget* proxy;
	QLabel* label;
	QFont font;

	item = new QGraphicsPixmapItem();
	item->setParentItem(_sprite);
	item->setPos((BACKGROUND_W - (400.0f / 0.75f)) * 0.5f, BACKGROUND_H - 400.0f);
	_avatar = static_cast<QGraphicsPixmapItem*>(item);

	item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_TITLE));
	item->setParentItem(_sprite);
	item->setPos(232.0f, 128.0f);

	font = QFont("Arial");
	font.setPixelSize(12);
	font.setWeight(QFont::Normal);
	font.setStretch(80);

	text = new QGraphicsSimpleTextItem("http://conanchen.com/Kinetris");
	text->setBrush(QColor::fromRgb(0xFF, 0xFF, 0xFF));
	text->setFont(font);
	text->setParentItem(_sprite);
	text->setPos(248.0f, 264.0f - 3.0f);

	label = new QLabel();
	label->resize(784, 24);
	label->setStyleSheet("background-color: transparent; color: #FFFFFF;");
	label->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
	proxy = new QGraphicsProxyWidget();
	proxy->setParentItem(_sprite);
	proxy->setWidget(label);
	proxy->setPos(248.0f, 592.0f - 6.0f);
	_sprite_status = proxy;
	_status = label;
}
コード例 #13
0
ファイル: mythuihelper.cpp プロジェクト: chadparry/mythtv
/**
 * Apply any user overrides to the screen geometry
 */
void MythUIHelperPrivate::StoreGUIsettings()
{
    if (x_override >= 0 && y_override >= 0)
    {
        GetMythDB()->OverrideSettingForSession("GuiOffsetX", QString::number(x_override));
        GetMythDB()->OverrideSettingForSession("GuiOffsetY", QString::number(y_override));
    }

    if (w_override > 0 && h_override > 0)
    {
        GetMythDB()->OverrideSettingForSession("GuiWidth", QString::number(w_override));
        GetMythDB()->OverrideSettingForSession("GuiHeight", QString::number(h_override));
    }

    m_screenxbase  = GetMythDB()->GetNumSetting("GuiOffsetX");
    m_screenybase  = GetMythDB()->GetNumSetting("GuiOffsetY");

    m_screenwidth = m_screenheight = 0;
    GetMythDB()->GetResolutionSetting("Gui", m_screenwidth, m_screenheight);

    // If any of these was _not_ set by the user,
    // (i.e. they are 0) use the whole-screen defaults

    if (!m_screenxbase)
        m_screenxbase = m_xbase;

    if (!m_screenybase)
        m_screenybase = m_ybase;

    if (!m_screenwidth)
        m_screenwidth = m_width;

    if (!m_screenheight)
        m_screenheight = m_height;

    if (m_screenheight < 160 || m_screenwidth < 160)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC +
            "Somehow, your screen size settings are bad.\n\t\t\t" +
            QString("GuiResolution: %1\n\t\t\t")
            .arg(GetMythDB()->GetSetting("GuiResolution")) +
            QString("  old GuiWidth: %1\n\t\t\t")
            .arg(GetMythDB()->GetNumSetting("GuiWidth")) +
            QString("  old GuiHeight: %1\n\t\t\t")
            .arg(GetMythDB()->GetNumSetting("GuiHeight")) +
            QString("m_width: %1").arg(m_width) +
            QString("m_height: %1\n\t\t\t").arg(m_height) +
            "Falling back to 640x480");

        m_screenwidth  = 640;
        m_screenheight = 480;
    }

    m_wmult = m_screenwidth  / (float)m_baseWidth;
    m_hmult = m_screenheight / (float)m_baseHeight;

    // Default font, _ALL_ fonts inherit from this!
    // e.g All fonts will be 19 pixels unless a new size is explicitly defined.
    QFont font = QFont("Arial");

    if (!font.exactMatch())
        font = QFont();

    font.setStyleHint(QFont::SansSerif, QFont::PreferAntialias);
    font.setPixelSize((int)((19.0f * m_hmult) + 0.5f));
    int stretch = (int)(100 / GetPixelAspectRatio());
    font.setStretch(stretch); // QT
    m_fontStretch = stretch; // MythUI

    QApplication::setFont(font);
}
コード例 #14
0
void tst_QFont::serialize_data()
{
    QTest::addColumn<QFont>("font");
    // The version in which the tested feature was added.
    QTest::addColumn<QDataStream::Version>("minimumStreamVersion");

    QFont basicFont;
    // Versions <= Qt 2.1 had broken point size serialization,
    // so we set an integer point size.
    basicFont.setPointSize(9);
    // Versions <= Qt 5.4 didn't serialize styleName, so clear it
    basicFont.setStyleName(QString());

    QFont font = basicFont;
    QTest::newRow("defaultConstructed") << font << QDataStream::Qt_1_0;

    font.setLetterSpacing(QFont::AbsoluteSpacing, 105);
    QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5;

    font = basicFont;
    font.setWordSpacing(50.0);
    QTest::newRow("wordSpacing") << font << QDataStream::Qt_4_5;

    font = basicFont;
    font.setPointSize(20);
    QTest::newRow("pointSize") << font << QDataStream::Qt_1_0;

    font = basicFont;
    font.setPixelSize(32);
    QTest::newRow("pixelSize") << font << QDataStream::Qt_3_0;

    font = basicFont;
    font.setStyleHint(QFont::Monospace);
    QTest::newRow("styleHint") << font << QDataStream::Qt_1_0;

    font = basicFont;
    font.setStretch(4000);
    QTest::newRow("stretch") << font << QDataStream::Qt_4_3;

    font = basicFont;
    font.setWeight(99);
    QTest::newRow("weight") << font << QDataStream::Qt_1_0;

    font = basicFont;
    font.setUnderline(true);
    QTest::newRow("underline") << font << QDataStream::Qt_1_0;

    font = basicFont;
    font.setStrikeOut(true);
    QTest::newRow("strikeOut") << font << QDataStream::Qt_1_0;

    font = basicFont;
    font.setFixedPitch(true);
    // This fails for versions less than this, as ignorePitch is set to false
    // whenever setFixedPitch() is called, but ignorePitch is considered an
    // extended bit, which were apparently not available until 4.4.
    QTest::newRow("fixedPitch") << font << QDataStream::Qt_4_4;

    font = basicFont;
    font.setLetterSpacing(QFont::AbsoluteSpacing, 10);
    // Fails for 4.4 because letterSpacing wasn't read until 4.5.
    QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5;

    font = basicFont;
    font.setKerning(false);
    QTest::newRow("kerning") << font << QDataStream::Qt_4_0;

    font = basicFont;
    font.setStyleStrategy(QFont::NoFontMerging);
    // This wasn't read properly until 5.4.
    QTest::newRow("styleStrategy") << font << QDataStream::Qt_5_4;

    font = basicFont;
    font.setHintingPreference(QFont::PreferFullHinting);
    // This wasn't read until 5.4.
    QTest::newRow("hintingPreference") << font << QDataStream::Qt_5_4;

    font = basicFont;
    font.setStyleName("Regular Black Condensed");
    // This wasn't read until 5.4.
    QTest::newRow("styleName") << font << QDataStream::Qt_5_4;

    font = basicFont;
    font.setCapitalization(QFont::AllUppercase);
    // This wasn't read until 5.6.
    QTest::newRow("capitalization") << font << QDataStream::Qt_5_6;
}
コード例 #15
0
ファイル: VisualMatrix.cpp プロジェクト: efcheong/kinetris
void VisualMatrix::initSprite()
{
	_sprite = new QGraphicsWidget();

	QGraphicsItem* item;
	QGraphicsWidget* widget;
	QGraphicsRectItem* rect;
	QGraphicsColorizeEffect* effect;
	QGraphicsSimpleTextItem* text;
	QGraphicsProxyWidget* proxy;
	QLabel* label;
	QFont font;

	// Frame
	{
		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_FRAME_BG));
		item->setParentItem(_sprite);
		item->setPos(0.0f, 0.0f);
	}

	// Frame
	{
		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_FRAME_MG));
		item->setParentItem(_sprite);
		item->setPos(0.0f, 0.0f);
	}

	// Avatar
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		widget->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
		widget->setParentItem(_sprite);
		widget->setPos(170.0f, 50.0f);
		
		item = new QGraphicsPixmapItem();
		item->setParentItem(widget);
		item->setPos(((BLOCK_LARGE * 10) - (320.0f / 0.75f)) * 0.5f, (BLOCK_LARGE * 20) - 320.0f);
		
		_avatar = widget;
	}

	// Help
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		widget->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
		widget->setParentItem(_sprite);
		widget->setPos(170.0f, 50.0f);
		
		rect = new QGraphicsRectItem(0.0f, 0.0f, BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		rect->setBrush(QBrush(QColor::fromRgb(0x00, 0x00, 0x00, 0xC0)));
		rect->setParentItem(widget);
		
		font = QApplication::font();
		font.setFamily("Arial");
		font.setPixelSize(16);
		font.setWeight(QFont::Bold);
		font.setStretch(80);
		
		text = new QGraphicsSimpleTextItem(tr("Slide left and right: Move."));
		text->setBrush(QColor::fromRgb(0xC0, 0xC0, 0xC0));
		text->setFont(font);
		text->setParentItem(widget);
		text->setPos(((BLOCK_LARGE * 10) - text->boundingRect().width()) * 0.5f, 217.0f - 6.0f);
		
		text = new QGraphicsSimpleTextItem(tr("Swipe up: Hold.  Swipe down: Drop."));
		text->setBrush(QColor::fromRgb(0xC0, 0xC0, 0xC0));
		text->setFont(font);
		text->setParentItem(widget);
		text->setPos(((BLOCK_LARGE * 10) - text->boundingRect().width()) * 0.5f, 237.0f - 6.0f);
		
		text = new QGraphicsSimpleTextItem(tr("Pull back, and make circles: Rotate."));
		text->setBrush(QColor::fromRgb(0xC0, 0xC0, 0xC0));
		text->setFont(font);
		text->setParentItem(widget);
		text->setPos(((BLOCK_LARGE * 10) - text->boundingRect().width()) * 0.5f, 257.0f - 6.0f);

//		widget->setVisible(false);
		
		_sprite_help = widget;
	}

	// Lines
	{
		rect = new QGraphicsRectItem(120.0f - 1.0f, 220.0f - 1.0f, 8.0f + 2.0f, 144.0f + 2.0f);
		rect->setBrush(QBrush(LoaderThread::instance()->getCachedPixmap(IMAGE_LINES_PROGRESS)));
		rect->setParentItem(_sprite);

		_sprite_lines = rect;
	}

	// Frame
	{
		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_FRAME_FG));
		item->setParentItem(_sprite);
		item->setPos(0.0f, 0.0f);
	}

	// Field
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		widget->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
		widget->setParentItem(_sprite);
		widget->setPos(170.0f, 50.0f);
		
		_sprite_field = widget;

		_sprite_space.fill(NULL, _rows * _cols);
	}

	// Ghost
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 4);
		widget->setParentItem(_sprite_field);
		widget->setPos(BLOCK_LARGE * getShapePositionInField(18, 3));
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_BLOCK_GHOST));
			item->setParentItem(widget);
		}
	
		_sprite_ghost = widget;
	}

	// Tetromino
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 4);
		widget->setParentItem(_sprite_field);
		widget->setPos(BLOCK_LARGE * getShapePositionInField(18, 3));
		widget->setZValue(1.0f);
		
		effect = new QGraphicsColorizeEffect(widget);
		effect->setColor(QColor::fromRgb(0xFF, 0xFF, 0xFF));
		effect->setStrength(0.0f);
		widget->setGraphicsEffect(effect);
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem();
			item->setParentItem(widget);
		}
		
		_sprite_tetromino = widget;
	}

	// Hold
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 2);
		widget->setScale(BLOCK_SMALL / BLOCK_LARGE);
		widget->setParentItem(_sprite);
		widget->setPos(56.0f, 108.0f + BLOCK_SMALL);
		
		effect = new QGraphicsColorizeEffect(widget);
		effect->setColor(QColor::fromRgb(0xFF, 0xFF, 0xFF));
		effect->setStrength(0.0f);
		widget->setGraphicsEffect(effect);
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem();
			item->setParentItem(widget);
		}
		
		_sprite_hold = widget;
	}

	// Hold fail
	{
		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_FAIL));
		item->setScale(BLOCK_SMALL / BLOCK_LARGE);
		item->setParentItem(_sprite);
		item->setPos(56.0f + (BLOCK_SMALL * 3), 108.0f + (BLOCK_SMALL * 3));
		item->setVisible(false);
	
		_sprite_holdFail = item;
	}

	// Next
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 2);
		widget->setScale(BLOCK_SMALL / BLOCK_LARGE);
		widget->setParentItem(_sprite);
		widget->setPos(460.0f, 108.0f + BLOCK_SMALL);
		
		effect = new QGraphicsColorizeEffect(widget);
		effect->setColor(QColor::fromRgb(0xFF, 0xFF, 0xFF));
		effect->setStrength(0.0f);
		widget->setGraphicsEffect(effect);
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem();
			item->setParentItem(widget);
		}
	
		_sprite_next << widget;
	}

	// Next
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 2);
		widget->setScale(BLOCK_SMALL / BLOCK_LARGE);
		widget->setParentItem(_sprite);
		widget->setPos(460.0f, 228.0f + BLOCK_SMALL);
		
		effect = new QGraphicsColorizeEffect(widget);
		effect->setColor(QColor::fromRgb(0xFF, 0xFF, 0xFF));
		effect->setStrength(0.0f);
		widget->setGraphicsEffect(effect);
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem();
			item->setParentItem(widget);
		}
	
		_sprite_next << widget;
	}

	// Next
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 4, BLOCK_LARGE * 2);
		widget->setScale(BLOCK_SMALL / BLOCK_LARGE);
		widget->setParentItem(_sprite);
		widget->setPos(460.0f, 292.0f + BLOCK_SMALL);
		
		effect = new QGraphicsColorizeEffect(widget);
		effect->setColor(QColor::fromRgb(0xFF, 0xFF, 0xFF));
		effect->setStrength(0.0f);
		widget->setGraphicsEffect(effect);
		
		for (int i = 0; i < 4; ++i)
		{
			item = new QGraphicsPixmapItem();
			item->setParentItem(widget);
		}
		
		_sprite_next << widget;
	}

	// Font
	{
		font = QApplication::font();
		font.setCapitalization(QFont::AllUppercase);
	}

	// Hold
	{
		text = new QGraphicsSimpleTextItem(tr("Hold"));
		text->setBrush(QColor::fromRgb(0x00, 0x00, 0x00));
		text->setFont(font);
		text->setParentItem(_sprite);
		text->setPos(56.0f, 80.0f - 6.0f);
	}

	// Next
	{
		text = new QGraphicsSimpleTextItem(tr("Next"));
		text->setBrush(QColor::fromRgb(0x00, 0x00, 0x00));
		text->setFont(font);
		text->setParentItem(_sprite);
		text->setPos(526.0f - text->boundingRect().width(), 80.0f - 6.0f);
	}

	// Level
	{
		text = new QGraphicsSimpleTextItem(tr("Level"));
		text->setBrush(QColor::fromRgb(0x00, 0x00, 0x00));
		text->setFont(font);
		text->setParentItem(_sprite);
		text->setPos(56.0f, 316.0f - 6.0f);
	}

	// Level
	{
		label = new QLabel();
		label->resize(48, 24);
		label->setStyleSheet("background-color: transparent; color: #FFFFFF;");
		label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
		
		proxy = new QGraphicsProxyWidget();
		proxy->setParentItem(_sprite);
		proxy->setWidget(label);
		proxy->setPos(56.0f, 344.0f - 6.0f);
	
		_sprite_level = label;
	}

	// Score
	{
		text = new QGraphicsSimpleTextItem(tr("Score"));
		text->setBrush(QColor::fromRgb(0x00, 0x00, 0x00));
		text->setFont(font);
		text->setParentItem(_sprite);
		text->setPos(176.0f, 564.0f - 6.0f);
	}

	// Score
	{
		label = new QLabel();
		label->resize(148, 24);
		label->setStyleSheet("background-color: transparent; color: #FFFFFF;");
		label->setAlignment(Qt::AlignTop | Qt::AlignRight);
		
		proxy = new QGraphicsProxyWidget();
		proxy->setParentItem(_sprite);
		proxy->setWidget(label);
		proxy->setPos(256.0f, 564.0f - 6.0f);
		
		_sprite_score = label;
	}

	// Countdown
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		widget->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
		widget->setParentItem(_sprite);
		widget->setPos(170.0f, 50.0f);

		rect = new QGraphicsRectItem(0.0f, 0.0f, BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		rect->setBrush(QBrush(QColor::fromRgb(0x00, 0x00, 0x00, 0xC0)));
		rect->setParentItem(widget);

		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_COUNT[0]));
		item->setParentItem(widget);
		item->setPos(77.0f, 197.0f);
		item->setVisible(false);
		_sprite_count << item;

		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_COUNT[1]));
		item->setParentItem(widget);
		item->setPos(77.0f, 197.0f);
		item->setVisible(false);
		_sprite_count << item;

		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_COUNT[2]));
		item->setParentItem(widget);
		item->setPos(77.0f, 197.0f);
		item->setVisible(false);
		_sprite_count << item;

		widget->setVisible(false);
		
		_sprite_countdown = widget;
	}

	// Game over
	{
		widget = new QGraphicsWidget();
		widget->resize(BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		widget->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
		widget->setParentItem(_sprite);
		widget->setPos(170.0f, 50.0f);
		widget->setZValue(8.0f);
		
		rect = new QGraphicsRectItem(0.0f, 0.0f, BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		rect->setBrush(QBrush(QColor::fromRgb(0x00, 0x00, 0x00, 0xC0)));
		rect->setParentItem(widget);
		
		item = new QGraphicsPixmapItem(LoaderThread::instance()->getCachedPixmap(IMAGE_OVER));
		item->setParentItem(widget);
		item->setPos(4.0f, 172.0f);
		
		rect = new QGraphicsRectItem(0.0f, 0.0f, BLOCK_LARGE * 10, BLOCK_LARGE * 20);
		rect->setBrush(QBrush(QColor::fromRgb(0xFF, 0xFF, 0xFF)));
		rect->setParentItem(widget);
		_sprite_overFlash = rect;
		
		widget->setVisible(false);
		
		_sprite_over = widget;
	}
}
コード例 #16
0
ファイル: keypadwidget.cpp プロジェクト: alberthdev/CEmu
void KeypadWidget::setType(bool is83, unsigned color_scheme) {
    QColor c_center;
    QColor c_sides;
    QColor c_num, c_text, c_other, c_graph;

    curr_color = color_scheme;

    c_num   = QColor::fromRgb(0xeeeeee);
    c_text  = QColor::fromRgb(0xeeeeee);
    c_other = QColor::fromRgb(0x1d1d1d);
    c_graph = QColor::fromRgb(0xeeeeee);

    switch(color_scheme) {
        default:
        case KEYPAD_BLACK:
            c_center = QColor::fromRgb(0x191919);
            c_sides  = QColor::fromRgb(0x3b3b3b);
            break;
        case KEYPAD_WHITE:
            c_center = QColor::fromRgb(0xe8e8e8);
            c_sides  = QColor::fromRgb(0xc4c4c4);
            c_num    = QColor::fromRgb(0x707880);
            c_text   = QColor::fromRgb(0x222222);
            c_other  = QColor::fromRgb(0xc0c0c0);
            break;
        case KEYPAD_TRUE_BLUE:
            c_center = QColor::fromRgb(0x385E9D);
            c_sides  = c_center.lighter(130);
            c_num    = QColor::fromRgb(0xdedede);
            c_other  = QColor::fromRgb(0x274F91);
            break;
        case KEYPAD_DENIM:
            c_center = QColor::fromRgb(0x003C71);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0x013766);
            break;
        case KEYPAD_SILVER:
            c_center = QColor::fromRgb(0x7C878E);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0x191919);
            c_graph  = QColor::fromRgb(0xD0D3D4);
            break;
        case KEYPAD_PINK:
            c_center = QColor::fromRgb(0xDF1995);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0xAA0061);
            break;
        case KEYPAD_PLUM:
            c_center = QColor::fromRgb(0x830065);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0x5E2751);
            break;
        case KEYPAD_RED:
            c_center = QColor::fromRgb(0xAB2328);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0x8A2A2B);
            break;
        case KEYPAD_LIGHTNING:
            c_center = QColor::fromRgb(0x0077C8);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0x0077C8);
            break;
        case KEYPAD_GOLDEN:
            c_center = QColor::fromRgb(0xD8D3B6);
            c_sides  = c_center.lighter(130);
            c_other  = QColor::fromRgb(0xD8D3B6);
            break;
    }

    m_background = {s_baseRect.topLeft(), s_baseRect.topRight()};
    m_background.setColorAt(0.00, c_sides);
    m_background.setColorAt(0.18, c_center);
    m_background.setColorAt(0.82, c_center);
    m_background.setColorAt(1.00, c_sides);

    QFont font;
    font.setStyleHint(QFont::SansSerif, QFont::PreferOutline);
    font.setFamily("Helvetica Neue Bold");
    if (!font.exactMatch()) {
        font.setFamily("Open Sans Bold");
    }

    font.setBold(true);
    font.setPixelSize(5);
#ifdef Q_OS_WIN
    font.setWeight(QFont::Black);
#else
    font.setStretch(QFont::SemiCondensed);
#endif

    m_config.labelFont   = font,
    m_config.secondFont  = font,
    m_config.alphaFont   = font,
    m_config.secondColor = QColor::fromRgb(0x93c3f3),
    m_config.alphaColor  = QColor::fromRgb(0xa0ca1e),
    m_config.graphColor  = c_graph,
    m_config.numColor    = c_num,
    m_config.otherColor  = c_other,
    m_config.blackColor  = QColor::fromRgb(0x222222),
    m_config.whiteColor  = QColor::fromRgb(0xeeeeee),
    m_config.textColor   = c_text,
    m_config.key         = {1, 0};

#ifdef _MSC_VER
/* Temporary hack... QStringLiteral mangles the UTF-8 string on MSVC for some reason */
#define Label(str)          QString::fromUtf8(str)
#else
#define Label(str)          QStringLiteral(str)
#endif

#define LabelFrEn(fr, en)   (is83 ? Label(fr) : Label(en))

    addKey(new GraphKey{m_config, LabelFrEn("graphe", "graph"), Label("table"), Label("f5"), 15, 2, 2 - is83});
    addKey(new GraphKey{m_config, Label("trace"), LabelFrEn("calculs", "calc"), Label("f4"), is83 ? 10 : 12, 2 + is83 * 2, 1});
    addKey(new GraphKey{m_config, Label("zoom"), Label("format"), Label("f3"), is83 ? 11 : 13, 2 + is83 * 2, is83 ? 1 : 5});
    addKey(new GraphKey{m_config, LabelFrEn("fenêtre", "window"), LabelFrEn("déf table", "tblset"),
                        Label("f2"), 15 - is83, is83 ? 6 : 2, 4 - is83});
    addKey(new GraphKey{m_config, is83 ? Label("f(x)") : Label("y="), LabelFrEn("graph stats", "stat plot"),
                        Label("f1"), 6 + is83, is83 ? 6 : 2, is83 ? 10 : 8});

    addKey(new SecondKey{m_config, LabelFrEn("2nde", "2nd")});

#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 16 - is83 * 2, 45, 37, Label(" mode"), LabelFrEn("quitter", "quit")});
#else
    addKey(new OtherKey{m_config, 16 - is83 * 2, 45, 37, Label("mode"), LabelFrEn("quitter", "quit")});
#endif
    addKey(new OtherKey{m_config, is83 ? 14 : 8, 72, 37, LabelFrEn("suppr", "del"), LabelFrEn("insérer", "ins")});
    addKey(new OtherKey{m_config, 7, Label("on"), Label("off")});
    addKey(new OtherKey{m_config, 13, Label("sto→"), LabelFrEn("rappel", "rcl"), Label("X"), is83 * 2, is83 * 3});
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 7, Label(" ln"), Label("eˣ"), Label("S"), is83 * 2, is83 * 2});
    addKey(new OtherKey{m_config, 9, Label(" log"), Label("10ˣ"), Label("N"), is83 * 2, is83 * 3});
#else
    addKey(new OtherKey{m_config, 7, Label("ln"), Label("eˣ"), Label("S"), is83 * 2, is83 * 2});
    addKey(new OtherKey{m_config, 9, Label("log"), Label("10ˣ"), Label("N"), is83 * 2, is83 * 3});
#endif
    addKey(new OtherKey{m_config, 6, Label("x²"), Label("√‾‾"), Label("I"), is83, is83 * 3});
    addKey(new OtherKey{m_config, is83 ? 6 : 8, LabelFrEn("◀ ▶", "x⁻¹"), LabelFrEn("angle", "matrix"), Label("D"), is83 * 2, is83 ? 2 : 4});
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 14, Label(" math"), LabelFrEn("tests", "test"), Label("A"), is83 * 2, is83 * 2});
#else
    addKey(new OtherKey{m_config, 14, Label("math"), LabelFrEn("tests", "test"), Label("A"), is83 * 2, is83 * 2});
#endif

    addKey(new AlphaKey{m_config, LabelFrEn("verr A", "A-lock")});

#ifdef Q_OS_MACX
    addKey(new NumKey{m_config, Label("0"), Label("catalog"), Label("_"), is83 * 2, 6});
#else
    addKey(new NumKey{m_config, Label("0"), Label("catalog"), Label("⎵"), is83 * 2, 6});
#endif
    addKey(new NumKey{m_config, Label("1"), Label("L1"), Label("Y"), is83 * 2, is83 ? 3 : 1});
    addKey(new NumKey{m_config, Label("4"), Label("L4"), Label("T"), is83 * 2, is83 ? 3 : 1});

#if defined(_WIN32) || defined(Q_OS_MACX)
    addKey(new NumKey{m_config, Label("7"), LabelFrEn("un", "u"), Label("O"), is83 * 2, 1 + is83});
#else
    addKey(new NumKey{m_config, Label("7"), LabelFrEn("uₙ", "u"), Label("O"), is83 * 2, 1 + is83});
#endif
    addKey(new OtherKey{m_config, 2, Label(","), Label("EE"), Label("J"), is83 * 2, 1 + is83});
    addKey(new OtherKey{m_config, 8 + is83, LabelFrEn("trig", "sin"), LabelFrEn("π", "sin⁻¹"), Label("E"), is83 * 2, 1});
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 14 + is83, LabelFrEn("matrice ", "  apps"), LabelFrEn("x⁻¹", "angle"), Label("B"), is83 * 2, 1});
#else
    addKey(new OtherKey{m_config, 14 + is83, LabelFrEn("matrice", "apps"), LabelFrEn("x⁻¹", "angle"), Label("B"), is83 * 2, 1});
#endif
#ifdef _WIN32
    addKey(new OtherKey{m_config, 15 + is83, Label("X,T,θ,n"), LabelFrEn("échanger", "link"), QString{}, is83 * 2, is83 * 3});
#elif defined(Q_OS_MACX)
    addKey(new OtherKey{m_config, 15 + is83, Label(" X,T,θ,n "), LabelFrEn("échanger", "link"), QString{}, 1, 1});
#else
    addKey(new OtherKey{m_config, 15 + is83, Label("X,T,θ,n"), LabelFrEn("échanger", "link"), QString{}, 1, 1});
#endif
    addKey(new NumKey{m_config, is83 * 2});
    addKey(new NumKey{m_config, Label("2"), Label("L2"), Label("Z"), is83 * 2, is83 * 3});
    addKey(new NumKey{m_config, Label("5"), Label("L5"), Label("U"), is83 * 2, is83 * 3});
#if defined(_WIN32) || defined(Q_OS_MACX)
    addKey(new NumKey{m_config, Label("8"), LabelFrEn("vn", "v"), Label("P"), is83 * 2, is83 * 2});
#else
    addKey(new NumKey{m_config, Label("8"), LabelFrEn("vₙ", "v"), Label("P"), is83 * 2, is83 * 2});
#endif
    addKey(new OtherKey{m_config, 3, Label("("), Label("{"), Label("K"), is83 * 2, is83});
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, is83 ? 12 : 9, LabelFrEn("résol", "cos"), LabelFrEn("apps", "cos⁻¹"), Label("F"), is83 * 2, is83 * 2});
#else
    addKey(new OtherKey{m_config, is83 ? 12 : 9, LabelFrEn("résol", "cos"), LabelFrEn("apps", "cos⁻¹"), Label("F"), is83 * 2, is83 * 2});
#endif
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 14, Label(" prgm"), LabelFrEn("dessin", "draw"), Label("C"), is83 * 2, is83 * 2});
    addKey(new OtherKey{m_config, 11 + is83, LabelFrEn("stats", " stat"), LabelFrEn("listes", "list")});
#else
    addKey(new OtherKey{m_config, 14, Label("prgm"), LabelFrEn("dessin", "draw"), Label("C"), is83 * 2, is83 * 2});
    addKey(new OtherKey{m_config, 11 + is83, LabelFrEn("stats", "stat"), LabelFrEn("listes", "list")});
#endif

    addKey(new NumKey{m_config, Label("(-)"), LabelFrEn("rép", "ans"), Label("?"), is83 * 2, is83 * 3, 11});
    addKey(new NumKey{m_config, Label("3"), Label("L3"), Label("θ"), is83 * 2, is83 * 3});
    addKey(new NumKey{m_config, Label("6"), Label("L6"), Label("V"), is83 * 2, is83 * 3});
#if defined(_WIN32) || defined(Q_OS_MACX)
    addKey(new NumKey{m_config, Label("9"), LabelFrEn("wn", "w"), Label("Q"), is83 * 2, is83 * 3});
#else
    addKey(new NumKey{m_config, Label("9"), LabelFrEn("wₙ", "w"), Label("Q"), is83 * 2, is83 * 3});
#endif
    addKey(new OtherKey{m_config, 3, Label(")"), Label("}"), Label("L"), is83 * 2, is83});
#ifdef _WIN32
    addKey(new OtherKey{m_config, 9, LabelFrEn("⸋|⸋", "tan"), LabelFrEn("∫⸋|⸋d▫‣", "tan⁻¹"), Label("G"), is83 * 2, is83 * 2});
#elif defined(Q_OS_MACX)
    addKey(new OtherKey{m_config, 9, LabelFrEn("▫/▫", "tan"), LabelFrEn("∫⸋d▫‣", "tan⁻¹"), Label("G"), is83 * 2, is83 * 2});
#else
    addKey(new OtherKey{m_config, 9, LabelFrEn("▫/▫", "tan"), LabelFrEn("∫⸋̻◻d▫‣", "tan⁻¹"), Label("G"), is83 * 2, is83 * 2});
#endif
    addKey(new OtherKey{m_config, is83 ? 9 : 12, LabelFrEn("var", "vars"), LabelFrEn("distrib", "distr"), Label(""), 0, is83});
    m_config.next();
#ifdef Q_OS_MACX
    addKey(new OperKey{m_config, LabelFrEn("  entrer", "  enter"), LabelFrEn("précéd", "entry"), is83 ? QString{} : Label("solve"), 6, is83 ? 0 : 5, {16, 5}});
#else
    addKey(new OperKey{m_config, LabelFrEn("entrer", "enter"), LabelFrEn("précéd", "entry"), is83 ? QString{} : Label("solve"), 6, is83 ? 0 : 5, {16, 5}});
#endif
    addKey(new OperKey{m_config, Label("+"), LabelFrEn("mém", "mem"), Label("“"), is83 * 2, is83 * 5});
    addKey(new OperKey{m_config, Label("—"), Label("]"), Label("W"), is83 * 2, is83 * 2});
    addKey(new OperKey{m_config, Label("×"), Label("["), Label("R"), is83 * 2, is83 * 2});
    addKey(new OperKey{m_config, Label("÷"), Label("e"), Label("M"), is83 * 2, is83 * 2});

    addKey(new OtherKey{m_config, is83 ? QString{} : Label("π"), is83 * 2});
#ifdef Q_OS_MACX
    addKey(new OtherKey{m_config, 15, LabelFrEn(" annul", "  clear")});
#else
    addKey(new OtherKey{m_config, 15, LabelFrEn("annul", "clear")});
#endif

#undef Label
#undef LabelFrEn

    m_config.next();
    QPoint center{121, 53};
    QRect outer, inner;
    outer.setSize({35, 35});
    inner.setSize({16, 16});
    outer.moveCenter(center);
    inner.moveCenter(center);
    addKey(new ArrowKey{m_config, outer, inner, 3});
    addKey(new ArrowKey{m_config, outer, inner, 2});
    addKey(new ArrowKey{m_config, outer, inner, 0});
    addKey(new ArrowKey{m_config, outer, inner, 1});

    update();
}
コード例 #17
0
ファイル: waveformrendermark.cpp プロジェクト: mixxxdj/mixxx
void WaveformRenderMark::generateMarkImage(WaveformMark* pMark) {
    const WaveformMarkProperties& markProperties = pMark->getProperties();

    // Load the pixmap from file -- takes precedence over text.
    if (!markProperties.m_pixmapPath.isEmpty()) {
        QString path = markProperties.m_pixmapPath;
        QImage image = *WImageStore::getImage(path, scaleFactor());
        //QImage image = QImage(path);
        // If loading the image didn't fail, then we're done. Otherwise fall
        // through and render a label.
        if (!image.isNull()) {
            pMark->m_image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
            //WImageStore::correctImageColors(&pMark->m_image);
            return;
        }
    }

    QPainter painter;

    // If no text is provided, leave m_markImage as a null image
    if (!markProperties.m_text.isNull()) {
        // Determine mark text.
        QString label = markProperties.m_text;
        if (pMark->getHotCue() >= 0) {
            if (!label.isEmpty()) {
                label.prepend(": ");
            }
            label.prepend(QString::number(pMark->getHotCue() + 1));
            if (label.size() > kMaxCueLabelLength) {
                label = label.left(kMaxCueLabelLength - 3) + "...";
            }
        }

        //QFont font("Bitstream Vera Sans");
        //QFont font("Helvetica");
        QFont font; // Uses the application default
        font.setPointSizeF(10 * scaleFactor());
        font.setStretch(100);
        font.setWeight(75);

        QFontMetrics metrics(font);

        //fixed margin ...
        QRect wordRect = metrics.tightBoundingRect(label);
        const int marginX = 1;
        const int marginY = 1;
        wordRect.moveTop(marginX + 1);
        wordRect.moveLeft(marginY + 1);
        wordRect.setHeight(wordRect.height() + (wordRect.height()%2));
        wordRect.setWidth(wordRect.width() + (wordRect.width())%2);
        //even wordrect to have an even Image >> draw the line in the middle !

        int labelRectWidth = wordRect.width() + 2 * marginX + 4;
        int labelRectHeight = wordRect.height() + 2 * marginY + 4 ;

        QRectF labelRect(0, 0,
                (float)labelRectWidth, (float)labelRectHeight);

        int width;
        int height;

        if (m_waveformRenderer->getOrientation() == Qt::Horizontal) {
            width = 2 * labelRectWidth + 1;
            height = m_waveformRenderer->getHeight();
        } else {
            width = m_waveformRenderer->getWidth();
            height = 2 * labelRectHeight + 1;
        }

        pMark->m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);

        Qt::Alignment markAlignH = markProperties.m_align & Qt::AlignHorizontal_Mask;
        Qt::Alignment markAlignV = markProperties.m_align & Qt::AlignVertical_Mask;

        if (markAlignH == Qt::AlignHCenter) {
            labelRect.moveLeft((width - labelRectWidth) / 2);
        } else if (markAlignH == Qt::AlignRight) {
            labelRect.moveRight(width - 1);
        }

        if (markAlignV == Qt::AlignVCenter) {
            labelRect.moveTop((height - labelRectHeight) / 2);
        } else if (markAlignV == Qt::AlignBottom) {
            labelRect.moveBottom(height - 1);
        }

        // Fill with transparent pixels
        pMark->m_image.fill(QColor(0,0,0,0).rgba());

        painter.begin(&pMark->m_image);
        painter.setRenderHint(QPainter::TextAntialiasing);

        painter.setWorldMatrixEnabled(false);

        // Draw marker lines
        if (m_waveformRenderer->getOrientation() == Qt::Horizontal) {
            int middle = width / 2;
            if (markAlignH == Qt::AlignHCenter) {
                if (labelRect.top() > 0) {
                    painter.setPen(markProperties.fillColor());
                    painter.drawLine(middle, 0, middle, labelRect.top());

                    painter.setPen(markProperties.borderColor());
                    painter.drawLine(middle - 1, 0, middle - 1, labelRect.top());
                    painter.drawLine(middle + 1, 0, middle + 1, labelRect.top());
                }

                if (labelRect.bottom() < height) {
                    painter.setPen(markProperties.fillColor());
                    painter.drawLine(middle, labelRect.bottom(), middle, height);

                    painter.setPen(markProperties.borderColor());
                    painter.drawLine(middle - 1, labelRect.bottom(), middle - 1, height);
                    painter.drawLine(middle + 1, labelRect.bottom(), middle + 1, height);
                }
            } else {  // AlignLeft || AlignRight
                painter.setPen(markProperties.fillColor());
                painter.drawLine(middle, 0, middle, height);

                painter.setPen(markProperties.borderColor());
                painter.drawLine(middle - 1, 0, middle - 1, height);
                painter.drawLine(middle + 1, 0, middle + 1, height);
            }
        } else {  // Vertical
            int middle = height / 2;
            if (markAlignV == Qt::AlignVCenter) {
                if (labelRect.left() > 0) {
                    painter.setPen(markProperties.fillColor());
                    painter.drawLine(0, middle, labelRect.left(), middle);

                    painter.setPen(markProperties.borderColor());
                    painter.drawLine(0, middle - 1, labelRect.left(), middle - 1);
                    painter.drawLine(0, middle + 1, labelRect.left(), middle + 1);
                }

                if (labelRect.right() < width) {
                    painter.setPen(markProperties.fillColor());
                    painter.drawLine(labelRect.right(), middle, width, middle);

                    painter.setPen(markProperties.borderColor());
                    painter.drawLine(labelRect.right(), middle - 1, width, middle - 1);
                    painter.drawLine(labelRect.right(), middle + 1, width, middle + 1);
                }
            } else {  // AlignTop || AlignBottom
                painter.setPen(markProperties.fillColor());
                painter.drawLine(0, middle, width, middle);

                painter.setPen(markProperties.borderColor());
                painter.drawLine(0, middle - 1, width, middle - 1);
                painter.drawLine(0, middle + 1, width, middle + 1);
            }
        }

        // Draw the label rect
        painter.setPen(markProperties.borderColor());
        painter.setBrush(QBrush(markProperties.fillColor()));
        painter.drawRoundedRect(labelRect, 2.0, 2.0);

        // Draw text
        painter.setBrush(QBrush(QColor(0,0,0,0)));
        painter.setFont(font);
        painter.setPen(markProperties.labelColor());
        painter.drawText(labelRect, Qt::AlignCenter, label);
    }
    else //no text draw triangle
    {
        float triangleSize = 9.0;
        float markLength = triangleSize + 1.0;
        float markBreadth = m_waveformRenderer->getBreadth();

        int width, height;

        if (m_waveformRenderer->getOrientation() == Qt::Horizontal) {
            width = markLength;
            height = markBreadth;
        } else {
            width = markBreadth;
            height = markLength;
        }

        pMark->m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
        pMark->m_image.fill(QColor(0,0,0,0).rgba());

        painter.begin(&pMark->m_image);
        painter.setRenderHint(QPainter::TextAntialiasing);

        painter.setWorldMatrixEnabled(false);

        // Rotate if drawing vertical waveforms
        if (m_waveformRenderer->getOrientation() == Qt::Vertical) {
            painter.setTransform(QTransform(0, 1, 1, 0, 0, 0));
        }

        QColor triangleColor = markProperties.fillColor();
        painter.setPen(QColor(0,0,0,0));
        painter.setBrush(QBrush(triangleColor));

        //vRince: again don't ask about the +-0.1 0.5 ...
        // just to make it nice in Qt ...

        QPolygonF triangle;
        triangle.append(QPointF(0.5,0));
        triangle.append(QPointF(triangleSize+0.5,0));
        triangle.append(QPointF(triangleSize*0.5 + 0.1, triangleSize*0.5));

        painter.drawPolygon(triangle);

        triangle.clear();
        triangle.append(QPointF(0.0,markBreadth));
        triangle.append(QPointF(triangleSize+0.5,markBreadth));
        triangle.append(QPointF(triangleSize*0.5 + 0.1, markBreadth - triangleSize*0.5 - 2.1));

        painter.drawPolygon(triangle);

        //TODO vRince duplicated code make a method
        //draw line
        QColor lineColor = markProperties.fillColor();
        painter.setPen(lineColor);

        float middle = markLength / 2.0;

        float lineTop = triangleSize * 0.5 + 1;
        float lineBottom = markBreadth - triangleSize * 0.5 - 1;

        painter.drawLine(middle, lineTop, middle, lineBottom);

        //other lines to increase contrast
        painter.setPen(QColor(0,0,0,100));
        painter.drawLine(middle - 1, lineTop, middle - 1, lineBottom);
        painter.drawLine(middle + 1, lineTop, middle + 1, lineBottom);
    }
}
コード例 #18
0
ファイル: waveformrendermark.cpp プロジェクト: MLudgate/mixxx
void WaveformRenderMark::generateMarkImage(WaveformMark& mark) {
    // Load the pixmap from file -- takes precedence over text.
    if (mark.m_pixmapPath != "") {
        QString path =  mark.m_pixmapPath;
        QImage image = QImage(path);
        // If loading the image didn't fail, then we're done. Otherwise fall
        // through and render a label.
        if (!image.isNull()) {
            mark.m_image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
            WImageStore::correctImageColors(&mark.m_image);
            return;
        }
    }

    QPainter painter;

    int labelRectWidth = 0;
    int labelRectHeight = 0;

    // If no text is provided, leave m_markImage as a null image
    if (!mark.m_text.isNull()) {
        //QFont font("Bitstream Vera Sans");
        //QFont font("Helvetica");
        QFont font; // Uses the application default
        font.setPointSize(10);
        font.setStretch(100);

        QFontMetrics metrics(font);

        //fixed margin ...
        QRect wordRect = metrics.tightBoundingRect(mark.m_text);
        const int marginX = 1;
        const int marginY = 1;
        wordRect.moveTop(marginX + 1);
        wordRect.moveLeft(marginY + 1);
        wordRect.setWidth(wordRect.width() + (wordRect.width())%2);
        //even wordrect to have an even Image >> draw the line in the middle !

        labelRectWidth = wordRect.width() + 2*marginX + 4;
        labelRectHeight = wordRect.height() + 2*marginY + 4 ;

        QRectF labelRect(0, 0,
                (float)labelRectWidth, (float)labelRectHeight);

        mark.m_image = QImage(labelRectWidth+1,
                m_waveformRenderer->getHeight(),
                QImage::Format_ARGB32_Premultiplied);

        if (mark.m_align == Qt::AlignBottom) {
            labelRect.moveBottom(mark.m_image.height()-1);
        }

        // Fill with transparent pixels
        mark.m_image.fill(QColor(0,0,0,0).rgba());

        painter.begin(&mark.m_image);
        painter.setRenderHint(QPainter::TextAntialiasing);

        painter.setWorldMatrixEnabled(false);

        //draw the label rect
        QColor rectColor = mark.m_color;
        rectColor.setAlpha(150);
        painter.setPen(mark.m_color);
        painter.setBrush(QBrush(rectColor));
        painter.drawRoundedRect(labelRect, 2.0, 2.0);
        //painter.drawRect(labelRect);

        //draw text
        painter.setBrush(QBrush(QColor(0,0,0,0)));
        font.setWeight(75);
        painter.setFont(font);
        painter.setPen(mark.m_textColor);
        painter.drawText(labelRect, Qt::AlignCenter, mark.m_text);

        //draw line
        QColor lineColor = mark.m_color;
        lineColor.setAlpha(200);
        painter.setPen(lineColor);

        float middle = mark.m_image.width() / 2.0;
        //Default line align top
        float lineTop = labelRectHeight + 1;
        float lineBottom = mark.m_image.height();

        if (mark.m_align == Qt::AlignBottom) {
            lineTop = 0.0;
            lineBottom = mark.m_image.height() - labelRectHeight - 1;
        }

        painter.drawLine(middle, lineTop, middle, lineBottom);

        //other lines to increase contrast
        painter.setPen(QColor(0,0,0,120));
        painter.drawLine(middle - 1, lineTop, middle - 1, lineBottom);
        painter.drawLine(middle + 1, lineTop, middle + 1, lineBottom);

    }
    else //no text draw triangle
    {
        float triangleSize = 9.0;
        mark.m_image = QImage(labelRectWidth+1,
                m_waveformRenderer->getHeight(),
                QImage::Format_ARGB32_Premultiplied);
        mark.m_image.fill(QColor(0,0,0,0).rgba());

        painter.begin(&mark.m_image);
        painter.setRenderHint(QPainter::TextAntialiasing);

        painter.setWorldMatrixEnabled(false);

        QColor triangleColor = mark.m_color;
        triangleColor.setAlpha(140);
        painter.setPen(QColor(0,0,0,0));
        painter.setBrush(QBrush(triangleColor));

        //vRince: again don't ask about the +-0.1 0.5 ...
        // just to make it nice in Qt ...

        QPolygonF triangle;
        triangle.append(QPointF(0.5,0));
        triangle.append(QPointF(triangleSize+0.5,0));
        triangle.append(QPointF(triangleSize*0.5 + 0.1, triangleSize*0.5));

        painter.drawPolygon(triangle);

        triangle.clear();
        triangle.append(QPointF(0.0,mark.m_image.height()));
        triangle.append(QPointF(triangleSize+0.5,mark.m_image.height()));
        triangle.append(QPointF(triangleSize*0.5 + 0.1, mark.m_image.height() - triangleSize*0.5 - 2.1));

        painter.drawPolygon(triangle);

        //TODO vRince duplicated code make a method
        //draw line
        QColor lineColor = mark.m_color;
        lineColor.setAlpha(140);
        painter.setPen(lineColor);
        float middle = mark.m_image.width() / 2.0;

        float lineTop = triangleSize * 0.5 + 1;
        float lineBottom = mark.m_image.height() - triangleSize * 0.5 - 1;

        painter.drawLine(middle, lineTop, middle, lineBottom);

        //other lines to increase contrast
        painter.setPen(QColor(0,0,0,100));
        painter.drawLine(middle - 1, lineTop, middle - 1, lineBottom);
        painter.drawLine(middle + 1, lineTop, middle + 1, lineBottom);
    }
}
コード例 #19
0
ファイル: qfontproto.cpp プロジェクト: Wushaowei001/xtuple-1
void QFontProto::setStretch(int factor)
{
  QFont *item = qscriptvalue_cast<QFont*>(thisObject());
  if (item)
    item->setStretch(factor);
}
コード例 #20
0
ファイル: MercuryPalette.cpp プロジェクト: dulton/53_hero
//------------------------------------------------------------------------------
// 
//------------------------------------------------------------------------------
const MercuryPalette::tTextStyle MercuryPalette::GetTextStyle(eFontIdentifier identifier, bool alt)
{
    QFont font;
    QColor colour(Qt::white);
    switch(identifier)
    {
    case eF1:
        /*F1
        MAIN HEADER
        Font: Interstate - Bold
        Default Size: 20 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(20);
        break;
    case eF2:
    case eF2_AltColor_CPUCtrl:
    case eF2_AltColor_Standby:
    case eF2_AltColor_Warning:
       /* F2
        SECONDARY HEADER
        Font: Interstate - Bold
        Default Size: 17 pixels
        Font Scaling: Dynamically down to fit
        Color: R180 G180 B180
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(16);
        switch ( identifier )
        {
        case eF2:
            colour = QColor(180,180,180);
            break;
        case eF2_AltColor_CPUCtrl:
            colour = cColorComputerControlledActive;
            break;
        case eF2_AltColor_Standby:
            colour = QColor(72,72,72);
            break;
        case eF2_AltColor_Warning:
            colour = QColor(Qt::white);
            break;
        default:
            break;
        }
        break;
    case eF3:
        /*F3
        DATA SCREEN KEY VALUE
        Font: Prototype
        Default Size: 40 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(40);
        font.setStretch(110);
        //font.setLetterSpacing( QFont::PercentageSpacing, 125 );
        break;
    case eF4:
        /*F4
        DATA SCREEN KEY VALUE UOM
        Font: Interstate - Bold
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R135 G135 B135
        Styling: Vert Scaling 90%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(alt ? 12 : 15);
        colour = QColor(135,135,135);
        break;
    case eF5:
        /*F5
        DATA SCREEN TANK VESSEL LOCATION
        Font: Interstate - Bold
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Leading 11px, Vert Scaling 90%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(12);
        break;
    case eF6:
        /*F6
        DATA SCREEN VOLTS WHOLE NUMBER
        Font: Prototype
        Default Size: 28 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(20);
        font.setStretch(100);
        //font.setLetterSpacing( QFont::PercentageSpacing, 125 );
        break;
    case eF7:
        /*F7
        DATA SCREEN VOLTS DECIMAL NUMBER
        Font: Prototype
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(12);
        font.setStretch(100);
        //font.setLetterSpacing( QFont::PercentageSpacing, 125 );
        break;
    case eF8:
        /*F8
        DATA SCREEN VOLTS UOM MARKER
        Font: Interstate - Bold
        Default Size: 12 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(10);
        break;
    case eF9:
        /*F9
        SINGLE VALUE WHOLE NUMBER (LRG)
        Font: Prototype
        Default Size: 66 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(60);
        font.setStretch(110);
        //font.setLetterSpacing( QFont::PercentageSpacing, 125 );
        break;
    case eF10:
        /*F10
        SINGLE VALUE OUM MARKER (LRG)
        Font: Interstate - Bold
        Default Size: 48 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Baseline Shift +13 px (up)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(42);
        break;
    case eF11:
        /*F11
        TWO/THREE ROW NUMBER VALUES
        Font: Prototype
        Default Size: 26 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(26);
        //font.setLetterSpacing( QFont::PercentageSpacing, 125 );
        break;
    case eF12:
        /*F12
        THREE ROW NUMBER UOM MARKER
        Font: Interstate - Bold
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(16);
        break;
    case eF13:
        /*F13
        DATA SCREEN TEMPERATURE UOM MARKER
        Font: Prototype
        Default Size: 32 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Baseline Shift +6 px (up)
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(32);
        break;
    case eF14:
        /*F14
        SINGLE VALUE WHOLE NUMBER (MED)
        Font: Prototype
        Default Size: 36 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(36);
        font.setStretch(110);
        break;
    case eF15:
        /*F15
        SINGLE VALUE OUM MARKER (MED)
        Font: Interstate - Bold
        Default Size: 12 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(12);
        break;
    case eF16:
        /*SINGLE VALUE WHOLE NUMBER (SM)
        Font: Prototype
        Default Size: 20 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        ALT Color: R135 G135 B135
        (Launch number indicator on smart tow graph)
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(20);
        font.setStretch(110);

        if ( alt )
        {
            colour = QColor( 135, 135, 135 );
        }
        break;
    case eF17:
        /*F17
        TEXT LINE ITEM (SML)
        Font: Interstate - Bold
        Default Size: 10 pixels
        Font Scaling: Dynamically down to fit
        Color: R135 G135 B135
        Styling: None/default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(10);
        colour = QColor(135,135,135);
        break;
    case eF18:
    case eF18_AltColor_CPUCtrl:
    case eF18_AltColor_Standby:
        /*F18
        AUTOPILOT SINGLE VALUE WHOLE NUMBER (LRG)
        Font: Prototype
        Default Size: 54 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        TODO: Alt colours
        Styling: Tracking +25, Horz scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(54);
        font.setStretch(110);
        switch ( identifier )
        {
        case eF18_AltColor_CPUCtrl:
            colour = cColorComputerControlledActive;
            break;
        case eF18_AltColor_Standby:
            colour = QColor(102,102,102);
            break;
        default:
            break;
        }
        break;
    case eF19:
    case eF19_AltColor_CPUCtrl:
    case eF19_AltColor_Standby:
        /*F19
        AUTOPILOT SINGLE VALUE OUM MARKER (LRG)
        Font: Interstate - bold
        Default Size: 42 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        TODO: Alt colours
        TODO: Styling: Baseline shift +8px (up)
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(42);
        switch ( identifier )
        {
        case eF19_AltColor_CPUCtrl:
            colour = cColorComputerControlledActive;
            break;
        case eF19_AltColor_Standby:
            colour = QColor(102,102,102);
            break;
        default:
            break;
        }
        break;
    case eF20:
    case eF20_AltColor_CPUCtrl:
    case eF20_AltColor_Standby:
        /*F20
        AUTOPILOT RESPONSE TEXT
        Font: Interstate - bold
        Default Size: 11 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        TODO: Alt colours
        Styling: None/default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(11);
        switch ( identifier )
        {
        case eF20_AltColor_CPUCtrl:
            colour = cColorComputerControlledActive;
            break;
        case eF20_AltColor_Standby:
            colour = QColor(102,102,102);
            break;
        default:
            break;
        }
        break;
    case eF21:
    case eF21_AltColor_Trim:
        /*SKYHOOK TEXT
        Font: Interstate - Bold
        Default Size: 40 pixels
        Font Scaling: Dynamically down to fit
        Color: R251 G176 B59
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(40);
        switch ( identifier )
        {
        case eF21:
            colour = cColorComputerControlledActive;
            break;
        case eF21_AltColor_Trim:
            colour = Qt::white;
            break;
        default:
            break;
        }
        break;
    case eF22:
        /*WARNING/NOTICE HEADER TEXT
        Font: Interstate - Bold
        Default Size: 30 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G0 B0
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(30);
        colour = QColor(0,0,0);
        break;
    case eF23:
        /*WARNING/NOTICE TITLE TEXT
        Font: Interstate - Bold
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Leading 19 pixels*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(16);
        break;
    case eF24:
        /*WARNING/NOTICE DESCRIPTION TEXT
        Font: Interstate - Bold
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Leading 17 pixels*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(14);
        break;
    case eF25:
        /*AUTOPILOT RESPONSE TEXT
        Font: Interstate - Bold
        Default Size: 12 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Leading 14 pixels*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(12);
        break;
    case eF26:
        /*F26
        TERTIARY HEADER
        Font: Interstate - regular
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(14);
        font.setStretch(110);
        break;
    case eF27:
    case eF27_AltColor:
        /*F27
        DESCRIPTION TEXT
        Font: Interstate - regular
        Default Size: 12 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Alt Color: R204 G204 B204
        Styling: None/default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(12);
        if ( identifier == eF27_AltColor )
        {
            colour = QColor( 204, 204, 204 );
        }
        break;
    case eF28:
        /*F28
        DESCRIPTION TEXT - BOLD
        Font: Interstate - bold
        Default Size: 12 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/default
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(12);
        break;
    case eF29:
        /*F29
        SINGLE VALUE WHOLE NUMBER (EXTRA LRG)
        Font: Prototype
        Default Size: 90 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz scaling 110%
        (Styling Note: Discuss options with Navico)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(90);
        font.setStretch(110);
        font.setBold(true);
        break;
    case eF30:
        /*F30
        TERTIARY HEADER - ALT1
        Font: Interstate - Regular
        Default Size: 13 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(13);
        font.setStretch(110);
        break;
    case eF31:
        /*F31
        ECO OPTIMIZED VALUE (LRG)
        Font: Prototype
        Default Size: 48 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(48);
        font.setStretch(110);
        break;
    case eF32:
        /*F32
        WARNING/NOTICE TITLE TEXT
        Font: Prototype
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(16);
        font.setStretch(110);
        break;
    case eF33:
        /*F33
        AUTOPILOT RESPONSE TEXT
        Font: Interstate - Bold
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R111 G189 B68
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(14);
        font.setStretch(110);
        colour = QColor(111,189,68);
        break;
    case eF34:
        /*F34
        TRIM/TAB ENGINE IDENTIFICATION
        Font: Interstate - Bold
        Default Size: 9 pixels
        Font Scaling: Dynamically down to fit
        Color: R179 G179 B179
        ALT Color: R0 G0 B0
        (comm error text state)
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(9);
        //font.setStretch(110);
        colour = alt ? Qt::black : QColor(179,179,179);
        break;
    case eF35:
        /*F35
        SYSTEM TRAY TEXT 1
        Font: Interstate - Bold
        Default Size: 9 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Tracking -75, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(9);
        font.setStretch(110);
        break;
    case eF36:
        /*F36
        SYSTEM TRAY TEXT 2
        Font: Interstate - Bold
        Default Size: 11 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G0 B0
        Styling: Tracking -50, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(11);
        font.setStretch(110);
        colour = Qt::black;
        break;
    case eF37:
        /*F37
        DATA BOX TEXT
        Font: Interstate - Regular
        Default Size: 9 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        ALT Color: R230 G230 B230
        (data box UOM Indicator)
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(9);
        font.setStretch(110);
        colour = alt ? QColor(230,230,230) : Qt::white;
        break;
    case eF38:
        /*F38
        DATA BOX ENGINE LOCATION ID
        Font: Interstate - Regular
        Default Size: 8 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(8);
        font.setStretch(110);
        break;
    case eF39:
        /*F39
        DATA BOX SINGLE VALUE
        Font: Prototype
        Default Size: 21 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(21);
        font.setStretch(110);
        break;
    case eF40:
        /*F40
        DATA BOX DUAL VALUE
        Font: Prototype
        Default Size: 13 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(13);
        font.setStretch(110);
        break;
    case eF41:
        /*F41
        DESCRIPTION TEXT
        Font: Interstate - Bold
        Default Size: 11 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(11);
        font.setStretch(110);
        break;
    case eF42:
        /*F42
        TEXT VALUE SELECTION 1
        Font: Interstate - Bold
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G0 B0
        ALT Color: R255 G255 B255
        (unselected state)
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(14);
        colour = alt ? Qt::black : Qt::white;
        break;
    case eF43:
        /*F43
        NUMERICAL VALUE SELECTION 1
        Font: Prototype
        Default Size: 20 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        ALT Color: R0 G0 B0
        (selected state)*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(20);
        font.setStretch(110);
        colour = alt ? Qt::black : Qt::white;
        break;
    case eF44:
        //TODO: create system to allow multiple alternatives
        /*F44
        TERTIARY TEXT(REGULAR)
        Font: Interstate - Regular
        Default Size: 10 pixels
        ALT 1 Size: 13 pixels
        (Smart Tow File Save - menu instruction -text)
        ALT 2 Size: 14 pixels + (italic)
        (Smart Tow File Save text)
        Font Scaling: Dynamically down to fit
        Color: R135 G135 B135
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(10);
        colour = QColor(135,135,135);
        break;
    case eF44A:
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(13);
        colour = QColor(135,135,135);
        break;
    case eF44B:
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(14);
        font.setItalic(true);
        colour = QColor(135,135,135);
        break;
    case eF45:
        /*F45
        TERTIARY TEXT (BOLD)
        Font: Interstate - Bold
        Default Size: 10 pixels
        Font Scaling: Dynamically down to fit
        Color: R135 G135 B135
        Styling: None/Default
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(10);
        font.setStretch(110);
        colour = QColor(135,135,135);
        break;
    case eF46:
        /*F46
        NUMERICAL VALUE SELECTION 2
        Font: Prototype
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        ALT Color: R0 G0 B0
        (selected state)
        Styling: Tracking +25, Horz Scaling 110%
        Note: In string OUM values (%) use Interstate - Bold 12px.*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(18);
        font.setStretch(110);
        colour = alt ? Qt::black : Qt::white;
        break;
    case eF47:
        /*F47
        CRUISE & TROLL SINGLE
        NUMERICAL VALUE
        Font: Prototype
        Default Size: 36 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G20 B0
        ALT Color: R255 G255 B255
        (unselected)
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(36);
        //font.setStretch(110);
        colour = alt ? Qt::white : Qt::black;
        break;
    case eF48:
        /*F48
        CRUISE & TROLL SINGLE
        NUMERICAL VALUE UOM
        Font: Prototype
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G20 B0
        ALT Color: R255 G255 B255
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(16);
        font.setStretch(110);
        colour = alt ? Qt::white : Qt::black;
        break;
    case eF49:
        /*F49
        CRUISE & TROLL DUAL
        NUMERICAL VALUE
        Font: Prototype
        Default Size: 24 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G20 B0
        ALT Color: R255 G255 B255
        (unselected)
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(24);
        font.setStretch(110);
        colour = alt ? Qt::white : Qt::black;
        break;
    case eF50:
        /*F50
        CRUISE & TROLL DUAL
        NUMERICAL VALUE UOM
        Font: Prototype
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color: R0 G20 B0
        ALT Color: R255 G255 B255
        (unselected)
        Styling: Tracking +25, Horz Scaling 110%*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(14);
        font.setStretch(110);
        colour = alt ? Qt::white : Qt::black;
        break;
    case eF51:
        /*F51
        GEAR POSITION TEXT INDICATOR
        Font: Interstate - Regular
        Default Size: 15 pixels
        Font Scaling: NONE
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(15);
        font.setStretch(110);
        break;
    case eF52:
        /*F52
        TRIM & TAB FOOTER INDICATOR
        Font: Interstate - Regular
        Default Size: 9 pixels
        Font Scaling: NONE
        Color: R166 G168 B171
        Styling: None/Default
        Styling: Tracking -50*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(9);
        font.setStretch(110);
        colour = QColor(166,168,171);
        break;
    case eF53:
        /*F53
        AUTOPILOT WAYPOINT SUB-HEADER
        Font: Interstate - Regular
        Default Size: 18 pixels
        Font Scaling: NONE
        Color: R251 G176 B59
        Styling: None/Default
        Styling: Tracking -50*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(18);
        colour = cColorComputerControlledActive;
        break;
    case eF54:
        /*LARGE ENGINE NAME
        Font: Interstate - Bold
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R180 G180 B180
        ALT Size: R255 G255 B255
        (Exit screen good stewardship message)
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(18);
        colour = alt ? Qt::white : QColor(180,180,180);
        break;
    case eF55:
        /*MAINTENANCE TEXT
        Font: Interstate - Bold
        Default Size: 11 pixels
        ALT Size: 14 pixels
        (Reset maintnence body text)
        ALT Size: 15 pixels
        (Exit screen maintnence body text)
        Font Scaling: Dynamically down to fit
        Color: R0 G200 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(alt ? 14 : 11);
        colour =  QColor(0,200,255);
        break;
    case eF56:
    case eF56_AltColor:
        /*F56
        VALUE DESCRIPTION (SM)
        Font: Interstate - Bold
        Default Size: 13 pixels
        Font Scaling: Dynamically down to fit
        Color: R135 G135 B135
        Alt Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize(13);
        switch ( identifier )
        {
        case eF56:
            colour = QColor(135,135,135);
            break;
        case eF56_AltColor:
            colour = QColor(Qt::white);
            break;
        default:
            break;
        }
        break;
    case eF59:
        /*F59
        NUMBER (LRG)
        Font: Prototype
        Default Size: 45 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize(45);
        break;
    case eF60_NotOptimised:
    case eF60_Optimised:
        /*F60
        ECO OPTIMIZED STATE TEXT
        Font: Interstate - Regular
        Default Size: 14 pixels
        Font Scaling: Dynamically down to fit
        Color (not optimized): R253 G240 B12
        Color (optimized): R94 G190 B67
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFont();
        font.setPixelSize(14);
        switch( identifier )
        {
        case eF60_NotOptimised:
            colour = QColor( 253, 240, 12 );
            break;
        case eF60_Optimised:
            colour = QColor( 94, 190, 67 );
            break;
        default:
            break;
        }
        break;
    case eF61:
        /*F61
        SYSTEM OK PANEL HEADING
        Font: Interstate - Regular
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize( 20 );
        colour = QColor( 255, 255, 255);
        break;
    case eF62:
        /*F62
        SYSTEM OK LABEL TEXT
        Font: Interstate - Regular
        Default Size: 16 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize( 16 );
        colour = QColor( 185, 185, 185);
        break;
    case eF63:
        /*F63
        SYSTEM OK DATA TEXT
        Font: Interstate - Regular
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize( 18 );
        colour = QColor( 120, 200, 70);
        break;
    case eF64:
        /*F64
        FUEL VALUE TEXT
        Font: Interstate - Regular
        Default Size: 36 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetNumericFont();
        font.setPixelSize( 40 );
        colour = QColor( 255, 255, 255);
        break;
    case eF65:
        /*F65
        FUEL UNIT TEXT
        Font: Interstate - Regular
        Default Size: 18 pixels
        Font Scaling: Dynamically down to fit
        Color: R255 G255 B255
        Styling: None/Default*/
        font = MercuryPalette::GetAlphabeticFontBold();
        font.setPixelSize( 18 );
        colour = QColor( 255, 255, 255);
        break;
    default:
        break;
    }

    font.setPixelSize( qRound( font.pixelSize() * ( 1 / AppScaleFactor ) * ContextPanelScaleFactor ) );

    // never use bold for SimHei, Asian Font
    if ( font.family() == "SimHei" )
    {
        font.setBold(false);
    }

    tTextStyle style;
    style.font = font;
    style.colour = colour;
    return style;
}