mirror of
https://github.com/Garux/netradiant-custom.git
synced 2026-09-28 00:00:03 +02:00
* adjust icons in light GUI themes for better visibility
This commit is contained in:
@@ -1150,6 +1150,7 @@ misc...
|
||||
* do Run Engine After Compile also after unmonitored builds
|
||||
* support distinct lighting from different sky shaders in one map (by Tom Arrow)
|
||||
* -onesky: fallback to old behavior: any sky emits total of all suns/skylights in the map
|
||||
* adjust icons in light GUI themes for better visibility
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "os/path.h"
|
||||
#include "string/string.h"
|
||||
#include "stream/stringstream.h"
|
||||
#include <QDir>
|
||||
|
||||
|
||||
namespace
|
||||
@@ -36,6 +37,34 @@ void BitmapsPath_set( const char* path ){
|
||||
g_bitmapsPath = path;
|
||||
}
|
||||
|
||||
void Bitmaps_generateLight( const char *appPath ){
|
||||
for( const char *root : { "", "plugins/" } )
|
||||
{
|
||||
QDir from( QString( appPath ) + root + "bitmaps/" );
|
||||
QDir to( QString( appPath ) + root + "bitmaps_light/" );
|
||||
for( auto *d : { &from, &to } ){
|
||||
d->setNameFilters( QStringList() << "*.svg" << "*.png" << "*.ico" );
|
||||
d->setFilter( QDir::Filter::Files );
|
||||
}
|
||||
|
||||
if( to.count() < from.count() ){
|
||||
to.mkpath( to.absolutePath() );
|
||||
for( const QFileInfo& fileinfo : from.entryInfoList() )
|
||||
{
|
||||
QFile file( fileinfo.absoluteFilePath() );
|
||||
if( file.open( QIODevice::OpenModeFlag::ReadOnly ) ){
|
||||
QByteArray data( file.readAll() );
|
||||
if( fileinfo.suffix() == "svg" )
|
||||
data.replace( "#C0C0C0", "#575757" );
|
||||
QFile outfile( to.absolutePath() + '/' + fileinfo.fileName() );
|
||||
if( outfile.open( QIODevice::OpenModeFlag::WriteOnly ) )
|
||||
outfile.write( data );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap new_local_image( const char* filename ){
|
||||
StringOutputStream fullpath( 256 );
|
||||
|
||||
@@ -47,6 +76,9 @@ QPixmap new_local_image( const char* filename ){
|
||||
}
|
||||
|
||||
QIcon new_local_icon( const char* filename ){
|
||||
if( QString name( CopiedString( PathExtensionless( filename ) ).c_str() ); QIcon::hasThemeIcon( name ) )
|
||||
return QIcon::fromTheme( name );
|
||||
|
||||
StringOutputStream fullpath( 256 );
|
||||
|
||||
for( const auto *ext : { ".svg", ".png", ".ico" } )
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
void BitmapsPath_set( const char* path );
|
||||
void Bitmaps_generateLight( const char *appPath );
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "itoolbar.h"
|
||||
#include "gtkmisc.h"
|
||||
#include "gtkutil/image.h"
|
||||
#include "modulesystem.h"
|
||||
|
||||
#include "stream/stringstream.h"
|
||||
@@ -55,7 +56,7 @@ void toolbar_insert( QToolBar *toolbar, const char* icon, const char* text, cons
|
||||
return;
|
||||
case IToolbarButton::eButton:
|
||||
{
|
||||
toolbar_append_button( toolbar, tooltip, new_plugin_icon( icon ), plugin_construct_command_name( pluginName, text ).c_str() );
|
||||
toolbar_append_button( toolbar, tooltip, new_local_icon( icon ), plugin_construct_command_name( pluginName, text ).c_str() );
|
||||
// QAction *button = toolbar->addAction( new_plugin_icon( icon ), text, [ibutton](){ ibutton->activate(); } );
|
||||
// button->setToolTip( tooltip );
|
||||
}
|
||||
@@ -65,7 +66,7 @@ void toolbar_insert( QToolBar *toolbar, const char* icon, const char* text, cons
|
||||
//. fixme need consistent plugin command names (same in menu and toolbar) for the current command system
|
||||
// now they are defined in 3 places, also must be used in menu to work in toolbar
|
||||
// also no defined toggle menu item support (->setCheckable( true ) is some workaround now)
|
||||
toolbar_append_button( toolbar, tooltip, new_plugin_icon( icon ), plugin_construct_command_name( pluginName, text ).c_str() )->setCheckable( true );
|
||||
toolbar_append_button( toolbar, tooltip, new_local_icon( icon ), plugin_construct_command_name( pluginName, text ).c_str() )->setCheckable( true );
|
||||
// toolbar_append_toggle_button( toolbar, tooltip, new_plugin_icon( icon ), plugin_construct_command_name( pluginName, text ).c_str() );
|
||||
// QAction *button = toolbar->addAction( new_plugin_icon( icon ), text, [ibutton](){ ibutton->activate(); } );
|
||||
// button->setToolTip( tooltip );
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "mainframe.h"
|
||||
#include "preferencesystem.h"
|
||||
#include "stringio.h"
|
||||
#include "stream/stringstream.h"
|
||||
#include "gtkutil/image.h"
|
||||
|
||||
|
||||
enum class ETheme{
|
||||
@@ -46,6 +48,14 @@ QString load_qss( const char *filename ){
|
||||
return {};
|
||||
}
|
||||
|
||||
void set_icon_theme( bool light ){
|
||||
static auto init = ( Bitmaps_generateLight( AppPath_get() ), QIcon::setThemeSearchPaths( QIcon::themeSearchPaths() << AppPath_get() ), 1 );
|
||||
(void)init;
|
||||
|
||||
BitmapsPath_set( StringStream( AppPath_get(), light? "bitmaps_light/" : "bitmaps/" ) );
|
||||
QIcon::setThemeName( light? "bitmaps_light" : "bitmaps" );
|
||||
}
|
||||
|
||||
void theme_set( ETheme theme ){
|
||||
s_theme = theme;
|
||||
#ifdef WIN32
|
||||
@@ -61,6 +71,7 @@ void theme_set( ETheme theme ){
|
||||
defaults;
|
||||
|
||||
if( theme == ETheme::Default ){
|
||||
set_icon_theme( true );
|
||||
if( !defaults.is1stThemeApplication ){
|
||||
qApp->setPalette( defaults.palette );
|
||||
qApp->setStyleSheet( QString() );
|
||||
@@ -68,11 +79,13 @@ void theme_set( ETheme theme ){
|
||||
}
|
||||
}
|
||||
else if( theme == ETheme::Fusion ){
|
||||
set_icon_theme( true );
|
||||
qApp->setPalette( defaults.palette );
|
||||
qApp->setStyleSheet( load_qss( "fusion.qss" ) ); //missing, stub to load custom qss
|
||||
qApp->setStyle( "Fusion" );
|
||||
}
|
||||
else if( theme == ETheme::Dark ){
|
||||
set_icon_theme( false );
|
||||
qApp->setStyle( "Fusion" );
|
||||
QPalette darkPalette;
|
||||
const QColor darkColor = QColor( 83, 84, 81 );
|
||||
@@ -104,6 +117,7 @@ void theme_set( ETheme theme ){
|
||||
qApp->setStyleSheet( load_qss( "dark.qss" ) );
|
||||
}
|
||||
else if( theme == ETheme::Darker ){
|
||||
set_icon_theme( false );
|
||||
qApp->setStyle( "Fusion" );
|
||||
QPalette darkPalette;
|
||||
const QColor darkColor = QColor( 45, 45, 45 );
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve">
|
||||
<polyline fill="none" stroke="#E59024" stroke-width="8" stroke-miterlimit="10" points="8,64 56,64 90,98 "/>
|
||||
<polyline fill="#C0C0C0" stroke="#DBDADA" stroke-width="4" stroke-miterlimit="10" points="8,50 58,50 58,30 8,30 "/>
|
||||
<polyline fill="#C0C0C0" stroke="#DBDADA" stroke-width="6" stroke-miterlimit="10" points="102.94,85 70.94,53 84.94,39 116.94,71
|
||||
"/>
|
||||
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#E59024;stroke-width:8;stroke-miterlimit:10;}
|
||||
.st1{fill:#DBDADA;stroke:#C0C0C0;stroke-width:4.8652;stroke-miterlimit:10;}
|
||||
.st2{fill:#DBDADA;stroke:#C0C0C0;stroke-width:5;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<polyline class="st0" points="8,64 56,64 90,98 "/>
|
||||
<polyline class="st1" points="8,50 55.3,50 55.3,30 8,30 "/>
|
||||
<polyline class="st2" points="102.9,85 70.3,52.3 84.3,38.3 116.9,71 "/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 803 B |
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve">
|
||||
<polyline fill="none" stroke="#E59024" stroke-width="8" stroke-miterlimit="10" points="8,64 56,64 90,98 "/>
|
||||
<polyline fill="#C0C0C0" stroke="#DBDADA" stroke-width="4" stroke-miterlimit="10" points="8,50 54,50 34,30 8,30 "/>
|
||||
<polyline fill="#C0C0C0" stroke="#DBDADA" stroke-width="6" stroke-miterlimit="10" points="102.94,85 75.94,59 103.96,59.04
|
||||
116.94,71 "/>
|
||||
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:none;stroke:#E59024;stroke-width:8;stroke-miterlimit:10;}
|
||||
.st1{fill:#DBDADA;stroke:#C0C0C0;stroke-width:5;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<polyline class="st0" points="8,64 56,64 90,98 "/>
|
||||
<polyline class="st1" points="8,50 54,50 34,30 8,30 "/>
|
||||
<polyline class="st1" points="102.9,85 75.9,59 104,59 116.9,71 "/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 716 B |
@@ -4,7 +4,7 @@
|
||||
viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve">
|
||||
<polygon fill="#8E8E8E" points="64,64 64,116 12,64 "/>
|
||||
<polygon fill="#8E8E8E" points="64,64 64,12 12,64 "/>
|
||||
<polygon fill="#C0C0C0" points="64,64 64,12 12,64 "/>
|
||||
<polygon fill="#C0C0C1" points="64,64 64,12 12,64 "/>
|
||||
<polygon fill="#8E8E8E" points="64,64 64,116 12,64 "/>
|
||||
<polygon fill="#9D9D9D" points="64,64 64,12 116,64 "/>
|
||||
<polygon fill="#7A7A7A" points="64,64 64,116 116,64 "/>
|
||||
|
||||
|
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
@@ -0,0 +1,16 @@
|
||||
[Icon Theme]
|
||||
Name=DarkIcons
|
||||
Comment=DarkIcons
|
||||
Directories=.,../plugins/bitmaps
|
||||
|
||||
[.]
|
||||
Size=32
|
||||
Type=Scalable
|
||||
MinSize=8
|
||||
MaxSize=256
|
||||
|
||||
[../plugins/bitmaps]
|
||||
Size=32
|
||||
Type=Scalable
|
||||
MinSize=8
|
||||
MaxSize=256
|
||||
@@ -0,0 +1,16 @@
|
||||
[Icon Theme]
|
||||
Name=LightIcons
|
||||
Comment=LightIcons
|
||||
Directories=.,../plugins/bitmaps
|
||||
|
||||
[.]
|
||||
Size=32
|
||||
Type=Scalable
|
||||
MinSize=8
|
||||
MaxSize=256
|
||||
|
||||
[../plugins/bitmaps_light]
|
||||
Size=32
|
||||
Type=Scalable
|
||||
MinSize=8
|
||||
MaxSize=256
|
||||
Reference in New Issue
Block a user