]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added dialog for keybindings reset.
authorbyteManiak <bytemaniak98@gmail.com>
Sat, 30 Mar 2019 00:22:52 +0000 (00:22 +0000)
committerbyteManiak <bytemaniak98@gmail.com>
Sat, 30 Mar 2019 00:22:52 +0000 (00:22 +0000)
qcsrc/menu/xonotic/_mod.inc
qcsrc/menu/xonotic/_mod.qh
qcsrc/menu/xonotic/dialog_settings_bindings_reset.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_bindings_reset.qh [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_settings_input.qc
qcsrc/menu/xonotic/keybinder.qc
qcsrc/menu/xonotic/mainwindow.qc
qcsrc/menu/xonotic/mainwindow.qh

index fd83718283928e45f0c77ad9d3af81cc62ad88d1..00a9e5403fcd22236a8f2bd77fef45c095eb9b1b 100644 (file)
@@ -70,6 +70,7 @@
 #include <menu/xonotic/dialog_settings_game_weapons.qc>
 #include <menu/xonotic/dialog_settings_input.qc>
 #include <menu/xonotic/dialog_settings_input_userbind.qc>
+#include <menu/xonotic/dialog_settings_bindings_reset.qc>
 #include <menu/xonotic/dialog_settings_misc.qc>
 #include <menu/xonotic/dialog_settings_misc_cvars.qc>
 #include <menu/xonotic/dialog_settings_misc_reset.qc>
index f1644a2f5cfc0bb76657141f15d34dea80b340a8..5d72a56171fdb2a1cd0be51d79416815878b6303 100644 (file)
@@ -70,6 +70,7 @@
 #include <menu/xonotic/dialog_settings_game_weapons.qh>
 #include <menu/xonotic/dialog_settings_input.qh>
 #include <menu/xonotic/dialog_settings_input_userbind.qh>
+#include <menu/xonotic/dialog_settings_bindings_reset.qh>
 #include <menu/xonotic/dialog_settings_misc.qh>
 #include <menu/xonotic/dialog_settings_misc_cvars.qh>
 #include <menu/xonotic/dialog_settings_misc_reset.qh>
diff --git a/qcsrc/menu/xonotic/dialog_settings_bindings_reset.qc b/qcsrc/menu/xonotic/dialog_settings_bindings_reset.qc
new file mode 100644 (file)
index 0000000..0ceda25
--- /dev/null
@@ -0,0 +1,21 @@
+#include "dialog_settings_bindings_reset.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "button.qh"
+#include "keybinder.qh"
+
+void XonoticBindingsResetDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to reset all keybindings?")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticButton(_("Yes"), '1 0 0'));
+                       e.onClick = KeyBinder_Bind_Reset_All;
+                       e.onClickEntity = me;
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
diff --git a/qcsrc/menu/xonotic/dialog_settings_bindings_reset.qh b/qcsrc/menu/xonotic/dialog_settings_bindings_reset.qh
new file mode 100644 (file)
index 0000000..ad1e387
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticBindingsResetDialog, XonoticDialog)
+       METHOD(XonoticBindingsResetDialog, fill, void(entity));
+       ATTRIB(XonoticBindingsResetDialog, title, string, _("Reset bindings"));
+       ATTRIB(XonoticBindingsResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT);
+       ATTRIB(XonoticBindingsResetDialog, intendedWidth, float, 0.5);
+       ATTRIB(XonoticBindingsResetDialog, rows, float, 3);
+       ATTRIB(XonoticBindingsResetDialog, columns, float, 2);
+       ATTRIB(XonoticBindingsResetDialog, name, string, "Reset bindings");
+ENDCLASS(XonoticBindingsResetDialog)
index 7f3af39f878be318dad0a2210eb7291c08b13e39..c5e3bb439ffdb2b19b2ee6284161bc517c8b2e17 100644 (file)
@@ -50,8 +50,8 @@ void XonoticInputSettingsTab_fill(entity me)
                        kb.clearButton = e;
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticButton(_("Reset all"), '0 0 0'));
-                       e.onClick = KeyBinder_Bind_Reset_All;
-                       e.onClickEntity = kb;
+                       e.onClick = DialogOpenButton_Click;
+                       e.onClickEntity = main.bindingsResetDialog;
 
        me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Mouse")));
index 69734ef18e18b44efe30f5494bc67774b095a492..90712bbeb7c04f20c747f777b4621d1ae8e9a98b 100644 (file)
@@ -313,6 +313,7 @@ void KeyBinder_Bind_Reset_All(entity btn, entity me)
        localcmd("exec binds-xonotic.cfg\n");
        localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
        cvar_set("_hud_showbinds_reload", "1");
+       me.close(me);
 }
 void XonoticKeyBinder_doubleClickListBoxItem(entity me, float i, vector where)
 {
index 110b796be61d09ce0375b4827ec663fc1707e773..602fcc33cccf5f068995d07a558a3ce376e17c18 100644 (file)
@@ -27,6 +27,7 @@
 #include "dialog_hudpanel_quickmenu.qh"
 
 #include "dialog_settings_input_userbind.qh"
+#include "dialog_settings_bindings_reset.qh"
 #include "dialog_settings_misc_cvars.qh"
 #include "dialog_settings_misc_reset.qh"
 #include "dialog_settings_user_languagewarning.qh"
@@ -163,6 +164,10 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       me.bindingsResetDialog = i = NEW(XonoticBindingsResetDialog);
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        me.cvarsDialog = i = NEW(XonoticCvarsDialog);
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
index 2397d41431605a6d59b36df2b996ded9d56bed65..924f145ba7d5f27143029d03417d8042d2b503e6 100644 (file)
@@ -10,6 +10,7 @@ CLASS(MainWindow, ModalController)
        ATTRIB(MainWindow, mutatorsDialog, entity);
        ATTRIB(MainWindow, mapInfoDialog, entity);
        ATTRIB(MainWindow, userbindEditDialog, entity);
+       ATTRIB(MainWindow, bindingsResetDialog, entity);
        ATTRIB(MainWindow, winnerDialog, entity);
        ATTRIB(MainWindow, serverInfoDialog, entity);
        ATTRIB(MainWindow, cvarsDialog, entity);