QTfrontend/gameuiconfig.cpp
changeset 87 ff213e443336
parent 85 44d9045b26ff
child 97 e7c1df9cce2c
equal deleted inserted replaced
86:664b536a1c27 87:ff213e443336
    32  */
    32  */
    33 
    33 
    34 #include <QMessageBox>
    34 #include <QMessageBox>
    35 #include <QTextStream>
    35 #include <QTextStream>
    36 #include "gameuiconfig.h"
    36 #include "gameuiconfig.h"
       
    37 #include "hwform.h"
       
    38 #include "pages.h"
    37 
    39 
    38 GameUIConfig::GameUIConfig(HWForm * FormWidgets)
    40 GameUIConfig::GameUIConfig(HWForm * FormWidgets)
    39 	: QObject()
    41 	: QObject()
    40 {
    42 {
    41 	Form = FormWidgets;
    43 	Form = FormWidgets;
    65 		{
    67 		{
    66 			str = stream.readLine();
    68 			str = stream.readLine();
    67 			if (str.startsWith(";")) continue;
    69 			if (str.startsWith(";")) continue;
    68 			if (str.startsWith("resolution "))
    70 			if (str.startsWith("resolution "))
    69 			{
    71 			{
    70 				Form->ui.CBResolution->setCurrentIndex(str.mid(11).toLong());
    72 				Form->ui.pageOptions->CBResolution->setCurrentIndex(str.mid(11).toLong());
    71 			} else
    73 			} else
    72 			if (str.startsWith("fullscreen "))
    74 			if (str.startsWith("fullscreen "))
    73 			{
    75 			{
    74 				Form->ui.CBFullscreen->setChecked(str.mid(11).toLong());
    76 				Form->ui.pageOptions->CBFullscreen->setChecked(str.mid(11).toLong());
    75 			} else
    77 			} else
    76 			if (str.startsWith("sound "))
    78 			if (str.startsWith("sound "))
    77 			{
    79 			{
    78 				Form->ui.CBEnableSound->setChecked(str.mid(6).toLong());
    80 				Form->ui.pageOptions->CBEnableSound->setChecked(str.mid(6).toLong());
    79 			} else
    81 			} else
    80 			if (str.startsWith("nick "))
    82 			if (str.startsWith("nick "))
    81 			{
    83 			{
    82 				Form->ui.editNetNick->setText(str.mid(5));
    84 				Form->ui.pageOptions->editNetNick->setText(str.mid(5));
    83 			}
    85 			}
    84 		}
    86 		}
    85 		settings.close();
    87 		settings.close();
    86 	}
    88 	}
    87 }
    89 }
   103 		return ;
   105 		return ;
   104 	}
   106 	}
   105 	QTextStream stream(&settings);
   107 	QTextStream stream(&settings);
   106 	stream.setCodec("UTF-8");
   108 	stream.setCodec("UTF-8");
   107 	stream << "; Generated by Hedgewars, do not modify" << endl;
   109 	stream << "; Generated by Hedgewars, do not modify" << endl;
   108 	stream << "resolution " << Form->ui.CBResolution->currentIndex() << endl;
   110 	stream << "resolution " << Form->ui.pageOptions->CBResolution->currentIndex() << endl;
   109 	stream << "fullscreen " << Form->ui.CBFullscreen->isChecked() << endl;
   111 	stream << "fullscreen " << Form->ui.pageOptions->CBFullscreen->isChecked() << endl;
   110 	stream << "sound " << Form->ui.CBEnableSound->isChecked() << endl;
   112 	stream << "sound " << Form->ui.pageOptions->CBEnableSound->isChecked() << endl;
   111 	stream << "nick " << Form->ui.editNetNick->text() << endl;
   113 	stream << "nick " << Form->ui.pageOptions->editNetNick->text() << endl;
   112 	settings.close();
   114 	settings.close();
   113 }
   115 }
   114 
   116 
   115 int GameUIConfig::vid_Resolution()
   117 int GameUIConfig::vid_Resolution()
   116 {
   118 {
   117 	return Form->ui.CBResolution->currentIndex();
   119 	return Form->ui.pageOptions->CBResolution->currentIndex();
   118 }
   120 }
   119 
   121 
   120 bool GameUIConfig::vid_Fullscreen()
   122 bool GameUIConfig::vid_Fullscreen()
   121 {
   123 {
   122 	return Form->ui.CBFullscreen->isChecked();
   124 	return Form->ui.pageOptions->CBFullscreen->isChecked();
   123 }
   125 }
   124 
   126 
   125 bool GameUIConfig::isSoundEnabled()
   127 bool GameUIConfig::isSoundEnabled()
   126 {
   128 {
   127 	return Form->ui.CBEnableSound->isChecked();
   129 	return Form->ui.pageOptions->CBEnableSound->isChecked();
   128 }
   130 }