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, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
27#include <wx/process.h>
28#include <wx/msgqueue.h>
29
30#include <vector>
31
32class wxProcess;
33class wxThread;
34
36{
37public:
44
45 DIALOG_EXPORT_STEP_LOG( wxWindow* aParent, const wxString& aStepCmd );
46 ~DIALOG_EXPORT_STEP_LOG() override;
47
53 void SetTempFilesToCleanup( std::vector<wxString> aPaths );
54
55private:
56 void appendMessage( const wxString& aMessage );
57 void onProcessTerminate( wxProcessEvent& aEvent );
58 void onThreadInput( wxThreadEvent& );
59 void onClose( wxCloseEvent& event );
60 bool TransferDataToWindow() override;
61
62 void cleanupTempFiles();
63
64 wxProcess* m_process;
65 wxThread* m_stdioThread;
66 wxMessageQueue<STATE_MESSAGE> m_msgQueue;
68
69 std::vector<wxString> m_tempFiles;
70 bool m_tempFilesCleaned = false;
71};
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)