Skip to content

Commit ca532bd

Browse files
committed
Merge branch 'update_time_spent' of github.com:Htylol/PortWINE into Htylol-update_time_spent
2 parents 6216ad6 + 43630f4 commit ca532bd

File tree

5 files changed

+68
-32
lines changed

5 files changed

+68
-32
lines changed

data_from_portwine/locales/PortProton.pot

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
msgid ""
88
msgstr "Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-02-27 20:05+0500\n"
10+
"POT-Creation-Date: 2025-03-02 01:22+0500\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -1415,6 +1415,12 @@ msgid "If downloading steam covers is enabled, they will be downloaded and "
14151415
"is unavailable for some reason)"
14161416
msgstr ""
14171417

1418+
msgid "Show in hours and minutes"
1419+
msgstr ""
1420+
1421+
msgid "Show in days, hours, minutes"
1422+
msgstr ""
1423+
14181424
msgid "Recommended value"
14191425
msgstr ""
14201426

data_from_portwine/locales/es/LC_MESSAGES/PortProton.po

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: \n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-02-27 20:05+0500\n"
11+
"POT-Creation-Date: 2025-03-02 01:22+0500\n"
1212
"PO-Revision-Date: 2024-11-13 08:18+0500\n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -1844,6 +1844,12 @@ msgstr ""
18441844
"crearán. (La desactivación se proporciona en los casos en que su descarga no "
18451845
"esté disponible por algún motivo)"
18461846

1847+
msgid "Show in hours and minutes"
1848+
msgstr ""
1849+
1850+
msgid "Show in days, hours, minutes"
1851+
msgstr ""
1852+
18471853
msgid "Recommended value"
18481854
msgstr ""
18491855

data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-02-27 20:05+0500\n"
11-
"PO-Revision-Date: 2025-02-27 20:06+0500\n"
10+
"POT-Creation-Date: 2025-03-02 01:22+0500\n"
11+
"PO-Revision-Date: 2025-03-02 01:22+0500\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
1414
"Language: ru_RU\n"
@@ -1832,6 +1832,12 @@ msgstr ""
18321832
"создаваться. (Отключение предусмотрено в тех случаях, когда их скачивание по "
18331833
"каким-то причинам недоступно)"
18341834

1835+
msgid "Show in hours and minutes"
1836+
msgstr "Отображать в часах и минутах"
1837+
1838+
msgid "Show in days, hours, minutes"
1839+
msgstr "Отображать в днях, часах и минутах"
1840+
18351841
msgid "Recommended value"
18361842
msgstr "Рекомендуемое значение"
18371843

data_from_portwine/scripts/functions_helper

+37-25
Original file line numberDiff line numberDiff line change
@@ -1248,22 +1248,24 @@ create_name_desktop () {
12481248

12491249
# Конвертация секунд в дни, часы, минуты
12501250
seconds_to_time () {
1251-
[[ ! $DESKTOP_WITH_TIME == enabled ]] && return 0
1251+
[[ $DESKTOP_WITH_TIME == "disabled" ]] && return 0
12521252
[[ -z $1 ]] && return 0
12531253
local seconds days hours minutes
12541254
seconds=$1
12551255

1256-
days=$((seconds / (60 * 60 * 24)))
1257-
seconds=$((seconds % (60 * 60 * 24)))
1256+
if [[ $DESKTOP_WITH_TIME == "posnumber2" ]] ; then
1257+
days=$((seconds / (60 * 60 * 24)))
1258+
seconds=$((seconds % (60 * 60 * 24)))
1259+
fi
12581260

12591261
hours=$((seconds / (60 * 60)))
12601262
seconds=$((seconds % (60 * 60)))
12611263

12621264
minutes=$((seconds / 60))
12631265
seconds=$((seconds % 60))
12641266

1265-
if [[ $days =~ ^0$ ]] ; then
1266-
days=
1267+
if [[ $days == "0" ]] ; then
1268+
days=""
12671269
elif [[ $days =~ ^1$ ]] ; then
12681270
days="$days ${translations[day]}, "
12691271
elif [[ $days =~ ^([2-9]1|[1-9][0-9]+1)$ ]] && [[ $LANGUAGE == ru ]] ; then
@@ -1274,26 +1276,29 @@ seconds_to_time () {
12741276
days="$days ${translations[days]}, "
12751277
fi
12761278

1277-
if [[ $hours =~ ^0$ ]] ; then
1278-
hours=
1279+
if [[ $hours == "0" ]] ; then
1280+
hours=""
12791281
elif [[ $hours =~ ^1$ ]] ; then
12801282
hours="$hours ${translations[hour]} ${translations[and]} "
1281-
elif [[ $hours =~ ^([2-4]|2[2-4])$ ]] && [[ $LANGUAGE == ru ]] ; then
1283+
elif [[ $hours =~ [2-4]$ && ! $hours =~ ^1[2-4]$ ]] && [[ $LANGUAGE == ru ]] ; then
12821284
hours="$hours часа ${translations[and]} "
1283-
elif [[ $hours =~ ^21$ ]] && [[ $LANGUAGE == ru ]] ; then
1285+
elif [[ $hours =~ 1$ && ! $hours =~ 11$ ]] && [[ $LANGUAGE == ru ]] ; then
12841286
hours="$hours ${translations[hour]} ${translations[and]} "
12851287
else
12861288
hours="$hours ${translations[hours]} ${translations[and]} "
12871289
fi
12881290

1289-
if [[ $minutes =~ ^0$ ]] ; then
1290-
hours=${hours//" ${translations[and]} "/}
1291-
minutes=
1292-
if [[ -z $days ]] || [[ -z $hours ]] ; then
1293-
days=${days//","/}
1294-
fi
1295-
if [[ -z $days ]] && [[ -z $hours ]] ; then
1291+
if [[ $minutes == "0" ]] ; then
1292+
minutes=""
1293+
if [[ $DESKTOP_WITH_TIME == "posnumber1" && -z $hours ]] \
1294+
|| [[ $DESKTOP_WITH_TIME == "posnumber2" && -z $days && -z $hours ]]; then
12961295
minutes="${translations[less than a minute]}"
1296+
else
1297+
hours=${hours//" ${translations[and]} "/}
1298+
if [[ $DESKTOP_WITH_TIME == "posnumber2" ]] \
1299+
&& [[ -z $days || -z $hours ]] ; then
1300+
days=${days//","/}
1301+
fi
12971302
fi
12981303
elif [[ $minutes =~ ^1$ ]] ; then
12991304
minutes="$minutes ${translations[minute]}"
@@ -1305,7 +1310,11 @@ seconds_to_time () {
13051310
minutes="$minutes ${translations[minutes]}"
13061311
fi
13071312

1308-
echo -e "<b>\n${translations[Time spent]}: $days$hours$minutes</b>"
1313+
if [[ $DESKTOP_WITH_TIME == "posnumber1" ]] ; then
1314+
echo -e "<b>\n${translations[Time spent]}: $hours$minutes</b>"
1315+
elif [[ $DESKTOP_WITH_TIME == "posnumber2" ]] ; then
1316+
echo -e "<b>\n${translations[Time spent]}: $days$hours$minutes</b>"
1317+
fi
13091318
}
13101319

13111320
combobox_fix () {
@@ -6015,10 +6024,10 @@ gui_userconf () {
60156024
GPU_VAR="disabled"
60166025
fi
60176026

6018-
if [[ -n "$DESKTOP_WITH_TIME" ]] \
6019-
&& [[ "$DESKTOP_WITH_TIME" != "disabled" ]]
6020-
then
6021-
DESKTOP_WITH_TIME="enabled"
6027+
if [[ $DESKTOP_WITH_TIME == "posnumber1" ]] ; then
6028+
DESKTOP_WITH_TIME=${translations[Show in hours and minutes]}
6029+
elif [[ $DESKTOP_WITH_TIME == "posnumber2" ]] ; then
6030+
DESKTOP_WITH_TIME=${translations[Show in days, hours, minutes]}
60226031
else
60236032
DESKTOP_WITH_TIME="disabled"
60246033
fi
@@ -6042,9 +6051,9 @@ gui_userconf () {
60426051
YAD_DPI_VAR="disabled"
60436052
fi
60446053

6045-
if [[ $GUI_THEME == default ]] ; then GUI_THEME=${translations[default]}
6046-
elif [[ $GUI_THEME == compact ]] ; then GUI_THEME=${translations[compact]}
6047-
elif [[ $GUI_THEME == classic ]] ; then GUI_THEME=${translations[classic]}
6054+
if [[ $GUI_THEME == "default" ]] ; then GUI_THEME=${translations[default]}
6055+
elif [[ $GUI_THEME == "compact" ]] ; then GUI_THEME=${translations[compact]}
6056+
elif [[ $GUI_THEME == "classic" ]] ; then GUI_THEME=${translations[classic]}
60486057
fi
60496058

60506059
if command -v gsettings &>/dev/null ; then
@@ -6064,7 +6073,7 @@ gui_userconf () {
60646073
--field="${translations[Choice wine audio driver]}!${translations[Fixes sound popling if choice alsa]} :CB" "$(combobox_fix --disabled "$SOUND_DRIVER_VAR" "alsa!oss!pulse")" \
60656074
--field="${translations[Select PortProton theme]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "${translations[default]}!${translations[compact]}!${translations[classic]}")" \
60666075
--field="${translations[Select gtk theme]}!${translations[Allows you to select a theme for GTK.]} :CB" "$(combobox_fix "$GTK_THEME" "${YAD_GTK_THEME}Adwaita:${translations[light]}!Adwaita:${translations[dark]}!${translations[default]}")" \
6067-
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "enabled")" \
6076+
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "${translations[Show in hours and minutes]}!${translations[Show in days, hours, minutes]}")" \
60686077
--field="${translations[Sort shortcuts by time]}!${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" "$(combobox_fix --disabled "$SORT_WITH_TIME" "enabled")" \
60696078
1> "${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb" 2>/dev/null &
60706079

@@ -6116,6 +6125,9 @@ gui_userconf () {
61166125
elif [[ $GTK_THEME =~ ${translations[light]} ]] ; then GTK_THEME=${GTK_THEME//${translations[light]}/light}
61176126
elif [[ $GTK_THEME =~ ${translations[dark]} ]] ; then GTK_THEME=${GTK_THEME//${translations[dark]}/dark}
61186127
fi
6128+
if [[ $DESKTOP_WITH_TIME == "${translations[Show in hours and minutes]}" ]] ; then DESKTOP_WITH_TIME="posnumber1"
6129+
elif [[ $DESKTOP_WITH_TIME == "${translations[Show in days, hours, minutes]}" ]] ; then DESKTOP_WITH_TIME="posnumber2"
6130+
fi
61196131

61206132
edit_user_conf_from_gui PW_GPU_USE PW_WINE_DPI_VALUE PW_SOUND_DRIVER_USE GUI_THEME GTK_THEME DESKTOP_WITH_TIME SORT_WITH_TIME
61216133
restart_pp

data_from_portwine/scripts/start.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,16 @@ if [[ ! $PW_GUI_START =~ (PANED|NOTEBOOK) ]] ; then
264264
export PW_GUI_START="NOTEBOOK"
265265
fi
266266

267+
# DESKTOP_WITH_TIME by default displays hours and minutes
268+
if [[ -z $DESKTOP_WITH_TIME ]] ; then
269+
echo 'export DESKTOP_WITH_TIME="posnumber1"' >> "$USER_CONF"
270+
export DESKTOP_WITH_TIME="posnumber1"
271+
fi
272+
267273
# TODO:fixes_after_update
268-
if fixes_after_update "2372: Reset PW_WINE_DPI_VALUE in user.conf" ; then
269-
sed -i '/export PW_WINE_DPI_VALUE=/d' "$USER_CONF"
270-
unset PW_WINE_DPI_VALUE
274+
if fixes_after_update "2395: DESKTOP_WITH_TIME by default displays hours and minutes" ; then
275+
DESKTOP_WITH_TIME="posnumber1"
276+
edit_user_conf_from_gui DESKTOP_WITH_TIME
271277
fi
272278

273279
# choose wine dpi default

0 commit comments

Comments
 (0)