This commit is contained in:
Stanislav Nikitin 2018-11-10 20:58:15 +05:00
parent 39ac02dfc5
commit 2b3c9ef9ea
25 changed files with 1054 additions and 1022 deletions

View File

@ -10,6 +10,6 @@
package colorizer
func New() *Colorizer {
c := Colorizer {}
c := Colorizer{}
return &c
}

View File

@ -39,17 +39,50 @@ INSERT INTO database (version) VALUES (1);
// Migrate database to latest version.
// ToDo: make it more good :).
func migrate_full(db *Database, version int) {
if version < 1 {start_to_one(db); version = 1}
if version == 1 {one_to_two(db); version = 2}
if version == 2 {two_to_three(db); version = 3}
if version == 3 {three_to_four(db); version = 4}
if version == 4 {four_to_five(db); version = 5}
if version == 5 {five_to_six(db); version = 6 }
if version == 6 {six_to_seven(db); version = 7}
if version == 7 {seven_to_eight(db); version = 8}
if version == 8 {eight_to_nine(db); version = 9}
if version == 9 {nine_to_ten(db); version = 10}
if version == 10 {ten_to_eleven(db); version = 11}
if version < 1 {
start_to_one(db)
version = 1
}
if version == 1 {
one_to_two(db)
version = 2
}
if version == 2 {
two_to_three(db)
version = 3
}
if version == 3 {
three_to_four(db)
version = 4
}
if version == 4 {
four_to_five(db)
version = 5
}
if version == 5 {
five_to_six(db)
version = 6
}
if version == 6 {
six_to_seven(db)
version = 7
}
if version == 7 {
seven_to_eight(db)
version = 8
}
if version == 8 {
eight_to_nine(db)
version = 9
}
if version == 9 {
nine_to_ten(db)
version = 10
}
if version == 10 {
ten_to_eleven(db)
version = 11
}
}
// Initial database structure.

View File

