About dialog.
This commit is contained in:
parent
8d7033efbb
commit
2f6f458fe0
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
|
||||||
|
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
|
||||||
|
* Ryan Leavengood, leavengood@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <AboutWindow.h>
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <Font.h>
|
||||||
|
#include <String.h>
|
||||||
|
#include <TextView.h>
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::AboutWindow(const char* appName, const char** holders,
|
||||||
|
const char** authors, const char* extraInfo)
|
||||||
|
{
|
||||||
|
fAppName = new BString(appName);
|
||||||
|
|
||||||
|
// Build the text to display
|
||||||
|
int32 i;
|
||||||
|
BString text(appName);
|
||||||
|
text << "\n\n";
|
||||||
|
for (i = 0; holders[i]; i++)
|
||||||
|
text << "Copyright " B_UTF8_COPYRIGHT " " << holders[i] << "\n";
|
||||||
|
text << "\nWritten by:\n";
|
||||||
|
for (int32 i = 0; authors[i]; i++)
|
||||||
|
text << " " << authors[i] << "\n";
|
||||||
|
|
||||||
|
// The extra information is optional
|
||||||
|
if (extraInfo != NULL)
|
||||||
|
text << "\n" << extraInfo << "\n";
|
||||||
|
|
||||||
|
fText = new BString(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::~AboutWindow()
|
||||||
|
{
|
||||||
|
delete fText;
|
||||||
|
delete fAppName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AboutWindow::Show()
|
||||||
|
{
|
||||||
|
BAlert* alert = new BAlert("About" B_UTF8_ELLIPSIS, fText->String(), "Close");
|
||||||
|
BTextView* view = alert->TextView();
|
||||||
|
BFont font;
|
||||||
|
view->SetStylable(true);
|
||||||
|
view->GetFont(&font);
|
||||||
|
font.SetFace(B_BOLD_FACE);
|
||||||
|
font.SetSize(font.Size() * 1.7f);
|
||||||
|
view->SetFontAndColor(0, fAppName->Length(), &font);
|
||||||
|
alert->Go();
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
|
||||||
|
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _ABOUT_WINDOW_H
|
||||||
|
#define _ABOUT_WINDOW_H
|
||||||
|
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
class AboutWindow {
|
||||||
|
public:
|
||||||
|
AboutWindow(const char* appName, const char** holders,
|
||||||
|
const char** authors, const char* extraInfo = NULL);
|
||||||
|
virtual ~AboutWindow();
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString* fAppName;
|
||||||
|
BString* fText;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _ABOUT_WINDOW_H
|
|
@ -10,7 +10,13 @@ SubDirSysHdrs [ FDirName $(OPENSSL_INCLUDE_DIR) ] ;
|
||||||
SEARCH_SOURCE += [ FDirName $(TOP) application preferences ] ;
|
SEARCH_SOURCE += [ FDirName $(TOP) application preferences ] ;
|
||||||
SEARCH_SOURCE += [ FDirName $(TOP) application views ] ;
|
SEARCH_SOURCE += [ FDirName $(TOP) application views ] ;
|
||||||
|
|
||||||
|
# SVN revision
|
||||||
|
local svnRevisionFile = [ FGristFiles svn_revision ] ;
|
||||||
|
MakeLocate $(svnRevisionFile) : $(LOCATE_TARGET) ;
|
||||||
|
CreateSVNRevisionFile $(svnRevisionFile) ;
|
||||||
|
|
||||||
Application caya :
|
Application caya :
|
||||||
|
AboutWindow.cpp
|
||||||
Account.cpp
|
Account.cpp
|
||||||
AccountManager.cpp
|
AccountManager.cpp
|
||||||
CayaUtils.cpp
|
CayaUtils.cpp
|
||||||
|
@ -27,6 +33,7 @@ Application caya :
|
||||||
Server.cpp
|
Server.cpp
|
||||||
TheApp.cpp
|
TheApp.cpp
|
||||||
WindowsManager.cpp
|
WindowsManager.cpp
|
||||||
|
svn_revision.cpp
|
||||||
|
|
||||||
# preferences
|
# preferences
|
||||||
AccountDialog.cpp
|
AccountDialog.cpp
|
||||||
|
|
|
@ -85,10 +85,10 @@ MainWindow::MainWindow() :
|
||||||
|
|
||||||
// Wrench menu
|
// Wrench menu
|
||||||
BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
|
BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
|
||||||
(void)wrenchMenu->AddItem(new BMenuItem("About Caya...",
|
(void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(B_ABOUT_REQUESTED)));
|
new BMessage(B_ABOUT_REQUESTED)));
|
||||||
(void)wrenchMenu->AddItem(new BSeparatorItem());
|
(void)wrenchMenu->AddItem(new BSeparatorItem());
|
||||||
(void)wrenchMenu->AddItem(new BMenuItem("Preferences...",
|
(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(kPreferences)));
|
new BMessage(kPreferences)));
|
||||||
(void)wrenchMenu->AddItem(new BSeparatorItem());
|
(void)wrenchMenu->AddItem(new BSeparatorItem());
|
||||||
(void)wrenchMenu->AddItem(new BMenuItem("Quit",
|
(void)wrenchMenu->AddItem(new BMenuItem("Quit",
|
||||||
|
@ -201,9 +201,11 @@ MainWindow::MessageReceived(BMessage* message)
|
||||||
case IM_ERROR:
|
case IM_ERROR:
|
||||||
ImError(message);
|
ImError(message);
|
||||||
break;
|
break;
|
||||||
|
case B_ABOUT_REQUESTED:
|
||||||
|
be_app->PostMessage(message);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2009, Andrea Anzani. All rights reserved.
|
* Copyright 2009-2010, Andrea Anzani. All rights reserved.
|
||||||
|
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
|
#include "AboutWindow.h"
|
||||||
#include "Caya.h"
|
#include "Caya.h"
|
||||||
#include "TheApp.h"
|
#include "TheApp.h"
|
||||||
#include "FilePanel.h"
|
#include "FilePanel.h"
|
||||||
|
@ -20,6 +22,8 @@
|
||||||
#include "Emoticor.h"
|
#include "Emoticor.h"
|
||||||
#include "ProtocolManager.h"
|
#include "ProtocolManager.h"
|
||||||
|
|
||||||
|
#include "svn_revision.h"
|
||||||
|
|
||||||
|
|
||||||
TheApp::TheApp()
|
TheApp::TheApp()
|
||||||
: BApplication(CAYA_SIGNATURE),
|
: BApplication(CAYA_SIGNATURE),
|
||||||
|
@ -71,6 +75,32 @@ TheApp::ReadyToRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TheApp::AboutRequested()
|
||||||
|
{
|
||||||
|
const char* holders[] = {
|
||||||
|
"2009-2010 Andrea Anzani",
|
||||||
|
"2009-2010 Pier Luigi Fiorini",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* authors[] = {
|
||||||
|
"Andrea Anzani",
|
||||||
|
"Pier Luigi Fiorini",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
BString extraInfo;
|
||||||
|
extraInfo << "SVN Revision: " << kSVNRevision << "\n";
|
||||||
|
extraInfo << "Built: " << BUILD_DATE;
|
||||||
|
|
||||||
|
AboutWindow* about = new AboutWindow("Caya", holders,
|
||||||
|
authors, extraInfo.String());
|
||||||
|
about->Show();
|
||||||
|
delete about;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindow*
|
MainWindow*
|
||||||
TheApp::GetMainWindow() const
|
TheApp::GetMainWindow() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "svn_revision.h"
|
||||||
|
|
||||||
|
const int32 kSVNRevision =
|
||||||
|
#include "svn_revision"
|
||||||
|
;
|
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010, Pier Luigi Fiorini. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SVN_REVISION_H
|
||||||
|
#define _SVN_REVISION_H
|
||||||
|
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
extern const int32 kSVNRevision;
|
||||||
|
|
||||||
|
#endif // _SVN_REVISION_H
|
Ŝarĝante…
Reference in New Issue