mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 13:24:05 +00:00
* 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:
parent
2f27e8d9e6
commit
62cb2479ed
|
@ -229,3 +229,5 @@ div.sdct_x
|
|||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
|
@ -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>";
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
23
src/main.cc
23
src/main.cc
|
@ -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
11
src/qt-style.css
Normal file
|
@ -0,0 +1,11 @@
|
|||
MainWindow #centralWidget #translateLine, MainWindow #centralWidget #wordList
|
||||
{
|
||||
background: #fefdeb;
|
||||
}
|
||||
|
||||
.ScanPopup #outerFrame
|
||||
{
|
||||
border: 1px solid grey;
|
||||
}
|
||||
|
||||
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue