Several fixes for compilation with gcc (doesn't link)
This commit is contained in:
parent
a2f39692a2
commit
dd9906dbd8
20 changed files with 379 additions and 262 deletions
|
|
@ -9,6 +9,8 @@
|
|||
#include <QScrollBar>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
BackupDialog::BackupDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::BackupDialog)
|
||||
|
|
@ -81,7 +83,7 @@ void BackupDialog::on_process_errorOccurred(QProcess::ProcessError error)
|
|||
msg = tr("Failed to start");
|
||||
break;
|
||||
case 1:
|
||||
msg = tr("Crasged");
|
||||
msg = tr("Crashed");
|
||||
break;
|
||||
case 2:
|
||||
msg = tr("Timedout");
|
||||
|
|
@ -175,6 +177,50 @@ void BackupDialog::on_btnStart_clicked()
|
|||
setParams(arguments);
|
||||
|
||||
|
||||
// BOOL res = AllocConsole();
|
||||
// if (!res) {
|
||||
// DWORD error = GetLastError();
|
||||
// QMessageBox::critical(this, "pglab", tr("AllocConsole failed %1").arg(error), QMessageBox::Close);
|
||||
// }
|
||||
// HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
// DWORD written;
|
||||
// res = WriteConsoleOutputCharacter(out, L"Hello, world!\n", 14, {0, 0}, &written);
|
||||
|
||||
// PROCESS_INFORMATION proc_info;
|
||||
// STARTUPINFO startup_info;
|
||||
// memset(&startup_info, 0, sizeof(startup_info));
|
||||
// startup_info.cb = sizeof(startup_info);
|
||||
// startup_info.lpReserved;
|
||||
// startup_info.lpDesktop;
|
||||
// startup_info.lpTitle;
|
||||
// startup_info.dwX;
|
||||
// startup_info.dwY;
|
||||
// startup_info.dwXSize;
|
||||
// startup_info.dwYSize;
|
||||
// startup_info.dwXCountChars;
|
||||
// startup_info.dwYCountChars;
|
||||
// startup_info.dwFillAttribute;
|
||||
// startup_info.dwFlags = STARTF_USESTDHANDLES;
|
||||
// startup_info.wShowWindow;
|
||||
// startup_info.cbReserved2;
|
||||
// startup_info.lpReserved2;
|
||||
// startup_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
// startup_info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
// startup_info.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
// res = CreateProcess(
|
||||
// LR"_(C:\Prog\build-conoutputtest-Desktop_Qt_5_8_0_MSVC2015_32bit2-Debug\debug\conoutputtest.exe)_",
|
||||
// NULL, // _Inout_opt_ LPTSTR lpCommandLine,
|
||||
// NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||
// NULL, // _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
// TRUE,
|
||||
// 0, // _In_ DWORD dwCreationFlags,
|
||||
// NULL, // _In_opt_ LPVOID lpEnvironment,
|
||||
// NULL, // _In_opt_ LPCTSTR lpCurrentDirectory,
|
||||
// &startup_info, // _In_ LPSTARTUPINFO lpStartupInfo,
|
||||
// &proc_info // _Out_ LPPROCESS_INFORMATION lpProcessInformation
|
||||
// );
|
||||
|
||||
|
||||
// QString program = R"_(C:\prog\build-conoutputtest-Desktop_Qt_5_8_0_MSVC2015_32bit2-Debug\debug\conoutputtest.exe)_";
|
||||
// QStringList arguments;
|
||||
// arguments << "/C" << "DIR /S c:\\";
|
||||
|
|
@ -188,6 +234,13 @@ void BackupDialog::on_btnStart_clicked()
|
|||
auto p = new QProcess(this);
|
||||
ConnectTo(p);
|
||||
p->setProcessEnvironment(env);
|
||||
|
||||
p->setCreateProcessArgumentsModifier([] (QProcess::CreateProcessArguments *args)
|
||||
{
|
||||
args->flags |= CREATE_NEW_CONSOLE;
|
||||
args->flags &= ~DETACHED_PROCESS;
|
||||
args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES;
|
||||
});
|
||||
p->start(program, arguments);
|
||||
}
|
||||
|
||||
|
|
@ -221,3 +274,4 @@ void BackupDialog::on_selectDestination_clicked()
|
|||
ui->editFilename->setText(QDir::toNativeSeparators(fn));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue