2016-12-13 04:47:17 +05:00
|
|
|
// URTator - Urban Terror server browser and game launcher, written in
|
|
|
|
// Go.
|
|
|
|
//
|
|
|
|
// Copyright (c) 2016, Stanslav N. a.k.a pztrn (or p0z1tr0n)
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under Terms and Conditions of GNU General Public License
|
|
|
|
// version 3 or any higher.
|
|
|
|
// ToDo: put full text of license here.
|
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
2018-11-10 20:58:15 +05:00
|
|
|
// stdlib
|
|
|
|
"fmt"
|
|
|
|
//"runtime"
|
|
|
|
//"sort"
|
|
|
|
//"strconv"
|
|
|
|
//"strings"
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Local
|
|
|
|
//"github.com/pztrn/urtrator/datamodels"
|
|
|
|
//"github.com/pztrn/urtrator/ioq3dataparser"
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// github
|
|
|
|
"github.com/therecipe/qt/widgets"
|
2016-12-13 04:47:17 +05:00
|
|
|
)
|
|
|
|
|
|
|
|
type MainWindow struct {
|
2018-11-10 20:58:15 +05:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Main widgets and pointers.
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Application.
|
|
|
|
app *widgets.QApplication
|
|
|
|
// Main window.
|
|
|
|
window *widgets.QMainWindow
|
|
|
|
// Main menu.
|
|
|
|
mainmenu *widgets.QMenuBar
|
|
|
|
// Main vertical box.
|
|
|
|
vbox *widgets.QVBoxLayout
|
|
|
|
// Toolbar.
|
|
|
|
toolbar *widgets.QToolBar
|
|
|
|
// Splitter.
|
|
|
|
splitter *widgets.QSplitter
|
|
|
|
// Tabs widget.
|
|
|
|
tabs *widgets.QTabWidget
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Servers lists and related.
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// "Servers" tab list.
|
|
|
|
all_servers *widgets.QTreeView
|
|
|
|
// Hide offline servers checkbox.
|
|
|
|
all_servers_hide_offline *widgets.QCheckBox
|
|
|
|
// Hide private servers?
|
|
|
|
all_servers_hide_private *widgets.QCheckBox
|
|
|
|
// Server's version.
|
|
|
|
all_servers_version *widgets.QComboBox
|
|
|
|
// Game mode.
|
|
|
|
all_servers_gamemode *widgets.QComboBox
|
|
|
|
// Favorites tab list.
|
|
|
|
fav_servers *widgets.QTreeView
|
|
|
|
// Hide offline servers checkbox.
|
|
|
|
fav_servers_hide_offline *widgets.QCheckBox
|
|
|
|
// Hide private servers?
|
|
|
|
fav_servers_hide_private *widgets.QCheckBox
|
|
|
|
// Server's version.
|
|
|
|
fav_servers_version *widgets.QComboBox
|
|
|
|
// Game mode.
|
|
|
|
fav_servers_gamemode *widgets.QComboBox
|
|
|
|
// Sidebar's server's information widget.
|
|
|
|
sidebar_server_info *widgets.QTreeView
|
|
|
|
// Sidebar's server's players widget.
|
|
|
|
sidebar_server_players *widgets.QTreeView
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Datas.
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// Window size.
|
|
|
|
window_width int
|
|
|
|
window_height int
|
|
|
|
// Window position.
|
|
|
|
window_pos_x int
|
|
|
|
window_pos_y int
|
|
|
|
// Supported game modes.
|
|
|
|
gamemodes map[string]string
|
|
|
|
// Columns names for servers tabs.
|
|
|
|
column_names map[string]string
|
|
|
|
// Real columns positions on servers tabs.
|
|
|
|
column_pos map[string]map[string]int
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) close(a bool) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("Closing URTrator...")
|
|
|
|
m.app.Quit()
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) dropDatabasesData(bool) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("About to drop databases data...")
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) showAboutDialog(a bool) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("Showing about dialog...")
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) showAboutQtDialog(a bool) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("Showing about Qt dialog...")
|
|
|
|
widgets.QMessageBox_AboutQt(m.window, "About Qt")
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) showOptionsDialog(a bool) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("Showing options dialog...")
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MainWindow) splitterMoved(pos int, index int) {
|
2018-11-10 20:58:15 +05:00
|
|
|
fmt.Println("Splitter moved!")
|
|
|
|
fmt.Println(index, pos)
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|