Updated to latest GTK2 bindings API and moved to Gitlab.
This commit is contained in:
parent
070aa50762
commit
127e1b8ab9
2
cache/cache_object.go
vendored
2
cache/cache_object.go
vendored
@ -15,7 +15,7 @@ import (
|
||||
"sync"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cachemodels"
|
||||
"gitlab.com/pztrn/urtrator/cachemodels"
|
||||
)
|
||||
|
||||
type Cache struct {
|
||||
|
4
cache/cache_profiles.go
vendored
4
cache/cache_profiles.go
vendored
@ -15,8 +15,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cachemodels"
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/cachemodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
)
|
||||
|
||||
func (c *Cache) CreateProfile(name string) {
|
||||
|
4
cache/cache_servers.go
vendored
4
cache/cache_servers.go
vendored
@ -14,8 +14,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cachemodels"
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/cachemodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
)
|
||||
|
||||
func (c *Cache) CreateServer(addr string) {
|
||||
|
4
cache/exported.go
vendored
4
cache/exported.go
vendored
@ -11,8 +11,8 @@ package cache
|
||||
|
||||
import (
|
||||
// local
|
||||
event "github.com/pztrn/urtrator/eventer"
|
||||
"github.com/pztrn/urtrator/database"
|
||||
"gitlab.com/pztrn/urtrator/database"
|
||||
event "gitlab.com/pztrn/urtrator/eventer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -11,7 +11,7 @@ package cachemodels
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
)
|
||||
|
||||
type Profile struct {
|
||||
|
@ -11,7 +11,7 @@ package cachemodels
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
|
@ -9,10 +9,10 @@
|
||||
// ToDo: put full text of license here.
|
||||
package clipboardwatcher
|
||||
|
||||
import(
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cache"
|
||||
"github.com/pztrn/urtrator/eventer"
|
||||
"gitlab.com/pztrn/urtrator/cache"
|
||||
"gitlab.com/pztrn/urtrator/eventer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -15,16 +15,16 @@ import (
|
||||
"fmt"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cache"
|
||||
"github.com/pztrn/urtrator/clipboardwatcher"
|
||||
"github.com/pztrn/urtrator/colorizer"
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"github.com/pztrn/urtrator/database"
|
||||
"github.com/pztrn/urtrator/eventer"
|
||||
"github.com/pztrn/urtrator/launcher"
|
||||
"github.com/pztrn/urtrator/requester"
|
||||
"github.com/pztrn/urtrator/timer"
|
||||
"github.com/pztrn/urtrator/translator"
|
||||
"gitlab.com/pztrn/urtrator/cache"
|
||||
"gitlab.com/pztrn/urtrator/clipboardwatcher"
|
||||
"gitlab.com/pztrn/urtrator/colorizer"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/database"
|
||||
"gitlab.com/pztrn/urtrator/eventer"
|
||||
"gitlab.com/pztrn/urtrator/launcher"
|
||||
"gitlab.com/pztrn/urtrator/requester"
|
||||
"gitlab.com/pztrn/urtrator/timer"
|
||||
"gitlab.com/pztrn/urtrator/translator"
|
||||
|
||||
// Github
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
|
@ -18,8 +18,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Other
|
||||
"github.com/jmoiron/sqlx"
|
||||
@ -89,6 +89,5 @@ func (d *Database) Migrate() {
|
||||
fmt.Println("No database found, will create new one")
|
||||
}
|
||||
|
||||
|
||||
migrate_full(d, dbver)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ package database
|
||||
|
||||
import (
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -51,14 +51,14 @@ fi
|
||||
|
||||
# Okay, let's compile.
|
||||
echo "Getting URTrator (and dependencies) sources"
|
||||
go get -u -v -d github.com/pztrn/urtrator
|
||||
go get -u -v -d gitlab.com/pztrn/urtrator
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to get URTrator sources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building URTrator..."
|
||||
go install -v github.com/pztrn/urtrator
|
||||
go install -v gitlab.com/pztrn/urtrator
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to build URTrator! Please, create a new bug report at https://github.com/pztrn/urtrator and attach FULL console output!"
|
||||
exit 1
|
||||
@ -69,7 +69,7 @@ mkdir -p URTrator.app/Contents/{MacOS,Framework,Resources}
|
||||
# Copying URTrator binary
|
||||
cp $GOPATH/bin/urtrator URTrator.app/Contents/MacOS/
|
||||
# Copying main resources.
|
||||
cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns ./URTrator.app/Contents/Resources/
|
||||
cp $GOPATH/src/gitlab.com/pztrn/urtrator/artwork/urtrator.icns ./URTrator.app/Contents/Resources/
|
||||
cp -R ./Resources/themes ./URTrator.app/Contents/Resources/
|
||||
|
||||
#####################################################################
|
||||
@ -90,7 +90,7 @@ INFOPLIST='<?xml version="1.0" encoding="UTF-8"?>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>urtrator.icns</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.0</string>
|
||||
<string>0.2.0</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"strings"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Github
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
@ -101,7 +101,7 @@ func (l *Launcher) Launch(server_profile *datamodels.Server, user_profile *datam
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
launch_params = append(launch_params, "--", ":" + display)
|
||||
launch_params = append(launch_params, "--", ":"+display)
|
||||
}
|
||||
if runtime.GOOS == "darwin" {
|
||||
// On macOS we should not start binary, but application bundle.
|
||||
@ -130,7 +130,7 @@ func (l *Launcher) Launch(server_profile *datamodels.Server, user_profile *datam
|
||||
}()
|
||||
|
||||
select {
|
||||
case <- done:
|
||||
case <-done:
|
||||
callback()
|
||||
}
|
||||
}()
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
"fmt"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/cache"
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"github.com/pztrn/urtrator/eventer"
|
||||
"github.com/pztrn/urtrator/timer"
|
||||
"gitlab.com/pztrn/urtrator/cache"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/eventer"
|
||||
"gitlab.com/pztrn/urtrator/timer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
)
|
||||
|
||||
type Pooler struct {
|
||||
@ -222,25 +222,25 @@ func (p *Pooler) UpdateSpecificServer(server *datamodels.Server) error {
|
||||
// Parse server configuration into passed server's datamodel.
|
||||
for i := 0; i < len(srv_config); i = i + 1 {
|
||||
if srv_config[i] == "g_modversion" {
|
||||
server.Version = srv_config[i + 1]
|
||||
server.Version = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "g_gametype" {
|
||||
server.Gamemode = srv_config[i + 1]
|
||||
server.Gamemode = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "sv_maxclients" {
|
||||
server.Maxplayers = srv_config[i + 1]
|
||||
server.Maxplayers = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "clients" {
|
||||
server.Players = srv_config[i + 1]
|
||||
server.Players = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "mapname" {
|
||||
server.Map = srv_config[i + 1]
|
||||
server.Map = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "sv_hostname" {
|
||||
server.Name = srv_config[i + 1]
|
||||
server.Name = srv_config[i+1]
|
||||
}
|
||||
if srv_config[i] == "g_needpass" {
|
||||
if srv_config[i + 1] == "0" {
|
||||
if srv_config[i+1] == "0" {
|
||||
server.IsPrivate = "0"
|
||||
} else {
|
||||
server.IsPrivate = "1"
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"github.com/pztrn/urtrator/eventer"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/eventer"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -11,7 +11,7 @@ package translator
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/configuration"
|
||||
"gitlab.com/pztrn/urtrator/configuration"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -11,7 +11,7 @@ package ui
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/common"
|
||||
"gitlab.com/pztrn/urtrator/common"
|
||||
|
||||
// other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
@ -23,7 +23,7 @@ func ShowAboutDialog() {
|
||||
ad.SetProgramName("URTrator")
|
||||
ad.SetComments(ctx.Translator.Translate("Urban Terror servers browser and game launcher", nil))
|
||||
ad.SetVersion(common.URTRATOR_VERSION)
|
||||
ad.SetWebsite("http://urtrator.pztrn.name")
|
||||
ad.SetWebsite("https://gitlab.com/pztrn/urtrator")
|
||||
ad.SetLogo(logo)
|
||||
|
||||
// ToDo: put it in plain text files.
|
||||
|
@ -11,7 +11,7 @@ package ui
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/context"
|
||||
"gitlab.com/pztrn/urtrator/context"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gdkpixbuf"
|
||||
|
@ -18,9 +18,9 @@ import (
|
||||
"strings"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/cachemodels"
|
||||
"github.com/pztrn/urtrator/common"
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/cachemodels"
|
||||
"gitlab.com/pztrn/urtrator/common"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gdkpixbuf"
|
||||
@ -178,7 +178,7 @@ func (f *FavoriteDialog) initializeWindow() {
|
||||
table.Attach(profile_label, 0, 1, 3, 4, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||
|
||||
f.profile = gtk.NewComboBoxText()
|
||||
table.Attach(f.profile , 1, 2, 3, 4, gtk.FILL, gtk.FILL, 5, 5)
|
||||
table.Attach(f.profile, 1, 2, 3, 4, gtk.FILL, gtk.FILL, 5, 5)
|
||||
|
||||
// Invisible thing.
|
||||
inv_label1 := gtk.NewLabel("")
|
||||
|
@ -18,8 +18,8 @@ import (
|
||||
"strings"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"github.com/pztrn/urtrator/ioq3dataparser"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/ioq3dataparser"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gdkpixbuf"
|
||||
@ -143,7 +143,6 @@ type MainWindow struct {
|
||||
// For public server
|
||||
server_public_pic *gdkpixbuf.Pixbuf
|
||||
|
||||
|
||||
// Flags.
|
||||
// Application is initialized?
|
||||
initialized bool
|
||||
@ -209,8 +208,8 @@ func (m *MainWindow) checkMainPanePosition() {
|
||||
// widgets hell :).
|
||||
func (m *MainWindow) checkPositionAndSize() {
|
||||
glib.IdleAdd(func() bool {
|
||||
m.window.GetPosition(&m.window_pos_x, &m.window_pos_y)
|
||||
m.window.GetSize(&m.window_width, &m.window_height)
|
||||
m.window_pos_x, m.window_pos_y = m.window.GetPosition()
|
||||
m.window_width, m.window_height = m.window.GetSize()
|
||||
|
||||
m.hpane.SetPosition(m.window_width - m.pane_negative_position)
|
||||
return false
|
||||
@ -229,13 +228,13 @@ func (m *MainWindow) Close() {
|
||||
// Saving columns sizes and positions.
|
||||
all_servers_columns := m.all_servers.GetColumns()
|
||||
for i := range all_servers_columns {
|
||||
ctx.Cfg.Cfg["/mainwindow/all_servers/" + all_servers_columns[i].GetTitle() + "_position"] = strconv.Itoa(i)
|
||||
ctx.Cfg.Cfg["/mainwindow/all_servers/" + all_servers_columns[i].GetTitle() + "_width"] = strconv.Itoa(all_servers_columns[i].GetWidth())
|
||||
ctx.Cfg.Cfg["/mainwindow/all_servers/"+all_servers_columns[i].GetTitle()+"_position"] = strconv.Itoa(i)
|
||||
ctx.Cfg.Cfg["/mainwindow/all_servers/"+all_servers_columns[i].GetTitle()+"_width"] = strconv.Itoa(all_servers_columns[i].GetWidth())
|
||||
}
|
||||
fav_servers_columns := m.fav_servers.GetColumns()
|
||||
for i := range fav_servers_columns {
|
||||
ctx.Cfg.Cfg["/mainwindow/fav_servers/" + fav_servers_columns[i].GetTitle() + "_position"] = strconv.Itoa(i)
|
||||
ctx.Cfg.Cfg["/mainwindow/fav_servers/" + fav_servers_columns[i].GetTitle() + "_width"] = strconv.Itoa(fav_servers_columns[i].GetWidth())
|
||||
ctx.Cfg.Cfg["/mainwindow/fav_servers/"+fav_servers_columns[i].GetTitle()+"_position"] = strconv.Itoa(i)
|
||||
ctx.Cfg.Cfg["/mainwindow/fav_servers/"+fav_servers_columns[i].GetTitle()+"_width"] = strconv.Itoa(fav_servers_columns[i].GetWidth())
|
||||
}
|
||||
|
||||
// Additional actions should be taken on Windows.
|
||||
@ -453,7 +452,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
|
||||
|
||||
if server.Server.Name == "" && server.Server.Players == "" {
|
||||
m.all_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip+":"+server.Server.Port)
|
||||
} else {
|
||||
if ping > 9000 {
|
||||
m.all_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
|
||||
@ -469,10 +468,10 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], server_name)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Mode", nil)], m.getGameModeName(server.Server.Gamemode))
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Map", nil)], server.Server.Map)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], server.Server.Players+"/"+server.Server.Bots+"/"+server.Server.Maxplayers)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], server.Server.Ping)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Version", nil)], server.Server.Version)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
|
||||
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip+":"+server.Server.Port)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +548,7 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
|
||||
|
||||
if server.Server.Name == "" && server.Server.Players == "" {
|
||||
m.fav_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip+":"+server.Server.Port)
|
||||
} else {
|
||||
if ping > 9000 {
|
||||
m.fav_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
|
||||
@ -565,10 +564,10 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], server_name)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Mode", nil)], m.getGameModeName(server.Server.Gamemode))
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Map", nil)], server.Server.Map)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], server.Server.Players+"/"+server.Server.Bots+"/"+server.Server.Maxplayers)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], server.Server.Ping)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Version", nil)], server.Server.Version)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
|
||||
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip+":"+server.Server.Port)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -710,14 +709,14 @@ func (m *MainWindow) showShortServerInformation() {
|
||||
iter = new(gtk.TreeIter)
|
||||
m.server_info_store.Append(iter)
|
||||
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Players", nil))
|
||||
m.server_info_store.SetValue(iter, 1, server_info.Players + " of " + parsed_general_data["sv_maxclients"] + " (" + server_info.Bots + " bots)")
|
||||
m.server_info_store.SetValue(iter, 1, server_info.Players+" of "+parsed_general_data["sv_maxclients"]+" ("+server_info.Bots+" bots)")
|
||||
delete(parsed_general_data, "sv_maxclients")
|
||||
|
||||
// Ping
|
||||
iter = new(gtk.TreeIter)
|
||||
m.server_info_store.Append(iter)
|
||||
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Ping", nil))
|
||||
m.server_info_store.SetValue(iter, 1, server_info.Ping + " ms")
|
||||
m.server_info_store.SetValue(iter, 1, server_info.Ping+" ms")
|
||||
|
||||
// Game mode
|
||||
iter = new(gtk.TreeIter)
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
// local
|
||||
"github.com/pztrn/urtrator/common"
|
||||
"github.com/pztrn/urtrator/timer"
|
||||
"gitlab.com/pztrn/urtrator/common"
|
||||
"gitlab.com/pztrn/urtrator/timer"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gdkpixbuf"
|
||||
@ -109,8 +109,7 @@ func (m *MainWindow) Initialize() {
|
||||
pane_negative_pos, _ := strconv.Atoi(saved_pane_pos)
|
||||
m.hpane.SetPosition(m.window_width - pane_negative_pos)
|
||||
} else {
|
||||
var w, h int = 0, 0
|
||||
m.window.GetSize(&w, &h)
|
||||
w, _ := m.window.GetSize()
|
||||
m.hpane.SetPosition(w - 150)
|
||||
}
|
||||
|
||||
@ -444,18 +443,18 @@ func (m *MainWindow) InitializeTabs() {
|
||||
|
||||
// ...aand lets do dynamic generation :)
|
||||
// +2 because we have 2 static columns.
|
||||
all_servers_columns_to_append := make([]*gtk.TreeViewColumn, len(m.column_names) + 2)
|
||||
all_servers_columns_to_append := make([]*gtk.TreeViewColumn, len(m.column_names)+2)
|
||||
for pos, name := range m.column_names {
|
||||
// Check if we have column position saved. If so - use it.
|
||||
// Otherwise use default position.
|
||||
// Should be actual only for first launch.
|
||||
position := ctx.Cfg.Cfg["/mainwindow/all_servers/" + ctx.Translator.Translate(name, nil) + "_position"]
|
||||
position := ctx.Cfg.Cfg["/mainwindow/all_servers/"+ctx.Translator.Translate(name, nil)+"_position"]
|
||||
if len(position) == 0 {
|
||||
position = pos
|
||||
}
|
||||
position_int, _ := strconv.Atoi(position)
|
||||
// Same for width.
|
||||
width := ctx.Cfg.Cfg["/mainwindow/all_servers/" + ctx.Translator.Translate(name, nil) + "_width"]
|
||||
width := ctx.Cfg.Cfg["/mainwindow/all_servers/"+ctx.Translator.Translate(name, nil)+"_width"]
|
||||
if len(width) == 0 {
|
||||
width = "-1"
|
||||
}
|
||||
@ -486,9 +485,9 @@ func (m *MainWindow) InitializeTabs() {
|
||||
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], gtk.SORT_ASCENDING)
|
||||
|
||||
// Sorting functions.
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], m.sortServersByName)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], m.sortServersByName, nil)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers, nil)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing, nil)
|
||||
|
||||
// Selection changed signal, which will update server's short info pane.
|
||||
m.all_servers.Connect("cursor-changed", m.showShortServerInformation)
|
||||
@ -586,18 +585,18 @@ func (m *MainWindow) InitializeTabs() {
|
||||
m.fav_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Public", nil), gtk.NewCellRendererPixbuf(), "pixbuf", 1))
|
||||
|
||||
// +2 because we have 2 static columns.
|
||||
fav_servers_columns_to_append := make([]*gtk.TreeViewColumn, len(m.column_names) + 2)
|
||||
fav_servers_columns_to_append := make([]*gtk.TreeViewColumn, len(m.column_names)+2)
|
||||
for pos, name := range m.column_names {
|
||||
// Check if we have column position saved. If so - use it.
|
||||
// Otherwise use default position.
|
||||
// Should be actual only for first launch.
|
||||
position := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + ctx.Translator.Translate(name, nil) + "_position"]
|
||||
position := ctx.Cfg.Cfg["/mainwindow/fav_servers/"+ctx.Translator.Translate(name, nil)+"_position"]
|
||||
if len(position) == 0 {
|
||||
position = pos
|
||||
}
|
||||
position_int, _ := strconv.Atoi(position)
|
||||
// Same for width.
|
||||
width := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + ctx.Translator.Translate(name, nil) + "_width"]
|
||||
width := ctx.Cfg.Cfg["/mainwindow/fav_servers/"+ctx.Translator.Translate(name, nil)+"_width"]
|
||||
if len(width) == 0 {
|
||||
width = "-1"
|
||||
}
|
||||
@ -628,9 +627,9 @@ func (m *MainWindow) InitializeTabs() {
|
||||
}
|
||||
|
||||
// Sorting functions.
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], m.sortServersByName)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], m.sortServersByName, nil)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers, nil)
|
||||
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing, nil)
|
||||
|
||||
// Selection changed signal, which will update server's short info pane.
|
||||
m.fav_servers.Connect("cursor-changed", m.showShortServerInformation)
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// other
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
@ -238,10 +238,10 @@ func (m *MainWindow) launchActually(server_profile *datamodels.Server, user_prof
|
||||
// Clear server name from "<markup></markup>" things.
|
||||
srv_name_for_label := server_profile.Name
|
||||
if strings.Contains(server_profile.Name, "markup") {
|
||||
srv_name_for_label = string([]byte(server_profile.Name)[8:len(server_profile.Name)-9])
|
||||
srv_name_for_label = string([]byte(server_profile.Name)[8 : len(server_profile.Name)-9])
|
||||
} else {
|
||||
srv_name := ctx.Colorizer.Fix(server_profile.Name)
|
||||
srv_name_for_label = string([]byte(srv_name)[8:len(srv_name)-9])
|
||||
srv_name_for_label = string([]byte(srv_name)[8 : len(srv_name)-9])
|
||||
}
|
||||
// Show great coloured label.
|
||||
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Urban Terror is launched with profile", nil) + " </span><span foreground=\"blue\">" + user_profile.Name + "</span> <span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("and connected to", nil) + " </span><span foreground=\"orange\" font_weight=\"bold\">" + srv_name_for_label + "</span></markup>"})
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int {
|
||||
func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
|
||||
var name1_raw glib.GValue
|
||||
var name2_raw glib.GValue
|
||||
|
||||
@ -37,7 +37,7 @@ func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int {
|
||||
func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
|
||||
var players1_raw glib.GValue
|
||||
var players2_raw glib.GValue
|
||||
|
||||
@ -68,7 +68,7 @@ func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter,
|
||||
return -1
|
||||
}
|
||||
|
||||
func (m *MainWindow) sortServersByPing(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int {
|
||||
func (m *MainWindow) sortServersByPing(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
|
||||
var ping1_raw glib.GValue
|
||||
var ping2_raw glib.GValue
|
||||
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"runtime"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
type OptionsDialog struct {
|
||||
@ -194,7 +194,7 @@ func (o *OptionsDialog) initializeAppearanceTab() {
|
||||
}
|
||||
o.language_combo.SetActive(lang_active)
|
||||
|
||||
appearance_table.Attach(o.language_combo, 1, 2, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
appearance_table.Attach(o.language_combo, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
|
||||
appearance_vbox.PackStart(appearance_table, false, true, 0)
|
||||
o.tab_widget.AppendPage(appearance_vbox, gtk.NewLabel(ctx.Translator.Translate("Appearance", nil)))
|
||||
@ -212,7 +212,7 @@ func (o *OptionsDialog) initializeGeneralTab() {
|
||||
|
||||
o.show_tray_icon = gtk.NewCheckButtonWithLabel("")
|
||||
o.show_tray_icon.SetTooltipText(ctx.Translator.Translate("Show icon in tray", nil))
|
||||
general_table.Attach(o.show_tray_icon, 1, 2, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
general_table.Attach(o.show_tray_icon, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
|
||||
// Autoupdate checkbox.
|
||||
autoupdate_tooltip := ctx.Translator.Translate("Should URTrator check for updates and update itself? Not working now.", nil)
|
||||
@ -223,7 +223,7 @@ func (o *OptionsDialog) initializeGeneralTab() {
|
||||
|
||||
o.autoupdate = gtk.NewCheckButtonWithLabel("")
|
||||
o.autoupdate.SetTooltipText(autoupdate_tooltip)
|
||||
general_table.Attach(o.autoupdate, 1, 2, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
general_table.Attach(o.autoupdate, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL, 5, 5)
|
||||
|
||||
// Vertical separator.
|
||||
sep := gtk.NewVBox(false, 0)
|
||||
@ -256,11 +256,11 @@ func (o *OptionsDialog) initializeServersOptionsTab() {
|
||||
servers_autoupdate_cb_label := gtk.NewLabel(ctx.Translator.Translate("Servers autoupdate", nil))
|
||||
servers_autoupdate_cb_label.SetTooltipText(servers_autoupdate_cb_tooptip)
|
||||
servers_autoupdate_cb_label.SetAlignment(0, 0)
|
||||
servers_updating_table.Attach(servers_autoupdate_cb_label, 0, 1 ,1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||
servers_updating_table.Attach(servers_autoupdate_cb_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||
|
||||
o.servers_autoupdate = gtk.NewCheckButtonWithLabel("")
|
||||
o.servers_autoupdate.SetTooltipText(servers_autoupdate_cb_tooptip)
|
||||
servers_updating_table.Attach(o.servers_autoupdate, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL, 5, 5)
|
||||
servers_updating_table.Attach(o.servers_autoupdate, 1, 2, 1, 2, gtk.EXPAND|gtk.FILL, gtk.FILL, 5, 5)
|
||||
|
||||
// Servers update timeout.
|
||||
servers_autoupdate_timeout_tooltip := ctx.Translator.Translate("Timeout which will trigger servers information update, in minutes.", nil)
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
"strings"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
"gitlab.com/pztrn/urtrator/datamodels"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
@ -185,7 +185,6 @@ func (op *OptionsProfile) Initialize(update bool) {
|
||||
op.profile_name.SetTooltipText(profile_name_tooltip)
|
||||
op.table.Attach(op.profile_name, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
|
||||
|
||||
|
||||
// Urban Terror version.
|
||||
urt_version_tooltip := ctx.Translator.Translate("Urban Terror version for which this profile applies.", nil)
|
||||
urt_version_label := gtk.NewLabel(ctx.Translator.Translate("Urban Terror version:", nil))
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
"sort"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/ioq3dataparser"
|
||||
"gitlab.com/pztrn/urtrator/ioq3dataparser"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
)
|
||||
|
||||
type ServerCVarsDialog struct {
|
||||
|
@ -11,9 +11,9 @@ package main
|
||||
|
||||
import (
|
||||
// local
|
||||
"github.com/pztrn/urtrator/common"
|
||||
"github.com/pztrn/urtrator/context"
|
||||
"github.com/pztrn/urtrator/ui/gtk2"
|
||||
"gitlab.com/pztrn/urtrator/common"
|
||||
"gitlab.com/pztrn/urtrator/context"
|
||||
"gitlab.com/pztrn/urtrator/ui/gtk2"
|
||||
//"github.com/pztrn/urtrator/ui/qt5"
|
||||
|
||||
// stdlib
|
||||
|
Reference in New Issue
Block a user