KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_export_step_process.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 * Copyright (C) 2020 New Pagodi(https://stackoverflow.com/users/6846682/new-pagodi)
6 * from https://stackoverflow.com/a/63289812/1522001
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
23#include <wx/process.h>
24#include <wx/msgqueue.h>
25
26#include <vector>
27
28class wxProcess;
29class wxThread;
30
32{
33public:
40
41 DIALOG_EXPORT_STEP_LOG( wxWindow* aParent, const wxString& aStepCmd );
42 ~DIALOG_EXPORT_STEP_LOG() override;
43
49 void SetTempFilesToCleanup( std::vector<wxString> aPaths );
50
51private:
52 void appendMessage( const wxString& aMessage );
53 void onProcessTerminate( wxProcessEvent& aEvent );
54 void onThreadInput( wxThreadEvent& );
55 void onClose( wxCloseEvent& event );
56 bool TransferDataToWindow() override;
57
58 void cleanupTempFiles();
59
60 wxProcess* m_process;
61 wxThread* m_stdioThread;
62 wxMessageQueue<STATE_MESSAGE> m_msgQueue;
64
65 std::vector<wxString> m_tempFiles;
66 bool m_tempFilesCleaned = false;
67};
void appendMessage(const wxString &aMessage)
void SetTempFilesToCleanup(std::vector< wxString > aPaths)
Register files that should be removed once the subprocess is known to have terminated (or been repare...
std::vector< wxString > m_tempFiles
DIALOG_EXPORT_STEP_LOG(wxWindow *aParent, const wxString &aStepCmd)
void onProcessTerminate(wxProcessEvent &aEvent)
@ PROCESS_COMPLETE
Informs the thread the process terminate event was received from wx.
@ REQUEST_EXIT
Asks the thread to exit and kill the process.
@ SENTINEL
Just a dummy entry for end of list.
void onClose(wxCloseEvent &event)
wxMessageQueue< STATE_MESSAGE > m_msgQueue
DIALOG_EXPORT_STEP_PROCESS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("3D Export"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)