1 /**************************************************************************
2 ** This file is part of LiteIDE
3 **
4 ** Copyright (c) 2011-2019 LiteIDE. All rights reserved.
5 **
6 ** This library is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU Lesser General Public
8 ** License as published by the Free Software Foundation; either
9 ** version 2.1 of the License, or (at your option) any later version.
10 **
11 ** This library is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ** Lesser General Public License for more details.
15 **
16 ** In addition, as a special exception,  that plugins developed for LiteIDE,
17 ** are allowed to remain closed sourced and can be distributed under any license .
18 ** These rights are included in the file LGPL_EXCEPTION.txt in this package.
19 **
20 **************************************************************************/
21 // Module: litedebugoption.cpp
22 // Creator: visualfc <visualfc@gmail.com>
23 
24 #include "litedebugoption.h"
25 #include "ui_litedebugoption.h"
26 #include "litedebug_global.h"
27 //lite_memory_check_begin
28 #if defined(WIN32) && defined(_MSC_VER) &&  defined(_DEBUG)
29      #define _CRTDBG_MAP_ALLOC
30      #include <stdlib.h>
31      #include <crtdbg.h>
32      #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ )
33      #define new DEBUG_NEW
34 #endif
35 //lite_memory_check_end
36 
LiteDebugOption(LiteApi::IApplication * app,QObject * parent)37 LiteDebugOption::LiteDebugOption(LiteApi::IApplication *app,QObject *parent) :
38     LiteApi::IOption(parent),
39     m_liteApp(app),
40     m_widget(new QWidget),
41     ui(new Ui::LiteDebugOption)
42 {
43     ui->setupUi(m_widget);
44 }
45 
~LiteDebugOption()46 LiteDebugOption::~LiteDebugOption()
47 {
48     delete m_widget;
49     delete ui;
50 }
51 
widget()52 QWidget *LiteDebugOption::widget()
53 {
54     return m_widget;
55 }
56 
name() const57 QString LiteDebugOption::name() const
58 {
59     return "LiteDebug";
60 }
61 
mimeType() const62 QString LiteDebugOption::mimeType() const
63 {
64     return OPTION_LITEDEBUG;
65 }
66 
load()67 void LiteDebugOption::load()
68 {
69     bool b = m_liteApp->settings()->value(LITEDEBUG_AUTOBREAKMAIN,false).toBool();
70     ui->autoBreakMainCheckBox->setChecked(b);
71 }
72 
save()73 void LiteDebugOption::save()
74 {
75     bool b = ui->autoBreakMainCheckBox->isChecked();
76     m_liteApp->settings()->setValue(LITEDEBUG_AUTOBREAKMAIN,b);
77 }
78