@ -21,7 +21,7 @@ func ParseInfoToMap(data string) map[string]string {
srv_config = srv_config[1:]
// Parse server configuration into passed server's datamodel.
for i := 0; i < len(srv_config[1:]); i = i + 2 {
parsed_data[srv_config[i]] = srv_config[i + 1]
parsed_data[srv_config[i]] = srv_config[i+1]
}
return parsed_data
@ -37,7 +37,7 @@ func ParsePlayersInfoToMap(data string) map[string]map[string]string {
player_data := make(map[string]string)
if len(raw_player_data) > 1 {
nickname := strings.Join(raw_player_data[2:], " ")
player_data["nick"] = string([]byte(nickname)[1:len(nickname)-1])
player_data["nick"] = string([]byte(nickname)[1 : len(nickname)-1])
player_data["ping"] = raw_player_data[1]
player_data["frags"] = raw_player_data[0]
parsed_data[player_data["nick"]] = player_data

View File

@ -52,7 +52,7 @@ type Translator struct {
func (t *Translator) formatFromMap(data string, params map[string]string) string {
new_data := data
for k, v := range params {
new_data = strings.Replace(new_data, "{{ " + k + " }}", v, -1)
new_data = strings.Replace(new_data, "{{ "+k+" }}", v, -1)
}
return new_data
}

View File

@ -24,8 +24,8 @@ package translator
import (
// stdlib
"fmt"
"path/filepath"
"os"
"path/filepath"
)
// Detect language on Windows.

View File

@ -107,7 +107,6 @@ func (m *MainWindow) showAboutQtDialog(a bool) {
widgets.QMessageBox_AboutQt(m.window, "About Qt")
}
func (m *MainWindow) showOptionsDialog(a bool) {
fmt.Println("Showing options dialog...")
}

View File

@ -96,7 +96,7 @@ func (m *MainWindow) Initialize() {
} else {
g := m.window.Geometry()
w := g.Width()
m.splitter.MoveSplitter(w - 150, 1)
m.splitter.MoveSplitter(w-150, 1)
}
m.splitter.ConnectSplitterMoved(m.splitterMoved)
@ -114,11 +114,11 @@ func (m *MainWindow) initializeSidebar() {
// Server's information list.
m.sidebar_server_info = widgets.NewQTreeView(nil)
sidebar_layout.AddWidget(m.sidebar_server_info, 0, core.Qt__AlignHCenter & core.Qt__AlignTop)
sidebar_layout.AddWidget(m.sidebar_server_info, 0, core.Qt__AlignHCenter&core.Qt__AlignTop)
// Server's players widget.
m.sidebar_server_players = widgets.NewQTreeView(nil)
sidebar_layout.AddWidget(m.sidebar_server_players, 0, core.Qt__AlignHCenter & core.Qt__AlignTop)
sidebar_layout.AddWidget(m.sidebar_server_players, 0, core.Qt__AlignHCenter&core.Qt__AlignTop)
// Add spacer.
spacer := widgets.NewQSpacerItem(6, 6, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Expanding)
@ -162,7 +162,7 @@ func (m *MainWindow) initializeStorages() {
func (m *MainWindow) initializeTabs() {
m.splitter = widgets.NewQSplitter(nil)
m.splitter.SetOrientation(core.Qt__Horizontal)
m.vbox.AddWidget(m.splitter, 0, core.Qt__AlignHCenter & core.Qt__AlignTop)
m.vbox.AddWidget(m.splitter, 0, core.Qt__AlignHCenter&core.Qt__AlignTop)
m.tabs = widgets.NewQTabWidget(nil)
m.splitter.AddWidget(m.tabs)
@ -183,13 +183,13 @@ func (m *MainWindow) initializeTabs() {
// Servers list.
m.all_servers = widgets.NewQTreeView(nil)
serverspagewidget_layout.AddWidget(m.all_servers, 0, core.Qt__AlignLeft & core.Qt__AlignTop)
serverspagewidget_layout.AddWidget(m.all_servers, 0, core.Qt__AlignLeft&core.Qt__AlignTop)
// Servers list filters widget.
serverspagewidget_filters_widget := widgets.NewQWidget(nil, core.Qt__Widget)
serverspagewidget_filters_widget_policy := widgets.NewQSizePolicy2(widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__DefaultType)
serverspagewidget_filters_widget.SetSizePolicy(serverspagewidget_filters_widget_policy)
serverspagewidget_layout.AddWidget(serverspagewidget_filters_widget, 0, core.Qt__AlignRight & core.Qt__AlignTop)
serverspagewidget_layout.AddWidget(serverspagewidget_filters_widget, 0, core.Qt__AlignRight&core.Qt__AlignTop)
// Servers list filters layout.
serverspagewidget_filters_layout := widgets.NewQVBoxLayout()
@ -275,13 +275,13 @@ func (m *MainWindow) initializeTabs() {
// Favorites list.
m.fav_servers = widgets.NewQTreeView(nil)
favoritespagewidget_layout.AddWidget(m.fav_servers, 0, core.Qt__AlignHCenter & core.Qt__AlignTop)
favoritespagewidget_layout.AddWidget(m.fav_servers, 0, core.Qt__AlignHCenter&core.Qt__AlignTop)
// Favorites list filters widget.
favoritespagewidget_filters_widget := widgets.NewQWidget(nil, core.Qt__Widget)
favoritespagewidget_filters_widget_policy := widgets.NewQSizePolicy2(widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__DefaultType)
favoritespagewidget_filters_widget.SetSizePolicy(favoritespagewidget_filters_widget_policy)
favoritespagewidget_layout.AddWidget(favoritespagewidget_filters_widget, 0, core.Qt__AlignRight & core.Qt__AlignTop)
favoritespagewidget_layout.AddWidget(favoritespagewidget_filters_widget, 0, core.Qt__AlignRight&core.Qt__AlignTop)
// Favorites list filters layout.
favoritespagewidget_filters_layout := widgets.NewQVBoxLayout()