Skip to content

Commit

Permalink
Msdos format to unix format
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed May 11, 2024
1 parent 8a09929 commit fdc2e00
Show file tree
Hide file tree
Showing 73 changed files with 8,813 additions and 8,813 deletions.
154 changes: 77 additions & 77 deletions App/DlgOption.cpp
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
#include "DlgOption.h"
#include "ui_DlgOption.h"
#include "Global/TasksTools.h"
#include "RabbitCommonDir.h"
#include "RabbitCommonTools.h"
#include <QSettings>
#include "LunarCalendar.h"
#include <QLoggingCategory>

static Q_LOGGING_CATEGORY(log, "Rabbit.LunarCalendar.Option")

CDlgOption::CDlgOption(QWidget *parent) :
QDialog(parent),
ui(new Ui::CDlgOption)
{
ui->setupUi(this);

ui->cbRunFromBoot->setChecked(RabbitCommon::CTools::IsStartRun());
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
bool bShow = set.value("Options/MainWindow/Show", false).toBool();
ui->cbShowMainWindows->setChecked(bShow);
int nType = set.value("Options/Calendar/Type", 0).toInt();
if(0 == nType)
ui->cbAutomation->setChecked(true);
if(static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar) & nType)
ui->cbSolar->setChecked(true);
if(static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar) & nType)
ui->cbLunar->setChecked(true);
}

CDlgOption::~CDlgOption()
{
delete ui;
}

void CDlgOption::on_buttonBox_accepted()
{
if(ui->cbRunFromBoot->checkState() == Qt::Checked)
RabbitCommon::CTools::InstallStartRun();
else
RabbitCommon::CTools::RemoveStartRun();

QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
set.setValue("Options/MainWindow/Show", ui->cbShowMainWindows->isChecked());
if(ui->cbAutomation->isChecked())
set.setValue("Options/Calendar/Type", 0);
else {
int nType = 0;
nType = set.value("Options/Calendar/Type", 0).toInt();
if(ui->cbSolar->isChecked())
{
nType |= static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar);
} else {
nType &= ~static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar);
}
if(ui->cbLunar->isChecked()) {
nType |= static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar);
} else {
nType &= ~static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar);
}
set.setValue("Options/Calendar/Type", nType);
}
}

void CDlgOption::on_cbAutomation_toggled(bool checked)
{
qDebug(log) << "on_cbAutomation_clicked";
if(checked) {
ui->cbLunar->setEnabled(false);
ui->cbSolar->setEnabled(false);
} else {
ui->cbLunar->setEnabled(true);
ui->cbSolar->setEnabled(true);
}
}
#include "DlgOption.h"
#include "ui_DlgOption.h"
#include "Global/TasksTools.h"
#include "RabbitCommonDir.h"
#include "RabbitCommonTools.h"
#include <QSettings>
#include "LunarCalendar.h"
#include <QLoggingCategory>

static Q_LOGGING_CATEGORY(log, "Rabbit.LunarCalendar.Option")

CDlgOption::CDlgOption(QWidget *parent) :
QDialog(parent),
ui(new Ui::CDlgOption)
{
ui->setupUi(this);

ui->cbRunFromBoot->setChecked(RabbitCommon::CTools::IsStartRun());
QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
bool bShow = set.value("Options/MainWindow/Show", false).toBool();
ui->cbShowMainWindows->setChecked(bShow);
int nType = set.value("Options/Calendar/Type", 0).toInt();
if(0 == nType)
ui->cbAutomation->setChecked(true);
if(static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar) & nType)
ui->cbSolar->setChecked(true);
if(static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar) & nType)
ui->cbLunar->setChecked(true);
}

CDlgOption::~CDlgOption()
{
delete ui;
}

void CDlgOption::on_buttonBox_accepted()
{
if(ui->cbRunFromBoot->checkState() == Qt::Checked)
RabbitCommon::CTools::InstallStartRun();
else
RabbitCommon::CTools::RemoveStartRun();

QSettings set(RabbitCommon::CDir::Instance()->GetFileUserConfigure(),
QSettings::IniFormat);
set.setValue("Options/MainWindow/Show", ui->cbShowMainWindows->isChecked());
if(ui->cbAutomation->isChecked())
set.setValue("Options/Calendar/Type", 0);
else {
int nType = 0;
nType = set.value("Options/Calendar/Type", 0).toInt();
if(ui->cbSolar->isChecked())
{
nType |= static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar);
} else {
nType &= ~static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeSolar);
}
if(ui->cbLunar->isChecked()) {
nType |= static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar);
} else {
nType &= ~static_cast<int>(CLunarCalendar::_CalendarType::CalendarTypeLunar);
}
set.setValue("Options/Calendar/Type", nType);
}
}

void CDlgOption::on_cbAutomation_toggled(bool checked)
{
qDebug(log) << "on_cbAutomation_clicked";
if(checked) {
ui->cbLunar->setEnabled(false);
ui->cbSolar->setEnabled(false);
} else {
ui->cbLunar->setEnabled(true);
ui->cbSolar->setEnabled(true);
}
}
52 changes: 26 additions & 26 deletions App/DlgOption.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#ifndef DLGOPTION_H
#define DLGOPTION_H

#include <QDialog>

namespace Ui {
class CDlgOption;
}

class CDlgOption : public QDialog
{
Q_OBJECT

public:
explicit CDlgOption(QWidget *parent = nullptr);
~CDlgOption();

private slots:
void on_buttonBox_accepted();
void on_cbAutomation_toggled(bool checked);

private:
Ui::CDlgOption *ui;
};

#endif // DLGOPTION_H
#ifndef DLGOPTION_H
#define DLGOPTION_H

#include <QDialog>

namespace Ui {
class CDlgOption;
}

class CDlgOption : public QDialog
{
Q_OBJECT

public:
explicit CDlgOption(QWidget *parent = nullptr);
~CDlgOption();

private slots:
void on_buttonBox_accepted();
void on_cbAutomation_toggled(bool checked);

private:
Ui::CDlgOption *ui;
};

#endif // DLGOPTION_H
Loading

0 comments on commit fdc2e00

Please sign in to comment.