gofmt.
This commit is contained in:
parent
39ac02dfc5
commit
2b3c9ef9ea
@ -10,6 +10,6 @@
|
|||||||
package colorizer
|
package colorizer
|
||||||
|
|
||||||
func New() *Colorizer {
|
func New() *Colorizer {
|
||||||
c := Colorizer {}
|
c := Colorizer{}
|
||||||
return &c
|
return &c
|
||||||
}
|
}
|
||||||
|
@ -39,17 +39,50 @@ INSERT INTO database (version) VALUES (1);
|
|||||||
// Migrate database to latest version.
|
// Migrate database to latest version.
|
||||||
// ToDo: make it more good :).
|
// ToDo: make it more good :).
|
||||||
func migrate_full(db *Database, version int) {
|
func migrate_full(db *Database, version int) {
|
||||||
if version < 1 {start_to_one(db); version = 1}
|
if version < 1 {
|
||||||
if version == 1 {one_to_two(db); version = 2}
|
start_to_one(db)
|
||||||
if version == 2 {two_to_three(db); version = 3}
|
version = 1
|
||||||
if version == 3 {three_to_four(db); version = 4}
|
}
|
||||||
if version == 4 {four_to_five(db); version = 5}
|
if version == 1 {
|
||||||
if version == 5 {five_to_six(db); version = 6 }
|
one_to_two(db)
|
||||||
if version == 6 {six_to_seven(db); version = 7}
|
version = 2
|
||||||
if version == 7 {seven_to_eight(db); version = 8}
|
}
|
||||||
if version == 8 {eight_to_nine(db); version = 9}
|
if version == 2 {
|
||||||
if version == 9 {nine_to_ten(db); version = 10}
|
two_to_three(db)
|
||||||
if version == 10 {ten_to_eleven(db); version = 11}
|
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.
|
// Initial database structure.
|
||||||
|
@ -21,7 +21,7 @@ func ParseInfoToMap(data string) map[string]string {
|
|||||||
srv_config = srv_config[1:]
|
srv_config = srv_config[1:]
|
||||||
// Parse server configuration into passed server's datamodel.
|
// Parse server configuration into passed server's datamodel.
|
||||||
for i := 0; i < len(srv_config[1:]); i = i + 2 {
|
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
|
return parsed_data
|
||||||
@ -37,7 +37,7 @@ func ParsePlayersInfoToMap(data string) map[string]map[string]string {
|
|||||||
player_data := make(map[string]string)
|
player_data := make(map[string]string)
|
||||||
if len(raw_player_data) > 1 {
|
if len(raw_player_data) > 1 {
|
||||||
nickname := strings.Join(raw_player_data[2:], " ")
|
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["ping"] = raw_player_data[1]
|
||||||
player_data["frags"] = raw_player_data[0]
|
player_data["frags"] = raw_player_data[0]
|
||||||
parsed_data[player_data["nick"]] = player_data
|
parsed_data[player_data["nick"]] = player_data
|
||||||
|
@ -52,7 +52,7 @@ type Translator struct {
|
|||||||
func (t *Translator) formatFromMap(data string, params map[string]string) string {
|
func (t *Translator) formatFromMap(data string, params map[string]string) string {
|
||||||
new_data := data
|
new_data := data
|
||||||
for k, v := range params {
|
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
|
return new_data
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ package translator
|
|||||||
import (
|
import (
|
||||||
// stdlib
|
// stdlib
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Detect language on Windows.
|
// Detect language on Windows.
|
||||||
|
@ -107,7 +107,6 @@ func (m *MainWindow) showAboutQtDialog(a bool) {
|
|||||||
widgets.QMessageBox_AboutQt(m.window, "About Qt")
|
widgets.QMessageBox_AboutQt(m.window, "About Qt")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *MainWindow) showOptionsDialog(a bool) {
|
func (m *MainWindow) showOptionsDialog(a bool) {
|
||||||
fmt.Println("Showing options dialog...")
|
fmt.Println("Showing options dialog...")
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ func (m *MainWindow) Initialize() {
|
|||||||
} else {
|
} else {
|
||||||
g := m.window.Geometry()
|
g := m.window.Geometry()
|
||||||
w := g.Width()
|
w := g.Width()
|
||||||
m.splitter.MoveSplitter(w - 150, 1)
|
m.splitter.MoveSplitter(w-150, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.splitter.ConnectSplitterMoved(m.splitterMoved)
|
m.splitter.ConnectSplitterMoved(m.splitterMoved)
|
||||||
@ -114,11 +114,11 @@ func (m *MainWindow) initializeSidebar() {
|
|||||||
|
|
||||||
// Server's information list.
|
// Server's information list.
|
||||||
m.sidebar_server_info = widgets.NewQTreeView(nil)
|
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.
|
// Server's players widget.
|
||||||
m.sidebar_server_players = widgets.NewQTreeView(nil)
|
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.
|
// Add spacer.
|
||||||
spacer := widgets.NewQSpacerItem(6, 6, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Expanding)
|
spacer := widgets.NewQSpacerItem(6, 6, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Expanding)
|
||||||
@ -162,7 +162,7 @@ func (m *MainWindow) initializeStorages() {
|
|||||||
func (m *MainWindow) initializeTabs() {
|
func (m *MainWindow) initializeTabs() {
|
||||||
m.splitter = widgets.NewQSplitter(nil)
|
m.splitter = widgets.NewQSplitter(nil)
|
||||||
m.splitter.SetOrientation(core.Qt__Horizontal)
|
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.tabs = widgets.NewQTabWidget(nil)
|
||||||
m.splitter.AddWidget(m.tabs)
|
m.splitter.AddWidget(m.tabs)
|
||||||
@ -183,13 +183,13 @@ func (m *MainWindow) initializeTabs() {
|
|||||||
|
|
||||||
// Servers list.
|
// Servers list.
|
||||||
m.all_servers = widgets.NewQTreeView(nil)
|
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.
|
// Servers list filters widget.
|
||||||
serverspagewidget_filters_widget := widgets.NewQWidget(nil, core.Qt__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_policy := widgets.NewQSizePolicy2(widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__DefaultType)
|
||||||
serverspagewidget_filters_widget.SetSizePolicy(serverspagewidget_filters_widget_policy)
|
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.
|
// Servers list filters layout.
|
||||||
serverspagewidget_filters_layout := widgets.NewQVBoxLayout()
|
serverspagewidget_filters_layout := widgets.NewQVBoxLayout()
|
||||||
@ -275,13 +275,13 @@ func (m *MainWindow) initializeTabs() {
|
|||||||
|
|
||||||
// Favorites list.
|
// Favorites list.
|
||||||
m.fav_servers = widgets.NewQTreeView(nil)
|
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.
|
// Favorites list filters widget.
|
||||||
favoritespagewidget_filters_widget := widgets.NewQWidget(nil, core.Qt__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_policy := widgets.NewQSizePolicy2(widgets.QSizePolicy__Minimum, widgets.QSizePolicy__Minimum, widgets.QSizePolicy__DefaultType)
|
||||||
favoritespagewidget_filters_widget.SetSizePolicy(favoritespagewidget_filters_widget_policy)
|
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.
|
// Favorites list filters layout.
|
||||||
favoritespagewidget_filters_layout := widgets.NewQVBoxLayout()
|
favoritespagewidget_filters_layout := widgets.NewQVBoxLayout()
|
||||||
|
Reference in New Issue
Block a user