Moved the BAboutWindow implementation to the shared source directory, which
despite being talked about repeatedly, does not currently exist. Adding this required adding some new Jam rules to deal with this shared source directory and headers. I had some fun figuring this out. Despite writing articles about Jam in the Haiku newsletter a few years ago I still find Jam to be a PITA at times. But my solution seems to work pretty well. Basically you just call the rule UseSharedSource and pass the name of the shared source file you want to use. This rule sets up the header directories and the right Jam variables for the source file. You then add the source file to the source list in the Application rule like any other source file. I also made the authors list sent to the about window constructor null terminated instead of passing the size of the array, as suggested by Hugo. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21391 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -249,3 +249,15 @@ actions CopySetHaikuRevision1
|
||||
$(2[1]) --data $(2[3]) $(1) &&
|
||||
$(2[2]) $(1) ${revision}
|
||||
}
|
||||
|
||||
rule UseSharedSource
|
||||
{
|
||||
UseSharedHeaders ;
|
||||
|
||||
for file in $(1) {
|
||||
local gristed_file = [ FGristFiles $(file) ] ;
|
||||
SEARCH on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
|
||||
LOCATE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
|
||||
SEARCH_SOURCE on $(gristed_file) = [ FDirName $(HAIKU_TOP) src shared ] ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,6 +338,11 @@ rule UseLegacyObjectHeaders
|
||||
SourceSysHdrs $(1) : [ FDirName $(HAIKU_TOP) headers legacy ] : $(2) ;
|
||||
}
|
||||
|
||||
rule UseSharedHeaders
|
||||
{
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers shared ] ;
|
||||
}
|
||||
|
||||
rule FStandardOSHeaders
|
||||
{
|
||||
local osIncludes = add-ons add-ons/file_system add-ons/graphics
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class BAboutWindow {
|
||||
public:
|
||||
BAboutWindow(char *appName, int32 firstCopyrightYear,
|
||||
int32 numAuthors, const char **authors, char *extraInfo = NULL);
|
||||
const char **authors, char *extraInfo = NULL);
|
||||
virtual ~BAboutWindow();
|
||||
|
||||
void Show();
|
||||
@@ -1,10 +1,13 @@
|
||||
SubDir HAIKU_TOP src apps showimage ;
|
||||
|
||||
UsePrivateHeaders tracker interface ;
|
||||
UsePrivateHeaders tracker ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
UseSharedSource AboutWindow.cpp ;
|
||||
|
||||
Application ShowImage :
|
||||
AboutWindow.cpp
|
||||
ShowImageApp.cpp
|
||||
ShowImageSettings.cpp
|
||||
ShowImageStatusView.cpp
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "AboutWindow.h" // Shared source
|
||||
#include "ShowImageApp.h"
|
||||
#include "ShowImageConstants.h"
|
||||
#include "ShowImageWindow.h"
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
#include <AboutWindow.h>
|
||||
#endif
|
||||
#include <Alert.h>
|
||||
#include <Clipboard.h>
|
||||
#include <FilePanel.h>
|
||||
@@ -47,20 +45,15 @@ ShowImageApp::~ShowImageApp()
|
||||
void
|
||||
ShowImageApp::AboutRequested()
|
||||
{
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
const char *authors[] = {
|
||||
"Fernando F. Oliveira",
|
||||
"Michael Wilber",
|
||||
"Michael Pfeiffer",
|
||||
"Ryan Leavengood"
|
||||
"Ryan Leavengood",
|
||||
NULL
|
||||
};
|
||||
BAboutWindow about("ShowImage", 2003, 4, authors);
|
||||
BAboutWindow about("ShowImage", 2003, authors);
|
||||
about.Show();
|
||||
#else
|
||||
BAlert* alert = new BAlert("About ShowImage",
|
||||
"Haiku ShowImage\n\nby Fernando F. Oliveira, Michael Wilber, Michael Pfeiffer and Ryan Leavengood", "OK");
|
||||
alert->Go();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) textview_support ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) layouter ] ;
|
||||
|
||||
MergeObject <libbe>interface_kit.o :
|
||||
AboutWindow.cpp
|
||||
AbstractLayoutItem.cpp
|
||||
Alert.cpp
|
||||
Alignment.cpp
|
||||
|
||||
@@ -6,17 +6,19 @@
|
||||
* Ryan Leavengood, leavengood@gmail.com
|
||||
*/
|
||||
|
||||
#include <AboutWindow.h>
|
||||
#include "AboutWindow.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Font.h>
|
||||
#include <String.h>
|
||||
#include <TextView.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
BAboutWindow::BAboutWindow(char *appName, int32 firstCopyrightYear,
|
||||
int32 numAuthors, const char **authors, char *extraInfo)
|
||||
const char **authors, char *extraInfo)
|
||||
{
|
||||
fAppName = new BString(appName);
|
||||
fText = new BString();
|
||||
@@ -32,12 +34,15 @@ BAboutWindow::BAboutWindow(char *appName, int32 firstCopyrightYear,
|
||||
text << "\n\nCopyright " B_UTF8_COPYRIGHT " ";
|
||||
text << firstCopyrightYear << "-" << currentYear << " Haiku, Inc.\n\n";
|
||||
text << "Written by:\n";
|
||||
for (int32 i = 0; i < numAuthors; i++) {
|
||||
for (int32 i = 0; authors[i]; i++) {
|
||||
text << " " << authors[i] << "\n";
|
||||
}
|
||||
|
||||
// The extra information is optional
|
||||
if (extraInfo != NULL) {
|
||||
text << "\n" << extraInfo << "\n";
|
||||
}
|
||||
|
||||
fText->Adopt(text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user