* The default stylesheets are now embedded into the program itself. It is

still possible to amend them by creating external ones, though.
This commit is contained in:
Konstantin Isakov 2009-02-08 17:21:46 +00:00
parent 2f27e8d9e6
commit 62cb2479ed
6 changed files with 41 additions and 15 deletions

View file

@ -229,3 +229,5 @@ div.sdct_x
{
margin: 0;
}

View file

@ -29,14 +29,20 @@ std::string ArticleMaker::makeHtmlHeader( QString const & word,
"<html><head>"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
// Add a css stylesheet
QFile builtInCssFile( ":/article-style.css" );
builtInCssFile.open( QFile::ReadOnly );
QByteArray css = builtInCssFile.readAll();
QFile cssFile( Config::getUserCssFileName() );
if ( cssFile.open( QFile::ReadOnly ) )
{
result += "<style type=\"text/css\">\n";
result += cssFile.readAll().data();
result += "</style>\n";
}
css += cssFile.readAll();
result += "<style type=\"text/css\">\n";
result += css.data();
result += "</style>\n";
result += "<title>" + Html::escape( Utf8::encode( word.toStdWString() ) ) + "</title>";

View file

@ -281,7 +281,7 @@ QString getIndexDir() throw( exError )
QString getUserCssFileName() throw( exError )
{
return getHomeDir().filePath( "style.css" );
return getHomeDir().filePath( "article-style.css" );
}
QString getUserQtCssFileName() throw( exError )

View file

@ -12,15 +12,20 @@ int main( int argc, char ** argv )
app.setWindowIcon( QIcon( ":/icons/programicon.png" ) );
// Try loading a style sheet if there's one
#if 1
QFile cssFile( Config::getUserQtCssFileName() );
if ( cssFile.open( QFile::ReadOnly ) )
app.setStyleSheet( cssFile.readAll() );
#endif
// Apply qt stylesheet
{
QFile builtInCssFile( ":/qt-style.css" );
builtInCssFile.open( QFile::ReadOnly );
QByteArray css = builtInCssFile.readAll();
// Try loading a style sheet if there's one
QFile cssFile( Config::getUserQtCssFileName() );
if ( cssFile.open( QFile::ReadOnly ) )
css += cssFile.readAll();
app.setStyleSheet( css );
}
MainWindow m;

11
src/qt-style.css Normal file
View file

@ -0,0 +1,11 @@
MainWindow #centralWidget #translateLine, MainWindow #centralWidget #wordList
{
background: #fefdeb;
}
.ScanPopup #outerFrame
{
border: 1px solid grey;
}

View file

@ -9,5 +9,7 @@
<file>icons/next.png</file>
<file>icons/previous.png</file>
<file>icons/programicon.png</file>
<file>article-style.css</file>
<file>qt-style.css</file>
</qresource>
</RCC>