代码拉取完成,页面将自动刷新
同步操作将从 s_baoshan/qsrv 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "update698.h"
#include "ui_update698.h"
#include <QFileDialog>
#include <QDir>
#include <QMessageBox>
#include <QSettings>
update698::update698(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::update698),
m_settings(new QSettings("config/config.ini", QSettings::IniFormat, this))
{
ui->setupUi(this);
connect(ui->btn_browse, SIGNAL(clicked(bool)), this, SLOT(browse()));
int size = m_settings->value("fileBlocks/defaultSize").toInt();
m_oneBlockSize = (size > 0 ? size : 512);
ui->buttonGroup->setId(ui->rbtn_256, 0);
ui->buttonGroup->setId(ui->rbtn_512, 1);
ui->buttonGroup->setId(ui->rbtn_1024, 2);
QObject::connect(ui->buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(btnToggle(int)));
ui->buttonGroup->button(m_settings->value("fileBlocks/rbtnIndex").toInt()%3)->setChecked(true);
}
update698::~update698()
{
m_settings->setValue("fileBlocks/rbtnIndex", ui->buttonGroup->checkedId());
delete ui;
}
void update698::on_btn_exit_clicked(bool)
{
this->close();
}
void update698::btnToggle(int i)
{
switch (i) {
case 0:
m_oneBlockSize = 256;
break;
case 1:
m_oneBlockSize = 512;
break;
case 2:
m_oneBlockSize = 1024;
break;
default:
m_oneBlockSize = 512;
break;
}
}
void update698::browse()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"),
QDir::homePath(),
tr("all file (*)"));
ui->lineEdit_filename->setText(filename);
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::critical(this, tr("open error"),
tr("can not open this file!"));
return;
}
file.seek(0);
m_fileblock = file.readAll();
file.close();
calcBlocks();
}
void update698::calcBlocks()
{
int i = 0;
m_filesize = m_fileblock.count();
m_blockCount = m_filesize/m_oneBlockSize + (((m_filesize%m_oneBlockSize)==0) ? 0 : 1);
m_blockList.clear();
for (i = 0; (i + m_oneBlockSize) <= m_filesize; i += m_oneBlockSize)
m_blockList.append(m_fileblock.mid(i, m_oneBlockSize));
if ((m_filesize-i) > 0)
m_blockList.append(m_fileblock.mid(i, (m_filesize-i)));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。