Skip to content

Commit 94138fc

Browse files
committed
initial import
0 parents  commit 94138fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5044
-0
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Christian Beier <[email protected]>

COPYING

+340
Large diffs are not rendered by default.

Makefile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
##
3+
WXCONFIG=wx-config
4+
5+
CFLAGS=-O2 -g
6+
CXXFLAGS = $(shell $(WXCONFIG) --cxxflags) -Wall -O -g
7+
LIBS = $(shell $(WXCONFIG) --libs net,adv)
8+
OUTFILE=sdwrap
9+
#
10+
#
11+
#
12+
13+
14+
OBJS=SdwrapApp.o wxServDisc/wxServDisc.o wxServDisc/1035.o wxServDisc/mdnsd.o gui/FrameMain.o gui/MyFrameMain.o gui/DialogSettings.o gui/MyDialogSettings.o
15+
16+
#
17+
#
18+
19+
.PHONY : clean depend
20+
21+
all: $(OUTFILE)
22+
23+
$(OUTFILE): $(OBJS)
24+
$(CXX) $(OBJS) -o $(OUTFILE) $(LIBS)
25+
26+
27+
# clean me up, scotty
28+
clean:
29+
$(RM) $(OUTFILE) $(OBJS) *~ gui/*~ wxServDisc/*~
30+
31+
32+
# you can depend on me
33+
depend:
34+
makedepend -Y -- *.cpp gui/*.cpp wxServDisc/*.cpp wxServDisc/*.c
35+
36+
37+
38+
# DO NOT DELETE
39+
40+
SdwrapApp.o: SdwrapApp.h gui/MyFrameMain.h gui/FrameMain.h
41+
SdwrapApp.o: gui/bitmapFromMem.h gui/res/icon.xpm wxServDisc/wxServDisc.h
42+
SdwrapApp.o: wxServDisc/1035.h
43+
gui/DialogSettings.o: gui/DialogSettings.h
44+
gui/FrameMain.o: gui/FrameMain.h gui/bitmapFromMem.h gui/res/icon.xpm
45+
gui/MyDialogSettings.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
46+
gui/MyFrameMain.o: gui/res/about.png.h gui/MyFrameMain.h gui/FrameMain.h
47+
gui/MyFrameMain.o: gui/bitmapFromMem.h gui/res/icon.xpm
48+
gui/MyFrameMain.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
49+
gui/MyFrameMain.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
50+
gui/MyFrameMain.o: SdwrapApp.h
51+
wxServDisc/wxServDisc.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
52+
wxServDisc/wxServDisc.o: wxServDisc/mdnsd.h
53+
wxServDisc/1035.o: wxServDisc/1035.h
54+
wxServDisc/mdnsd.o: wxServDisc/mdnsd.h wxServDisc/1035.h

Makefile.mac

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#
2+
#
3+
WXCONFIG=wx-config
4+
5+
CC=gcc -arch i386 -arch ppc
6+
CFLAGS=-O2 -g
7+
8+
CXX=g++ -arch i386 -arch ppc
9+
CXXFLAGS = $(shell $(WXCONFIG) --cxxflags) -Wall -O -g
10+
11+
LIBS = $(shell $(WXCONFIG) --libs net,adv)
12+
OUTFILE=sdwrap
13+
14+
BUNDLE=SDWrap.app/Contents
15+
VER=0.2
16+
17+
#
18+
#
19+
20+
OBJS=SdwrapApp.o wxServDisc/wxServDisc.o wxServDisc/1035.o wxServDisc/mdnsd.o gui/FrameMain.o gui/MyFrameMain.o gui/DialogSettings.o gui/MyDialogSettings.o
21+
22+
23+
24+
####################
25+
26+
27+
.PHONY : clean depend
28+
29+
all: bundle
30+
31+
$(OUTFILE): $(OBJS)
32+
$(CXX) $(OBJS) -o $(OUTFILE) $(LIBS)
33+
34+
bundle: $(OUTFILE)
35+
strip $(OUTFILE)
36+
mkdir -p $(BUNDLE)/MacOS
37+
mkdir -p $(BUNDLE)/Resources
38+
echo -n "APPL????" > $(BUNDLE)/PkgInfo
39+
cp $(OUTFILE) $(BUNDLE)/MacOS/
40+
cp gui/res/icon.icns $(BUNDLE)/Resources
41+
echo \
42+
"<?xml version="1.0" encoding="UTF-8"?>\
43+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\
44+
<plist version="1.0">\
45+
<dict>\
46+
<key>CFBundleDevelopmentRegion</key>\
47+
<string>English</string>\
48+
<key>CFBundleExecutable</key>\
49+
<string>$(OUTFILE)</string>\
50+
<key>CFBundleIconFile</key>\
51+
<string>icon.icns</string>\
52+
<key>CFBundleGetInfoString</key>\
53+
<string>SDWrap $(VER), © Christian Beier ([email protected]), 2008 </string>\
54+
<key>CFBundleName</key> \
55+
<string>SDWrap</string> \
56+
<key>CFBundlePackageType</key> \
57+
<string>APPL</string> \
58+
<key>CFBundleShortVersionString</key> \
59+
<string>$(VER)</string> \
60+
<key>CFBundleVersion</key> \
61+
<string>$(VER)</string> \
62+
</dict> \
63+
</plist> \
64+
" > $(BUNDLE)/Info.plist
65+
66+
67+
68+
# clean me up, scotty
69+
clean:
70+
$(RM) $(OUTFILE) $(OBJS) *~ gui/*~
71+
72+
73+
# you can depend on me
74+
depend:
75+
makedepend -Y -- *.cpp gui/*.cpp wxServDisc/*.cpp wxServDisc/*.c
76+
77+
78+
79+
80+
# deps
81+
82+
# DO NOT DELETE
83+
84+
SdwrapApp.o: SdwrapApp.h gui/MyFrameMain.h gui/FrameMain.h
85+
SdwrapApp.o: gui/bitmapFromMem.h gui/res/icon.xpm wxServDisc/wxServDisc.h
86+
SdwrapApp.o: wxServDisc/1035.h
87+
gui/DialogSettings.o: gui/DialogSettings.h
88+
gui/FrameMain.o: gui/FrameMain.h gui/bitmapFromMem.h gui/res/icon.xpm
89+
gui/MyDialogSettings.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
90+
gui/MyFrameMain.o: gui/res/about.png.h gui/MyFrameMain.h gui/FrameMain.h
91+
gui/MyFrameMain.o: gui/bitmapFromMem.h gui/res/icon.xpm
92+
gui/MyFrameMain.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
93+
gui/MyFrameMain.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
94+
gui/MyFrameMain.o: SdwrapApp.h
95+
wxServDisc/wxServDisc.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
96+
wxServDisc/wxServDisc.o: wxServDisc/mdnsd.h
97+
wxServDisc/1035.o: wxServDisc/1035.h
98+
wxServDisc/mdnsd.o: wxServDisc/mdnsd.h wxServDisc/1035.h
99+
100+
101+
102+

Makefile.mgw

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#
2+
#
3+
WXCONFIG=/usr/local/share/win32-cross-env/bin/wx-config
4+
5+
CC=i586-mingw32msvc-gcc
6+
CXX=i586-mingw32msvc-g++
7+
CFLAGS = $(shell $(WXCONFIG) --cflags)
8+
CXXFLAGS = $(shell $(WXCONFIG) --cxxflags)
9+
WINDRES = $(shell $(WXCONFIG) --rescomp)
10+
LIBS = -lws2_32 $(shell $(WXCONFIG) --libs std)
11+
OUTFILE=sdwrap.exe
12+
13+
14+
OBJS=SdwrapApp.o wxServDisc/wxServDisc.o wxServDisc/1035.o wxServDisc/mdnsd.o gui/FrameMain.o gui/MyFrameMain.o gui/winres.o gui/DialogSettings.o gui/MyDialogSettings.o
15+
16+
17+
#
18+
#
19+
20+
#########################
21+
22+
.PHONY : clean depend
23+
24+
25+
all: $(OUTFILE)
26+
27+
$(OUTFILE): $(OBJS)
28+
$(CXX) $(OBJS) -o $(OUTFILE) $(LIBS)
29+
30+
31+
gui/winres.o: gui/winres.rc
32+
cd gui && $(WINDRES) winres.rc winres.o
33+
34+
35+
# clean me up, scotty
36+
clean:
37+
$(RM) $(OUTFILE) $(OBJS) *~ gui/*~
38+
39+
# you can depend on me
40+
depend:
41+
makedepend -fMakefile.mgw -Y -- *.cpp gui/*.cpp wxServDisc/*.cpp wxServDisc/*.c
42+
43+
44+
# deps
45+
46+
# DO NOT DELETE
47+
48+
SdwrapApp.o: SdwrapApp.h gui/MyFrameMain.h gui/FrameMain.h
49+
SdwrapApp.o: gui/bitmapFromMem.h gui/res/icon.xpm wxServDisc/wxServDisc.h
50+
SdwrapApp.o: wxServDisc/1035.h
51+
gui/DialogSettings.o: gui/DialogSettings.h
52+
gui/FrameMain.o: gui/FrameMain.h gui/bitmapFromMem.h gui/res/icon.xpm
53+
gui/MyDialogSettings.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
54+
gui/MyFrameMain.o: gui/res/about.png.h gui/MyFrameMain.h gui/FrameMain.h
55+
gui/MyFrameMain.o: gui/bitmapFromMem.h gui/res/icon.xpm
56+
gui/MyFrameMain.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
57+
gui/MyFrameMain.o: gui/MyDialogSettings.h gui/DialogSettings.h config.h
58+
gui/MyFrameMain.o: SdwrapApp.h
59+
wxServDisc/wxServDisc.o: wxServDisc/wxServDisc.h wxServDisc/1035.h
60+
wxServDisc/wxServDisc.o: wxServDisc/mdnsd.h
61+
wxServDisc/1035.o: wxServDisc/1035.h
62+
wxServDisc/mdnsd.o: wxServDisc/mdnsd.h wxServDisc/1035.h

README.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
SDWrap - a Zeroconf service discovery wrapper using wxServDisc
3+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
5+
Quite simple wrapper app to execute some command with Zeroconf supplied
6+
addresses and ports. Uses wxWidgets and wxServDisc for service discovery.
7+
8+
9+
directory layout:
10+
wxServDisc: Zeroconf module
11+
gui: well, the gui (made with wxglade)
12+
13+
14+
prerequisites:
15+
wxWidgets 2.8

SdwrapApp.cpp

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
SdwrapApp.cpp: main app implementation
3+
4+
This file is part of SDWrap, a crossplatform wxWidgets
5+
Zeroconf service discovery wrapper.
6+
7+
Copyright (C) 2008 Christian Beier <[email protected]>
8+
9+
SDWrap is free software; you can redistribute it and/or modify
10+
it under the terms of the GNU General Public License as published by
11+
the Free Software Foundation; either version 2 of the License, or
12+
(at your option) any later version.
13+
14+
SDWrap is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU General Public License for more details.
18+
19+
You should have received a copy of the GNU General Public License
20+
along with this program; if not, write to the Free Software
21+
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22+
*/
23+
24+
#include <iostream>
25+
26+
#include "SdwrapApp.h"
27+
#include "gui/MyFrameMain.h"
28+
29+
30+
31+
using namespace std;
32+
33+
34+
35+
// this also sets up main()
36+
IMPLEMENT_APP(SdwrapApp);
37+
38+
39+
40+
41+
bool SdwrapApp::OnInit()
42+
{
43+
locale = 0;
44+
45+
setLocale(wxLANGUAGE_DEFAULT);
46+
47+
// wxConfig:
48+
// application and vendor name are used by wxConfig to construct the name
49+
// of the config file/registry key and must be set before the first call
50+
// to Get() if you want to override the default values (the application
51+
// name is the name of the executable and the vendor name is the same)
52+
//SetVendorName(_T("dontmind"));
53+
54+
// greetings to anyone who made it...
55+
cout << "\n::: this is sdwrap :::\n\n";
56+
cout << COPYRIGHT << ".\n";
57+
cout << "sdwrap is free software, licensed unter the GPL.\n\n";
58+
59+
// wx stuff
60+
wxInitAllImageHandlers();
61+
MyFrameMain* frame_main = new MyFrameMain(NULL, wxID_ANY, wxEmptyString);
62+
SetTopWindow(frame_main);
63+
frame_main->Show();
64+
65+
return true;
66+
}
67+
68+
69+
int SdwrapApp::OnExit()
70+
{
71+
// clean up: Set() returns the active config object as Get() does, but unlike
72+
// Get() it doesn't try to create one if there is none (definitely not what
73+
// we want here!)
74+
delete wxConfigBase::Set((wxConfigBase *) NULL);
75+
76+
return 0;
77+
}
78+
79+
80+
81+
82+
bool SdwrapApp::setLocale(int language)
83+
{
84+
delete locale;
85+
86+
locale = new wxLocale;
87+
88+
// don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
89+
// false just because it failed to load wxstd catalog
90+
if(! locale->Init(language, wxLOCALE_CONV_ENCODING) )
91+
{
92+
wxLogError(_("This language is not supported by the system."));
93+
return false;
94+
}
95+
locale = new wxLocale;
96+
97+
// don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
98+
// false just because it failed to load wxstd catalog
99+
if(! locale->Init(language, wxLOCALE_CONV_ENCODING) )
100+
{
101+
wxLogError(_("This language is not supported by the system."));
102+
return false;
103+
}
104+
105+
// normally this wouldn't be necessary as the catalog files would be found
106+
// in the default locations, but when the program is not installed the
107+
// catalogs are in the build directory where we wouldn't find them by
108+
// default
109+
wxLocale::AddCatalogLookupPathPrefix(wxT("."));
110+
111+
// Initialize the catalogs we'll be using
112+
locale->AddCatalog(wxT("sdwrap"));
113+
114+
return true;
115+
}

0 commit comments

Comments
 (0)