提交 f10735a1 编写于 作者: D dev
......@@ -19,11 +19,19 @@ cpp_threadpool
find0xff
论坛:二维数组中找最大特征数组
https://goldenhawking.blog.csdn.net/article/details/116240710
fileLoadControl
机械盘阵高并发——使用ImDisk 与 junction显著提高整体吞吐性能
https://goldenhawking.blog.csdn.net/article/details/122093588
floodfill_mdf
作业讲评-二值矩阵避障最短路径算法
https://goldenhawking.blog.csdn.net/article/details/109411787
findfoo
大道至简-基于C的库封装发布技术
https://goldenhawking.blog.csdn.net/article/details/119845838
huarongdao
广度优先求解算法演示(华容道C++代码,速度2644组/秒)
https://goldenhawking.blog.csdn.net/article/details/112414933
......
#include "dialogfileloadctrl.h"
#include "ui_dialogfileloadctrl.h"
#include <QFileDialog>
#include <QSettings>
#include <QFile>
#include <thread>
#include <QThread>
#include <QProcess>
#include <atomic>
DialogFileLoadCtrl::DialogFileLoadCtrl(QWidget *parent)
: QDialog(parent)
, ui(new Ui::DialogFileLoadCtrl)
, m_pMsgMd(new QStandardItemModel(this))
{
ui->setupUi(this);
m_nTimer = startTimer(10000);
loadSettings();
ui->listView_msg->setModel(m_pMsgMd);
slot_msg(tr("Program Started"));
setWindowFlag(Qt::WindowMinMaxButtonsHint,true);
}
DialogFileLoadCtrl::~DialogFileLoadCtrl()
{
delete ui;
}
void DialogFileLoadCtrl::timerEvent(QTimerEvent * evt)
{
if (evt->timerId()==m_nTimer && ui->checkBox_watch->isChecked())
{
if (ui->lineEdit_src_dir->text().trimmed().length()<2)
return;
slot_next_prg(-1);
slot_msg(tr("Start maintaining."));
killTimer(m_nTimer);
m_nTimer = -1;
updateMap();
cleanFile();
m_nTimer = startTimer(10000);
slot_msg(tr("Completed."));
slot_next_prg(0);
}
}
void DialogFileLoadCtrl::cleanFile()
{
quint8 cm = 0;
while (m_total_size > ui->doubleSpinBox_maxSz->value()*1024ll*1024ll*1024ll)
{
if (!m_cache_files.size())
break;
qint64 tmf = m_cache_files.begin()->first;
QMap<QString,QFileInfo> & mp = m_cache_files[tmf];
QMap<QString,qint64> & ms = m_cache_sizes[tmf];
if (!mp.size())
{
m_cache_files.erase(tmf);
m_cache_sizes.erase(tmf);
}
else
{
QString fm = mp.begin().key();
QFileInfo ifi = mp.begin().value();
assert(m_total_size >= ifi.size());
if (false==QFile::remove(fm))
{
QString msg = tr("Force Deleting %1.").arg(fm);
//Force Delete Using https://github.com/michaelknigge/forcedel
for (int ntr = 0; ntr < 10 && QFileInfo::exists(fm); ++ntr)
{
QThread::msleep(200);
QStringList args;
#ifdef __gnu_linux__
args<<"-f";
args<<fm;
QProcess::execute("rm",args);
#else
args<<fm;
QProcess::execute("ForceDel.exe",args);
#endif
}
slot_msg(msg);
}
if (!QFileInfo::exists(fm))
{
m_total_size -= ifi.size();
QString msg = tr("Succ Deleting %1.").arg(fm);
slot_msg(msg);
}
else
{
QString msg = tr("Fail Deleting %1.").arg(fm);
slot_msg(msg);
}
mp.remove(fm);
ms.remove(fm);
if (!mp.size())
{
m_cache_files.erase(tmf);
m_cache_sizes.erase(tmf);
}
}
if (++cm % 10==0)
slot_next_prg(0);
}
}
void DialogFileLoadCtrl::updateMap()
{
QFileInfoList lst = enumFiles(ui->lineEdit_src_dir->text());
m_total_size = 0;
m_total_files = 0;
const qint64 bfMin = ui->doubleSpinBox_bkMinSz->value()*1e6+.5;
const qint64 bfMax = ui->doubleSpinBox_bkMaxSz->value()*1e6+.5;
const QStringList FMLst = ui->lineEdit_dst_filetypes->text().split("|",Qt::SkipEmptyParts);
QSet<QString> FMUpper;
foreach(QString ex, FMLst)
{
QString r = ex.toUpper().trimmed();
if (r.length())
FMUpper << r;
}
foreach (QFileInfo i, lst)
{
QString fm = i.absoluteFilePath();
long long sz = i.size();
qint64 tm = i.fileTime(QFile::FileBirthTime).toMSecsSinceEpoch();
//Judge Whether this file need to be copied.
bool NeedTrans = false;
//1. Type
QString strExt = i.suffix().toUpper().trimmed();
if (strExt.length()<1)
strExt=":";
if (FMUpper.contains(strExt) || FMUpper.isEmpty())
{
//2. Size Range
if (sz>=bfMin && sz<=bfMax)
{
//3.First Descovered
if (!m_cache_files[tm].contains(fm))
NeedTrans = true;
//4.Size Changed
else if (m_cache_sizes[tm][fm]!=sz)
NeedTrans = true;
}
}
if (NeedTrans)
TransFile(i);
m_cache_files[tm][fm] = i;
m_cache_sizes[tm][fm] = sz;
m_total_size += sz;
++m_total_files;
}
QString msg = tr("Enuming %1 Files %2 Bytes.").arg(m_total_files).arg(m_total_size);
slot_next_prg(0);
slot_msg(msg);
}
void DialogFileLoadCtrl::TransFile(QFileInfo ifile)
{
if (ui->lineEdit_dst_dir->text().length()<2)
return;
QDir dirSrc(ui->lineEdit_src_dir->text());
//Relative Path
QString srcFile = dirSrc.relativeFilePath(ifile.absoluteFilePath());
QString relDir = dirSrc.relativeFilePath(ifile.absolutePath());
//Make destin path
QDir dirDst(ui->lineEdit_dst_dir->text());
QString dstDir = dirDst.absoluteFilePath(relDir);
QString dstFile = dirDst.absoluteFilePath(srcFile);
//mkpath
QFileInfo info(dstDir);
if (!info.exists())
dirDst.mkpath(dstDir);
//File
QFileInfo infof(dstFile);
if (infof.size()!=ifile.size())
{
//Copy
QFile::remove(dstFile);
//Copy thread in line
QString msg;
std::atomic<bool> bOk (false);
std::thread t([&]()->void{
if (true==QFile::copy(ifile.absoluteFilePath(),dstFile))
msg = tr("Succ Copy %1 to %2.").arg(ifile.absoluteFilePath()).arg(dstFile);
else
msg = tr("Busy File %1 with %2 Bytes.").arg( ifile.absoluteFilePath()).arg(ifile.size());
bOk = true;
});
//Hold and wait
slot_next_prg(0);
quint8 trc = 0;
while (!bOk)
{
QThread::msleep(1);
if (++trc % 100==0)
slot_next_prg(0);
}
t.join();
slot_msg(msg);
}
}
QFileInfoList DialogFileLoadCtrl::enumFiles(QString dirS)
{
QStringList lst;
lst<< "*.*";
lst<< "*";
QDir dir(dirS);
dir.makeAbsolute();
QFileInfoList linfo = dir.entryInfoList(lst);
QFileInfoList lstRes;
foreach(QFileInfo i, linfo)
{
if (i.isDir())
{
QString dn = i.fileName();
if (dn=="." ||dn==".." )
continue;
QFileInfoList lst_sub = enumFiles(i.absoluteFilePath());
std::copy(lst_sub.begin(),lst_sub.end(),std::back_inserter(lstRes));
}
else
lstRes << i;
}
slot_next_prg(0);
return lstRes;
}
void DialogFileLoadCtrl::slot_msg(QString s)
{
QDateTime dtm = QDateTime::currentDateTime();
QString dtms = dtm.toString("yyyy-MM-dd HH:mm:ss");
QString m = dtms +">" + s;
m_pMsgMd->appendRow(new QStandardItem(m));
if (m_pMsgMd->rowCount()>256)
m_pMsgMd->removeRows(0,m_pMsgMd->rowCount()-256);
ui->listView_msg->scrollToBottom();
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
void DialogFileLoadCtrl::on_pushButton_br_src_clicked()
{
QString dirS = QFileDialog::getExistingDirectory(this,tr("Watching root"),ui->lineEdit_src_dir->text());
if (dirS.length()<2)
return;
QFileInfo info(dirS);
ui->lineEdit_src_dir->setText(info.absoluteFilePath());
saveSettings();
}
void DialogFileLoadCtrl::on_pushButton_br_dst_clicked()
{
QString dirS = QFileDialog::getExistingDirectory(this,tr("backup root"),ui->lineEdit_dst_dir->text());
if (dirS.length()<2)
return;
ui->lineEdit_dst_dir->setText(dirS);
saveSettings();
}
void DialogFileLoadCtrl::loadSettings()
{
QSettings settings(QCoreApplication::applicationFilePath()+".ini",QSettings::IniFormat);
const QString lineEdit_src_dir = settings.value("ui/lineEdit_src_dir","").toString();
ui->lineEdit_src_dir->setText(lineEdit_src_dir);
const QString lineEdit_dst_dir = settings.value("ui/lineEdit_dst_dir","").toString();
ui->lineEdit_dst_dir->setText(lineEdit_dst_dir);
const QString lineEdit_dst_filetypes = settings.value("ui/lineEdit_dst_filetypes","bmp|Jpeg|Avi|Mpeg|Jpg|PNG|Tif|tiff").toString();
ui->lineEdit_dst_filetypes->setText(lineEdit_dst_filetypes);
const bool checkBox_watch = settings.value("ui/checkBox_watch",false).toBool();
ui->checkBox_watch->setChecked(checkBox_watch);
const double doubleSpinBox_maxSz = settings.value("ui/doubleSpinBox_maxSz",16).toDouble();
ui->doubleSpinBox_maxSz->setValue(doubleSpinBox_maxSz);
const double doubleSpinBox_bkMaxSz = settings.value("ui/doubleSpinBox_bkMaxSz",2000000).toDouble();
ui->doubleSpinBox_bkMaxSz->setValue(doubleSpinBox_bkMaxSz);
const double doubleSpinBox_bkMinSz = settings.value("ui/doubleSpinBox_bkMinSz",0).toDouble();
ui->doubleSpinBox_bkMinSz->setValue(doubleSpinBox_bkMinSz);
}
void DialogFileLoadCtrl::saveSettings()
{
QSettings settings(QCoreApplication::applicationFilePath()+".ini",QSettings::IniFormat);
const QString lineEdit_src_dir = ui->lineEdit_src_dir->text();
settings.setValue("ui/lineEdit_src_dir",lineEdit_src_dir);
const QString lineEdit_dst_dir = ui->lineEdit_dst_dir->text();
settings.setValue("ui/lineEdit_dst_dir",lineEdit_dst_dir);
const QString lineEdit_dst_filetypes = ui->lineEdit_dst_filetypes->text();
settings.setValue("ui/lineEdit_dst_filetypes",lineEdit_dst_filetypes);
const bool checkBox_watch = ui->checkBox_watch->isChecked();
settings.setValue("ui/checkBox_watch",checkBox_watch);
const double doubleSpinBox_maxSz = ui->doubleSpinBox_maxSz->value();
settings.setValue("ui/doubleSpinBox_maxSz",doubleSpinBox_maxSz);
const double doubleSpinBox_bkMaxSz = ui->doubleSpinBox_bkMaxSz->value();
settings.setValue("ui/doubleSpinBox_bkMaxSz",doubleSpinBox_bkMaxSz);
const double doubleSpinBox_bkMinSz = ui->doubleSpinBox_bkMinSz->value();
settings.setValue("ui/doubleSpinBox_bkMinSz",doubleSpinBox_bkMinSz);
}
void DialogFileLoadCtrl::on_checkBox_watch_clicked()
{
saveSettings();
slot_next_prg(ui->checkBox_watch->isChecked()?0:-1);
}
void DialogFileLoadCtrl::slot_next_prg(int n)
{
static char prg_val [] = ".-/|\\";
static unsigned char ps = 0;
if (n<0)
ui->label_prg->setText(QString(prg_val[0]));
else
ui->label_prg->setText(QString(prg_val[++ps%4+1]));
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
#ifndef DIALOGFILELOADCTRL_H
#define DIALOGFILELOADCTRL_H
#include <QDialog>
#include <QFileInfo>
#include <QFileInfoList>
#include <QDir>
#include <QStringList>
#include <map>
#include <QDateTime>
#include <QStandardItemModel>
QT_BEGIN_NAMESPACE
namespace Ui { class DialogFileLoadCtrl; }
QT_END_NAMESPACE
class DialogFileLoadCtrl : public QDialog
{
Q_OBJECT
public:
DialogFileLoadCtrl(QWidget *parent = nullptr);
~DialogFileLoadCtrl();
protected:
void timerEvent(QTimerEvent * evt) override;
QFileInfoList enumFiles(QString dirS);
void updateMap();
void cleanFile();
void TransFile(QFileInfo ifile);
private slots:
void slot_msg(QString);
void slot_next_prg(int v);
void on_pushButton_br_src_clicked();
void on_pushButton_br_dst_clicked();
void on_checkBox_watch_clicked();
private:
void loadSettings();
void saveSettings();
private:
Ui::DialogFileLoadCtrl *ui = 0;
QStandardItemModel * m_pMsgMd = 0;
int m_nTimer = -1;
std::map<qint64,QMap<QString,QFileInfo> > m_cache_files;
std::map<qint64,QMap<QString,qint64> > m_cache_sizes;
qint64 m_total_size = 0;
qint64 m_total_files = 0;
};
#endif // DIALOGFILELOADCTRL_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogFileLoadCtrl</class>
<widget class="QDialog" name="DialogFileLoadCtrl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>719</width>
<height>411</height>
</rect>
</property>
<property name="windowTitle">
<string>File Load Ctrl</string>
</property>
<property name="windowIcon">
<iconset resource="resource.qrc">
<normaloff>:/fileLoadControl.png</normaloff>:/fileLoadControl.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Watching Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_src_dir"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_br_src">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Destin Folder</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dst_dir"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_br_dst">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Backup files with Size From</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_bkMinSz">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>2000000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>MB To</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_bkMaxSz">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>2000000.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>2000000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>MB</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Total Keep Load</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox_maxSz">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.001000000000000</double>
</property>
<property name="maximum">
<double>1024.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>16.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>GB</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>File Typs(| splitted, : mean empty)</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dst_filetypes"/>
</item>
<item>
<widget class="QCheckBox" name="checkBox_watch">
<property name="text">
<string>Running</string>
</property>
<property name="icon">
<iconset resource="resource.qrc">
<normaloff>:/fileLoadControl.png</normaloff>:/fileLoadControl.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_prg">
<property name="text">
<string>.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListView" name="listView_msg"/>
</item>
</layout>
</widget>
<resources>
<include location="resource.qrc"/>
</resources>
<connections/>
</ui>
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
dialogfileloadctrl.cpp
HEADERS += \
dialogfileloadctrl.h
FORMS += \
dialogfileloadctrl.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RC_ICONS=fileLoadControl.ico
DISTFILES += \
fileLoadControl.ico\
fileLoadControl_zh_CN.qm \
fileLoadControl_zh_CN.ts
TRANSLATIONS += fileLoadControl_zh_CN.ts
RESOURCES += \
resource.qrc
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>DialogFileLoadCtrl</name>
<message>
<location filename="dialogfileloadctrl.ui" line="14"/>
<source>File Load Ctrl</source>
<translation>文件拷贝与配额控制</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="41"/>
<source>Watching Folder</source>
<translation>配额文件夹</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="51"/>
<location filename="dialogfileloadctrl.ui" line="72"/>
<source>...</source>
<translation>...</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="62"/>
<source>Destin Folder</source>
<translation>目的文件夹</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="83"/>
<source>Backup files with Size From</source>
<translation>备份大小介于</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="109"/>
<source>MB To</source>
<translation>MB </translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="135"/>
<source>MB</source>
<translation>MB的文件</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="155"/>
<source>Total Keep Load</source>
<translation>配额空间</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="181"/>
<source>GB</source>
<translation>GB</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="192"/>
<source>File Typs(| splitted, : mean empty)</source>
<translation>备份文件类型(|分割,:表示空扩展名)</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="202"/>
<source>Running</source>
<translation>运行开关</translation>
</message>
<message>
<location filename="dialogfileloadctrl.ui" line="213"/>
<source>.</source>
<translation>.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="19"/>
<source>Program Started</source>
<translation>程序启动</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="35"/>
<source>Start maintaining.</source>
<translation>开始维护.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="41"/>
<source>Completed.</source>
<translation>完成.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="93"/>
<source>Fail Deleting %1.</source>
<translation>删除文件失败:%1.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="194"/>
<source>Busy File %1 with %2 Bytes.</source>
<oldsource>Busy File %1 Bytes.</oldsource>
<translation>文件尚在繁忙: %1 ,%2 字节.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="68"/>
<source>Force Deleting %1.</source>
<translation>强制删除文件:%1.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="88"/>
<source>Succ Deleting %1.</source>
<translation>删除文件成功:%1.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="159"/>
<source>Enuming %1 Files %2 Bytes.</source>
<translation>当前枚举到 %1 个文件占用 %2 字节.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="192"/>
<source>Succ Copy %1 to %2.</source>
<translation>备份文件成功:%1 %2.</translation>
</message>
<message>
<source>Fail Copy %1 to %2.</source>
<translation type="vanished">备份文件失败:%1 %2.</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="252"/>
<source>Watching root</source>
<translation>配额监视根文件夹</translation>
</message>
<message>
<location filename="dialogfileloadctrl.cpp" line="262"/>
<source>backup root</source>
<translation>备份目的根文件夹</translation>
</message>
</context>
</TS>
#include "dialogfileloadctrl.h"
#include <QApplication>
#include <QLibraryInfo>
#include <QTranslator>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&qtTranslator);
QTranslator appTranslator;
QString strTransLocalFile =":/" +
QCoreApplication::applicationName()+"_"+
QLocale::system().name()+".qm";
appTranslator.load(strTransLocalFile );
a.installTranslator(&appTranslator);
DialogFileLoadCtrl w;
w.show();
return a.exec();
}
<RCC>
<qresource prefix="/">
<file>fileLoadControl.png</file>
<file>fileLoadControl.ico</file>
<file>fileLoadControl_zh_CN.qm</file>
</qresource>
</RCC>
......@@ -182,7 +182,7 @@ int runSend()
{
tm_idle = time(0);
char buf_tm[256];
sprintf(buf_tm,"%d",tm_idle);
sprintf(buf_tm,"Time=%lld\n",tm_idle);
int sl = strlen(buf_tm);
mtx_data.lock();
std::copy(buf_tm,buf_tm+sl,std::back_inserter(lst_data));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册