1
#include "qmakesettingstab.h"
4
#include <wx/filename.h>
7
QmakeSettingsTab::QmakeSettingsTab( wxWindow* parent, const wxString &name )
8
: QmakeSettingsTabBase( parent )
14
void QmakeSettingsTab::Load(QmakeConf* conf)
16
m_filePickerQmakeExec->SetPath(conf->Read(m_name + wxT("/qmake")));
17
m_comboBoxQmakespec->Append( GetSpecList(conf->Read(m_name + wxT("/qmake")) ) );
18
m_comboBoxQmakespec->SetValue(conf->Read(m_name + wxT("/qmakespec")));
19
m_textCtrlQtdir->SetValue(conf->Read(m_name + wxT("/qtdir")));
22
void QmakeSettingsTab::Save(QmakeConf* conf)
24
conf->Write(m_name + wxT("/qmake"), m_filePickerQmakeExec->GetPath());
25
conf->Write(m_name + wxT("/qmakespec"), m_comboBoxQmakespec->GetValue());
26
conf->Write(m_name + wxT("/qtdir"), m_textCtrlQtdir->GetValue());
30
wxArrayString QmakeSettingsTab::GetSpecList(const wxString& qmakePath)
34
if ( qmakePath.IsEmpty() == false && wxFileName::FileExists(qmakePath) ) {
35
wxArrayString cmdOutput;
37
ProcUtils::SafeExecuteCommand(wxString::Format(wxT("\"%s\" -query QT_INSTALL_DATA"), qmakePath.c_str()), cmdOutput);
38
if ( cmdOutput.IsEmpty() == false ) {
39
wxFileName installData ( cmdOutput.Item(0).Trim().Trim(false), wxEmptyString );
42
installData.AppendDir(wxT("mkspecs"));
43
wxDir::GetAllFiles(installData.GetFullPath(), &files, wxT("*.conf"), wxDIR_DEFAULT);
45
for ( size_t i=0; i<files.GetCount(); i++) {
47
wxFileName fn(files.Item(i));
48
if ( specs.Index(fn.GetDirs().Last()) == wxNOT_FOUND ) {
49
specs.Add( fn.GetDirs().Last() );
57
void QmakeSettingsTab::OnFileSelected(wxFileDirPickerEvent& event)
59
m_comboBoxQmakespec->Clear();
60
m_comboBoxQmakespec->Append( GetSpecList(m_filePickerQmakeExec->GetPath()) );