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.
|
|
|
|
|
|
|
|
// build darwin
|
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
2018-11-10 20:58:15 +05:00
|
|
|
// stdlib
|
|
|
|
//"fmt"
|
|
|
|
//"os"
|
|
|
|
//"runtime"
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Qt5
|
|
|
|
"github.com/therecipe/qt/widgets"
|
2016-12-13 04:47:17 +05:00
|
|
|
)
|
|
|
|
|
|
|
|
func (m *MainWindow) initializeMenu() {
|
2018-11-10 20:58:15 +05:00
|
|
|
m.mainmenu = widgets.NewQMenuBar(nil)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// File menu.
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
filemenu := widgets.NewQMenu2("&File", nil)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Options action.
|
|
|
|
file_options := filemenu.AddAction("&Options")
|
|
|
|
file_options.SetMenuRole(widgets.QAction__PreferencesRole)
|
|
|
|
file_options.ConnectTriggered(m.showOptionsDialog)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Separator :)
|
|
|
|
filemenu.AddSeparator()
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Exit URTrator.
|
|
|
|
file_exit := filemenu.AddAction("&Exit")
|
|
|
|
file_exit.SetMenuRole(widgets.QAction__QuitRole)
|
|
|
|
file_exit.ConnectTriggered(m.close)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
m.mainmenu.AddMenu(filemenu)
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
// About menu
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
aboutmenu := widgets.NewQMenu2("&Help", nil)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// About URTrator.
|
|
|
|
about_about := aboutmenu.AddAction("&About URTrator...")
|
|
|
|
about_about.SetMenuRole(widgets.QAction__AboutRole)
|
|
|
|
about_about.ConnectTriggered(m.showAboutDialog)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// About Qt.
|
|
|
|
about_about_qt := aboutmenu.AddAction("About &Qt...")
|
|
|
|
about_about_qt.SetMenuRole(widgets.QAction__AboutQtRole)
|
|
|
|
about_about_qt.ConnectTriggered(m.showAboutQtDialog)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Separator :)
|
|
|
|
aboutmenu.AddSeparator()
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
// Drop database data.
|
|
|
|
about_drop_database := aboutmenu.AddAction("&Drop database...")
|
|
|
|
//about_drop_database.SetMenuRole(widgets.QAction__ApplicationSpecificRole)
|
|
|
|
about_drop_database.ConnectTriggered(m.dropDatabasesData)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
m.mainmenu.AddMenu(aboutmenu)
|
2016-12-13 04:47:17 +05:00
|
|
|
|
2018-11-10 20:58:15 +05:00
|
|
|
m.window.SetMenuBar(m.mainmenu)
|
2016-12-13 04:47:17 +05:00
|
|
|
}
|