我正在使用 clientupdate.exe 来更新我的客户端,所以有一个 func "getVersion" 来获取最新的版本号:
Execute::Execute(QObject *parent) :
QObject(parent)
{
f=Father::GetInstance();
ftp=new FtpProvider(this);
connect(ftp,SIGNAL(getVersionFinished(QString)),SLOT(handGetversionFinished(QString)));
}
void Execute::getVersion()
{
ftp->isAutoDownloadFolder=false;
ftp->getVersion();
}
void Execute::handGetversionFinished(QString version)
{
f->mkinfo(Q_FUNC_INFO,QString("The lasest version num is:%1").arg(version));
QTextStream out(stdout);
out<<version;
std::cout<<version.data();
std::cout.flush();
// *我可以在这里获取版本号。}
在我的客户端程序中,我尝试获取版本号;像这样
void MainWindow::on_checkUpdateAct_triggered()
{
QString filepath=Paths::currentExeFilePath();
QStringList args;
args<<"getversion"<<filepath;
f->mkinfo(Q_FUNC_INFO,QString("start to check version"));
connect(&reStartProcess,SIGNAL(readyRead()),SLOT(handUpdateEXEReadyRead()));
connect(&reStartProcess,SIGNAL(readyReadStandardOutput()),SLOT(handUpdateEXEReadyRead()));
connect(&reStartProcess,SIGNAL(finished(int,QProcess::ExitStatus)),SLOT(handReStartFinished(int,QProcess::ExitStatus)));
reStartProcess.start("ClientUpdate.exe",args);
}
void MainWindow::handUpdateEXEReadyRead()
{
QString version=reStartProcess.readAll();
reStartProcess.terminate();
f->mkinfo(Q_FUNC_INFO,QString("The lasest version num is:%1").arg(version));
if(currentVersion>=version.toFloat())
{
f->msg->info("Update Client","Your client is the latest version");
}
else
{
if(f->msg->ask("Update Client?",QString("The latest version is:%1,Your version is:%2.\nUpdate?").arg(version).arg(currentVersion))==QMessageBox::Yes)
sendUpdateCommand();
}
}
但是我手头一无所获UpdateEXEReadyRead func,为什么为什么为什么