settings: provide a way to disable asking for locked screen's width

This commit is contained in:
Andrzej Rybczak
2011-11-12 20:40:55 +01:00
parent 0e883db375
commit 1415964f95
5 changed files with 25 additions and 9 deletions

View File

@@ -355,6 +355,8 @@
#
#locked_screen_width_part = "50"
#
#ask_for_locked_screen_width_part = "yes"
#
##
## Note: You can define startup screen for ncmpcpp
## by choosing screen number from the list above.

View File

@@ -255,6 +255,9 @@ If set to "previous", key_screen_switcher will switch between current and last u
.B locked_screen_width_part = 20-80
If you want to lock a screen, ncmpcpp asks for % of locked screen's width to be reserved before that and provides a default value, which is the one you can set here.
.TP
.B ask_for_locked_screen_width_part = yes/no
If enabled, ncmpcpp will ask for % of locked screen's width each time you want to lock a screen. If you disable that, it'll silently attempt to use default value.
.TP
.B startup_screen = SCREEN_NUMBER
Screen that has to be displayed at start (playlist by default).
.TP

View File

@@ -1724,16 +1724,20 @@ int main(int argc, char *argv[])
}
else
{
LockStatusbar();
Statusbar() << "% of the locked screen's width to be reserved (20-80): ";
std::string str_part = wFooter->GetString(IntoStr(Config.locked_screen_width_part*100));
UnlockStatusbar();
if (str_part.empty())
continue;
unsigned part = StrToInt(str_part);
int part = Config.locked_screen_width_part*100;
if (Config.ask_for_locked_screen_width_part)
{
LockStatusbar();
Statusbar() << "% of the locked screen's width to be reserved (20-80): ";
std::string str_part = wFooter->GetString(IntoStr(Config.locked_screen_width_part*100));
UnlockStatusbar();
if (str_part.empty())
continue;
part = StrToInt(str_part);
}
if (part < 20 || part > 80)
{
ShowMessage("Invalid number!");
ShowMessage("Invalid number (%d)!", part);
continue;
}
Config.locked_screen_width_part = part/100.0;

View File

@@ -446,6 +446,7 @@ void NcmpcppConfig::SetDefaults()
media_library_disable_two_column_mode = false;
discard_colors_if_item_is_selected = true;
store_lyrics_in_song_dir = false;
ask_for_locked_screen_width_part = true;
set_window_title = true;
mpd_port = 6600;
mpd_connection_timeout = 15;
@@ -1150,10 +1151,15 @@ void NcmpcppConfig::Read()
}
else if (name == "locked_screen_width_part")
{
unsigned part = StrToInt(v);
int part = StrToInt(v);
if (part)
locked_screen_width_part = part/100.0;
}
else if (name == "ask_for_locked_screen_width_part")
{
if (!v.empty())
ask_for_locked_screen_width_part = v == "yes";
}
else if (name == "song_window_title_format")
{
if (!v.empty() && MPD::Song::isFormatOk("song_window_title_format", v))

View File

@@ -257,6 +257,7 @@ struct NcmpcppConfig
bool media_library_disable_two_column_mode;
bool discard_colors_if_item_is_selected;
bool store_lyrics_in_song_dir;
bool ask_for_locked_screen_width_part;
int mpd_port;
int mpd_connection_timeout;