]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
adding a 'factory reset' button to the menu to reset all settings
authorDebugger <pyngot@hotmail.com>
Wed, 14 Aug 2013 16:32:38 +0000 (02:32 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 13 Dec 2014 01:33:37 +0000 (12:33 +1100)
(cherry picked from commit f999683)

qcsrc/menu/classes.c
qcsrc/menu/xonotic/dialog_settings_misc.c
qcsrc/menu/xonotic/dialog_settings_misc_reset.c [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.c

index 46d0c0269e01d8a3532941343457e1cb39fe346b..60063224906878d91a83baa098da86f5febd9f95 100644 (file)
 #include "xonotic/dialog_hudpanel_buffs.c"
 #include "xonotic/slider_picmip.c"
 #include "xonotic/slider_particles.c"
+#include "xonotic/dialog_settings_misc_reset.c"
index c14a47c9c1633c0714b3ae8054a6f5a06c56b8bd..489b00967b95e74d0177f979f9dd860f52866295 100644 (file)
@@ -151,5 +151,10 @@ void XonoticMiscSettingsTab_fill(entity me)
                        e.onClick = DialogOpenButton_Click;
                        e.onClickEntity = main.cvarsDialog;
        me.TR(me);
+               me.TDempty(me, 0.5);
+               me.TD(me, 1, 2, e = makeXonoticButton(_("Factory reset"), '0 0 0'));
+                       e.onClick = DialogOpenButton_Click;
+                       e.onClickEntity = main.resetDialog;
+       me.TR(me);
 }
 #endif
diff --git a/qcsrc/menu/xonotic/dialog_settings_misc_reset.c b/qcsrc/menu/xonotic/dialog_settings_misc_reset.c
new file mode 100644 (file)
index 0000000..8f6da0a
--- /dev/null
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(XonoticResetDialog) EXTENDS(XonoticDialog)
+       METHOD(XonoticResetDialog, fill, void(entity))
+       ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
+       ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+       ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticResetDialog, rows, float, 4)
+       ATTRIB(XonoticResetDialog, columns, float, 2)
+       ATTRIB(XonoticResetDialog, name, string, "Factory reset")
+ENDCLASS(XonoticResetDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticResetDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to reset all settings?")));
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("This will create a backup config in your data directory")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "saveconfig backup.cfg\n;\n exec defaultXonotic.cfg\n", 0));
+               me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
+                       e.onClick = Dialog_Close;
+                       e.onClickEntity = me;
+}
+#endif
index 5c58025fca1f5e3ac87501e585ffee2828e7aed3..e0dd17e0ebcd2f1e9505d83f8ebb01a464b2d723 100644 (file)
@@ -20,6 +20,7 @@ CLASS(MainWindow) EXTENDS(ModalController)
        ATTRIB(MainWindow, mainNexposee, entity, NULL)
        ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
        ATTRIB(MainWindow, dialogToShow, entity, NULL)
+       ATTRIB(MainWindow, resetDialog, entity, NULL)
 ENDCLASS(MainWindow)
 #endif
 
@@ -139,6 +140,10 @@ void MainWindow_configureMainWindow(entity me)
        me.cvarsDialog = i = spawnXonoticCvarsDialog();
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+       
+       me.resetDialog = i = spawnXonoticResetDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
        me.languageWarningDialog = i = spawnXonoticLanguageWarningDialog();
        i.configureDialog(i);