//**************************************************************************** //Copyright (C) 2005-2006 Beijing BlueDJ Technology Co.,Ltd. All rights reserved. //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. //You should have received a copy of the GNU General Public License //along with this program (in the file LICENSE.GPL); if not, write to the Free Software //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //Please visit http://www.bluedj.com for more infomation about us. //Contact us at ggwizard@gmail.com or darkdong@gmail.com. //****************************************************************************/ #include "MJTing.h" static const char* KEY_MAHJONG = "Mahjong"; static const char* KEY_TING = "Ting"; static const char* KEY_AUTO_GANG = "AutoGang"; static const char* KEY_ONLY_ZIMOHU = "OnlyZimoHu"; MJTing::MJTing( QWidget * parent, Qt::WFlags f ) :QDialog( parent, f ) { setupUi(this); QSettings tingSettings; tingSettings.beginGroup( KEY_MAHJONG ); tingSettings.beginGroup( KEY_TING ); cbAutoGang->setChecked( tingSettings.value( KEY_AUTO_GANG ).toBool() ); cbOnlyZimoHu->setChecked( tingSettings.value( KEY_ONLY_ZIMOHU ).toBool() ); tingSettings.endGroup(); tingSettings.endGroup(); } MJTing::~MJTing() { } void MJTing::on_okButton_clicked() { QSettings tingSettings; tingSettings.beginGroup( KEY_MAHJONG ); tingSettings.beginGroup( KEY_TING ); tingSettings.setValue( KEY_AUTO_GANG, cbAutoGang->isChecked() ); tingSettings.setValue( KEY_ONLY_ZIMOHU, cbOnlyZimoHu->isChecked() ); tingSettings.endGroup(); tingSettings.endGroup(); accept(); } void MJTing::on_cancelButton_clicked() { reject(); } bool MJTing::isAutoGang() const { return cbAutoGang->isChecked(); } bool MJTing::isOnlyZimoHu() const { return cbOnlyZimoHu->isChecked(); }