void DeviceDetailViewFrame::applyStyle()
{
    QFile cssFile(GENIE2_RES(DETAILVIEWFRAME_STYLEFILE));
    if (cssFile.open(QIODevice::ReadOnly)) {
        setStyleSheet(QString::fromUtf8(cssFile.readAll().data()));
    }
}
Esempio n. 2
0
// Sets some application settings.
static void initApplication()
{
    QApplication::setEffectEnabled(Qt::UI_FadeMenu, false);
    QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false);

    QApplication::setApplicationName("Enigma Studio 3");
    QApplication::setApplicationVersion(eENIGMA3_VERSION);
    QApplication::setOrganizationName("Brain Control");
    QApplication::setOrganizationDomain("http://www.braincontrol.org");

    QApplication::setWheelScrollLines(1);

#ifdef eRELEASE
    QFile cssFile(QApplication::applicationDirPath()+"/estudio3.css");
#else
	QFile cssFile(QApplication::applicationDirPath()+"/estudio3_debug.css");
#endif

	if (cssFile.open(QFile::ReadOnly))
	{
		qApp->setStyleSheet(QString(cssFile.readAll()));
	}
}
Esempio n. 3
0
TableView::TableView(QWidget *parent) : QTableView(parent)
{
	ui.setupUi(this);
	QFile cssFile(":table-css");
	cssFile.open(QIODevice::ReadOnly);
	QTextStream reader(&cssFile);
	QString css = reader.readAll();
	ui.tableView->setStyleSheet(css);
	/* There`s mostly a need for a Mac fix here too. */
	if (qApp->style()->objectName() == "gtk+")
		ui.groupBox->layout()->setContentsMargins(0, 9, 0, 0);
	else
		ui.groupBox->layout()->setContentsMargins(0, 0, 0, 0);
	QIcon plusIcon(":plus");
	plusBtn = new QPushButton(plusIcon, QString(), ui.groupBox);
	plusBtn->setFlat(true);
	plusBtn->setToolTip(tr("Add Cylinder"));
	plusBtn->setIconSize(QSize(16,16));
	connect(plusBtn, SIGNAL(clicked(bool)), this, SIGNAL(addButtonClicked()));
}
void KindleMainWindow::applyQtStyleSheet( QString const & displayStyle )
{
  QFile builtInCssFile( ":/qt-style.css" );
  builtInCssFile.open( QFile::ReadOnly );
  QByteArray css = builtInCssFile.readAll();

  if ( displayStyle.size() )
  {
    // Load an additional stylesheet
    QFile builtInCssFile( QString( ":/qt-style-st-%1.css" ).arg( displayStyle ) );
    builtInCssFile.open( QFile::ReadOnly );
    css += builtInCssFile.readAll();
  }

  // Try loading a style sheet if there's one
  QFile cssFile( Config::getUserQtCssFileName() );

  if ( cssFile.open( QFile::ReadOnly ) )
    css += cssFile.readAll();

  setStyleSheet( css );
}
Esempio n. 5
0
QString reports::ReportTable::renderHeader(const QString& title, bool includeCSS)
{
  QString header = QString("<!DOCTYPE HTML PUBLIC")
                   + " \"-//W3C//DTD HTML 4.01 //EN\""
                   + " \"http://www.w3.org/TR/html4/strict.dtd\">"
                   + "\n<html>\n<head>"
                   + "\n<meta http-equiv=\"Content-Type\""
                   + " content=\"text/html; charset=" + m_encoding + "\" />"
                   + "\n<title>" + title + "</title>";

  QString cssfilename = cssFileNameGet();

  if (includeCSS) {
    // include css inline
    QFile cssFile(cssfilename);
    if (cssFile.open(QIODevice::ReadOnly)) {
      QTextStream cssStream(&cssFile);
      header += QString("\n<style type=\"text/css\">")
                + "\n<!--\n"
                + cssStream.readAll()
                + "\n-->\n</style>\n";
      cssFile.close();
    } else {
      qDebug() << "reports::ReportTable::htmlHeaderGet: could not open file "
      << cssfilename << " readonly";
    }
  } else {
    // do not include css inline instead use a link to the css file
    header += "\n<link rel=\"stylesheet\" type=\"text/css\" href=\""
              + cssfilename + "\">\n";
  }

  header += KMyMoneyUtils::variableCSS();

  header += "</head>\n<body>\n";

  return header;
}
Esempio n. 6
0
bool MainWindow::loadStyleSheet(const QString &cssFileName)
{
    if (cssFileName.isEmpty())
        return false;

    QFile cssFile(cssFileName);
//    cssFile.setFileName(cssFileName);

    if (!cssFile.open(QIODevice::ReadOnly))
        return false;

    QTextStream stream(&cssFile);
    QString cssString = stream.readAll();

    cssFile.close();

    if (cssString.isEmpty())
        return false;

    QMainWindow::setStyleSheet(cssString);//Применить только к наследникам MainWindow(this)
//    qApp->setStyleSheet(cssString);//Применить ко всему приложению, но требуется объект QApplication

    return true;
}
Esempio n. 7
0
void PreviewDlg::UpdateBrowser(cxUpdateMode mode) {
	if (m_thread) return; // update in process

	// Do we have a temp file
	if (m_tempPath.empty()) {
		m_tempPath = wxFileName::CreateTempFileName(wxEmptyString);
		m_tempPath += wxT(".html");
		m_isFirst = true;
	}

	// Load the text of entire doc
	vector<char> text;
	if (m_pinnedEditor) {
		m_pinnedEditor->GetText(text);
		m_truePath = m_pinnedEditor->GetPath();
	}
	else {
		m_editorCtrl->GetText(text);
		m_truePath = m_editorCtrl->GetPath();
	}

	m_uncPath = ConvertPathToUNC(m_truePath);

	// Make sure we only update when the editor changes
	m_editorChangeToken = m_editorCtrl->GetChangeToken();
	m_editorCtrl->MarkPreviewDone();

	if (m_pipeCmd.empty()) {
		wxFile tempFile(m_tempPath, wxFile::write);
		if (!tempFile.IsOpened()) return;

		if (!text.empty()) {
			if (!m_truePath.empty()) {
				InsertBase(text, m_truePath);

				// Check if we should also save the current css file
				// (does not work with remote files as file has to be
				//  saved in same location as source)
				if (m_pinnedEditor && !m_editorCtrl->IsRemote()) {
					if (InsertStyle(text)) {
						wxFileOutputStream cssFile(m_tempCssPath);
						if (!cssFile.IsOk()) return;
						m_editorCtrl->WriteText(cssFile);
					}
				}
			}

			tempFile.Write(&*text.begin(), text.size());
		}

		if (mode == cxUPDATE_RELOAD || m_isFirst) RefreshBrowser(cxUPDATE_RELOAD);
		else RefreshBrowser(cxUPDATE_REFRESH);
	}
	else {
		cxEnv env;
		m_editorCtrl->SetEnv(env, true);
		const wxString cmd = m_editorCtrl->GetBashCommand(m_pipeCmd, env);
		if (cmd.empty()) return;

		// Thread will send event and delete itself when done
		m_thread = new CommandThread(cmd, text, m_tempPath, m_truePath, *this, env);
	}

	m_isOnPreview = true;
}