added name dialog code, moved 'using namespace std;' out of headers and into source files

This commit is contained in:
jp9000 2013-12-29 04:40:53 -07:00
parent 6526c47907
commit e5ef03954e
15 changed files with 105 additions and 22 deletions

View File

@ -43,6 +43,7 @@ endif()
add_executable(obs
window-basic-main.cpp
window-basic-settings.cpp
window-namedialog.cpp
settings-basic.cpp
settings-basic-general.cpp
settings-basic-video.cpp

View File

@ -15,6 +15,7 @@ obs_PROGRAMS = obs
obs_LDADD = $(top_srcdir)/libobs/libobs.la
obs_SOURCES = window-basic-main.cpp \
window-basic-settings.cpp \
window-namedialog.cpp \
settings-basic.cpp \
settings-basic-general.cpp \
settings-basic-video.cpp \

View File

@ -17,6 +17,7 @@
#include <sstream>
#include "platform.hpp"
using namespace std;
#include <unistd.h>

View File

@ -17,6 +17,7 @@
#include <sstream>
#include "platform.hpp"
using namespace std;
#include <util/platform.h>

View File

@ -17,6 +17,7 @@
#include <sstream>
#include "platform.hpp"
using namespace std;
bool GetDataFilePath(const char *data, string &output)
{

View File

@ -21,7 +21,6 @@
#include <string>
#include <vector>
using namespace std;
struct MonitorInfo {
int32_t x, y;
@ -32,5 +31,5 @@ struct MonitorInfo {
};
/* Gets the path of obs-studio specific data files (such as locale) */
bool GetDataFilePath(const char *data, string &path);
void GetMonitors(vector<MonitorInfo> &monitors);
bool GetDataFilePath(const char *data, std::string &path);
void GetMonitors(std::vector<MonitorInfo> &monitors);

View File

@ -22,6 +22,7 @@
#include "window-basic-settings.hpp"
#include "wx-wrappers.hpp"
#include "platform.hpp"
using namespace std;
class BasicGenData : public BasicSettingsData {
ConfigFile localeIni;

View File

@ -21,9 +21,6 @@
#include <obs.hpp>
#include <vector>
using namespace std;
class OBSBasic : public OBSBasicBase {
void SceneAdded(obs_source_t scene);
void SceneRemoved(obs_source_t scene);

View File

@ -17,6 +17,7 @@
#include <wx/msgdlg.h>
#include "window-basic-settings.hpp"
using namespace std;
OBSBasicSettings::OBSBasicSettings(wxWindow *parent)
: OBSBasicSettingsBase(parent)

View File

@ -21,11 +21,10 @@
#include "settings-basic.hpp"
#include <memory>
using namespace std;
class OBSBasicSettings : public OBSBasicSettingsBase {
protected:
unique_ptr<BasicSettingsData> settings;
std::unique_ptr<BasicSettingsData> settings;
virtual void PageChanged(wxListbookEvent &event);
virtual void PageChanging(wxListbookEvent &event);

48
obs/window-namedialog.cpp Normal file
View File

@ -0,0 +1,48 @@
/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#include "window-namedialog.hpp"
using namespace std;
void NameDialog::OnClose(wxCommandEvent &event)
{
EndModal(wxID_CANCEL);
}
void NameDialog::OKPressed(wxCommandEvent &event)
{
EndModal(wxID_OK);
}
void NameDialog::CancelPressed(wxCommandEvent &event)
{
EndModal(wxID_CANCEL);
}
int NameDialog::AskForName(wxWindow *parent, const char *title,
const char *text, string &str)
{
NameDialog *dialog = new NameDialog(parent);
dialog->SetTitle(wxString(title, wxConvUTF8));
dialog->questionText->SetLabel(wxString(text, wxConvUTF8));
int ret = dialog->ShowModal();
str = dialog->nameEdit->GetValue().ToUTF8().data();
return ret;
}

38
obs/window-namedialog.hpp Normal file
View File

@ -0,0 +1,38 @@
/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#pragma once
#include "forms/OBSWindows.h"
#include <vector>
class NameDialog : public NameDialogBase {
protected:
virtual void OnClose(wxCommandEvent &event);
virtual void OKPressed(wxCommandEvent &event);
virtual void CancelPressed(wxCommandEvent &event);
public:
inline NameDialog(wxWindow *parent)
: NameDialogBase(parent)
{
}
static int AskForName(wxWindow *parent, const char *title,
const char *text, std::string &str);
};

View File

@ -92,21 +92,8 @@ static void CreateOBS(HWND hwnd)
static void AddTestItems(obs_scene_t scene, obs_source_t source)
{
obs_sceneitem_t item = NULL;
struct vec2 v2;
item = obs_scene_add(scene, source);
vec2_set(&v2, 100.0f, 200.0f);
obs_sceneitem_setpos(item, &v2);
obs_sceneitem_setrot(item, 10.0f);
vec2_set(&v2, 20.0f, 2.0f);
obs_sceneitem_setscale(item, &v2);
item = obs_scene_add(scene, source);
vec2_set(&v2, 200.0f, 100.0f);
obs_sceneitem_setpos(item, &v2);
obs_sceneitem_setrot(item, -45.0f);
vec2_set(&v2, 5.0f, 7.0f);
obs_sceneitem_setscale(item, &v2);
}
static HWND CreateTestWindow(HINSTANCE instance)
@ -175,7 +162,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine,
/* ------------------------------------------------------ */
/* set the scene as the primary draw source and go */
obs_set_output_source(0, obs_scene_getsource(scene));
obs_set_output_source(0, source);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {

View File

@ -179,6 +179,7 @@
<ClCompile Include="..\..\..\obs\settings-basic.cpp" />
<ClCompile Include="..\..\..\obs\window-basic-main.cpp" />
<ClCompile Include="..\..\..\obs\window-basic-settings.cpp" />
<ClCompile Include="..\..\..\obs\window-namedialog.cpp" />
<ClCompile Include="..\..\..\obs\wx-subclass.cpp" />
<ClCompile Include="..\..\..\obs\wx-wrappers.cpp" />
</ItemGroup>
@ -190,6 +191,7 @@
<ClInclude Include="..\..\..\obs\settings.hpp" />
<ClInclude Include="..\..\..\obs\window-basic-main.hpp" />
<ClInclude Include="..\..\..\obs\window-basic-settings.hpp" />
<ClInclude Include="..\..\..\obs\window-namedialog.hpp" />
<ClInclude Include="..\..\..\obs\wx-subclass.hpp" />
<ClInclude Include="..\..\..\obs\wx-wrappers.hpp" />
</ItemGroup>

View File

@ -48,6 +48,9 @@
<ClCompile Include="..\..\..\obs\window-basic-settings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\obs\window-namedialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\obs\obs-app.hpp">
@ -77,5 +80,8 @@
<ClInclude Include="..\..\..\obs\window-basic-settings.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\obs\window-namedialog.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>