diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-17 21:44:03 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-07-17 21:44:03 +0200 |
commit | 5384d95c28298710fee6728bb83614a130469716 (patch) | |
tree | 75ee887fc1a5d8c3a29c321dddacb6d72159589d | |
parent | b26534cb358803feefd03a21fc51764be541b852 (diff) | |
download | alpine-usb-creator-5384d95c28298710fee6728bb83614a130469716.tar.bz2 alpine-usb-creator-5384d95c28298710fee6728bb83614a130469716.tar.xz |
Pass over source and target to creator thread
-rw-r--r-- | Alpine Linux USB Creator.dev | 22 | ||||
-rw-r--r-- | Alpine Linux USB Creator.layout | 4 | ||||
-rw-r--r-- | Makefile.win | 11 | ||||
-rw-r--r-- | creator_thread.cpp | 17 | ||||
-rw-r--r-- | creator_thread.h | 6 | ||||
-rw-r--r-- | dialog.cpp | 7 |
6 files changed, 55 insertions, 12 deletions
diff --git a/Alpine Linux USB Creator.dev b/Alpine Linux USB Creator.dev index 6f96408..fb73570 100644 --- a/Alpine Linux USB Creator.dev +++ b/Alpine Linux USB Creator.dev @@ -1,7 +1,7 @@ [Project]
FileName=Alpine Linux USB Creator.dev
Name=Alpine Linux USB Creator
-UnitCount=6
+UnitCount=8
PchHead=-1
PchSource=-1
Ver=3
@@ -145,3 +145,23 @@ SupportXPThemes=0 CompilerSet=9
CompilerType=9
+[Unit7]
+FileName=creator_thread.cpp
+CompileCpp=1
+Folder=Alpine Linux USB Creator
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit8]
+FileName=creator_thread.h
+CompileCpp=1
+Folder=Alpine Linux USB Creator
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/Alpine Linux USB Creator.layout b/Alpine Linux USB Creator.layout index 462283c..10a373d 100644 --- a/Alpine Linux USB Creator.layout +++ b/Alpine Linux USB Creator.layout @@ -4,7 +4,7 @@ Order=0,1,2 [Editor_0]
Open=1
Top=1
-CursorCol=1
+CursorCol=2
CursorRow=1
TopLine=1
LeftChar=1
@@ -19,7 +19,7 @@ LeftChar=1 Open=1
Top=0
CursorCol=1
-CursorRow=1
+CursorRow=8
TopLine=1
LeftChar=1
[Editor_3]
diff --git a/Makefile.win b/Makefile.win index 33f2ee0..7c0d734 100644 --- a/Makefile.win +++ b/Makefile.win @@ -1,14 +1,14 @@ # Project: Alpine Linux USB Creator
# Compiler: Default GCC compiler
# Compiler Type: MingW 3
-# Makefile created by wxDev-C++ IDE 7.4.2.569 on 15/07/12 22:50
+# Makefile created by wxDev-C++ IDE 7.4.2.569 on 17/07/12 19:58
WXLIBNAME = wxmsw29u
CPP = g++.exe
CC = gcc.exe
WINDRES = "windres.exe"
-OBJ = Objects/MingW/dialog.o Objects/MingW/main.o Objects/MingW/dialog_ui.o
-LINKOBJ = "Objects/MingW/dialog.o" "Objects/MingW/main.o" "Objects/MingW/dialog_ui.o"
+OBJ = Objects/MingW/dialog.o Objects/MingW/main.o Objects/MingW/dialog_ui.o Objects/MingW/creator_thread.o
+LINKOBJ = "Objects/MingW/dialog.o" "Objects/MingW/main.o" "Objects/MingW/dialog_ui.o" "Objects/MingW/creator_thread.o"
LIBS = -L"C:/Program Files/Dev-Cpp/lib/wx/gcc_lib" -L"C:/Program Files/Dev-Cpp/lib" -L"C:/Program Files/Dev-Cpp/MinGW32/lib" -mwindows -l$(WXLIBNAME) -l$(WXLIBNAME)_gl -lwxscintilla -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32 -g3
INCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include" -I"C:/Program Files/Dev-Cpp/" -I"C:/Program Files/Dev-Cpp/include/common"
@@ -36,7 +36,7 @@ clean: clean-custom $(BIN): $(OBJ)
$(LINK) $(LINKOBJ) -o "$(BIN)" $(LIBS)
-Objects/MingW/dialog.o: $(GLOBALDEPS) dialog.cpp dialog.h dialog_ui.h
+Objects/MingW/dialog.o: $(GLOBALDEPS) dialog.cpp dialog.h dialog_ui.h creator_thread.h dialog.h
$(CPP) -c dialog.cpp -o Objects/MingW/dialog.o $(CXXFLAGS)
Objects/MingW/main.o: $(GLOBALDEPS) main.cpp main.h dialog.h dialog_ui.h
@@ -44,3 +44,6 @@ Objects/MingW/main.o: $(GLOBALDEPS) main.cpp main.h dialog.h dialog_ui.h Objects/MingW/dialog_ui.o: $(GLOBALDEPS) dialog_ui.cpp dialog_ui.h
$(CPP) -c dialog_ui.cpp -o Objects/MingW/dialog_ui.o $(CXXFLAGS)
+
+Objects/MingW/creator_thread.o: $(GLOBALDEPS) creator_thread.cpp creator_thread.h dialog.h dialog_ui.h
+ $(CPP) -c creator_thread.cpp -o Objects/MingW/creator_thread.o $(CXXFLAGS)
diff --git a/creator_thread.cpp b/creator_thread.cpp index 2443c6b..f5ab6b2 100644 --- a/creator_thread.cpp +++ b/creator_thread.cpp @@ -1,9 +1,20 @@ +#include <wx/msgdlg.h> + #include "creator_thread.h" -CreatorThread::CreatorThread(Dialog *d) +CreatorThread::CreatorThread(Dialog *d, const wxString &iso, const wxString &target) : wxThread() { m_dialog = d; + m_source = new wxFileName(iso); + m_target = new wxFileName(target, wxEmptyString); +} + +CreatorThread::~CreatorThread() +{ + delete m_source; + delete m_target; + m_dialog = NULL; } void CreatorThread::OnExit() @@ -13,11 +24,13 @@ void CreatorThread::OnExit() wxThread::ExitCode CreatorThread::Entry() { int i; + wxFileName tmpdir(*m_target); + tmpdir.AppendDir(wxT(".new")); + tmpdir.Mkdir(0755, wxPATH_MKDIR_FULL); for (i = 0; i<=100; i++) { wxMutexGuiEnter(); m_dialog->SetProgress(i); wxMutexGuiLeave(); - wxMilliSleep(100); } return NULL; diff --git a/creator_thread.h b/creator_thread.h index 82b218b..aecb228 100644 --- a/creator_thread.h +++ b/creator_thread.h @@ -1,18 +1,22 @@ #ifndef CREATOR_THREAD_H #define CREATOR_THREAD_H +#include <wx/filename.h> #include <wx/thread.h> #include "dialog.h" class CreatorThread : public wxThread { public: - CreatorThread(Dialog *d); + CreatorThread(Dialog *d, const wxString &iso, const wxString &target); + ~CreatorThread(); virtual void *Entry(); virtual void OnExit(); protected: Dialog *m_dialog; + wxFileName *m_source; + wxFileName *m_target; }; #endif @@ -32,7 +32,7 @@ void Dialog::RefreshDrives(void) #else m_target->Clear(); - m_target->Append(wxT("~/tmp/alpine")); + m_target->Append(wxT("/tmp/alpine")); #endif if (!m_target->IsEmpty()) m_target->SetSelection(0); @@ -46,7 +46,10 @@ void Dialog::OnRefreshDrives(wxCommandEvent &event) void Dialog::OnStartButton(wxCommandEvent &event) { - CreatorThread *thread = new CreatorThread(this); + wxString isopath(m_iso_picker->GetPath()); + wxString target(m_target->GetString(m_target->GetSelection())); + + CreatorThread *thread = new CreatorThread(this, isopath, target); if (thread->Create() == wxTHREAD_NO_ERROR) { m_start_button->Disable(); m_target->Disable(); |