Adds splash screen.

cusax-fix
Damian Minkov 12 years ago
parent 64b1d76103
commit 52c87eaf68

@ -859,6 +859,12 @@
<isset property="is.running.macos"/>
</condition>
<condition property="jvmarg.splash"
value="-splash:resources/install/resources/splash.gif"
else="">
<isset property="splashscreen.enable"/>
</condition>
<condition property="jvm.maxheapsize"
value="-Xmx256m"
else="" >
@ -928,7 +934,7 @@
detection because -server uses much more memory for 32-bit OS
(64-bit always used -server) -->
<jvmarg line="${profiler.args} ${jvmarg.line}
-client ${jvm.maxheapsize}"/>
-client ${jvm.maxheapsize} ${jvmarg.splash}"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true" />
</java>
@ -1026,6 +1032,7 @@
<target name="bundles"
depends="bundle-sc-launcher,bundle-util,bundle-service-dns,
bundle-impl-dns,bundle-dns-config,
bundle-splash-screen,
bundle-configuration,bundle-configuration-slick,
bundle-history,bundle-history-slick,bundle-messagehistory, bundle-msghistory-slick,
bundle-callhistory, bundle-callhistory-slick, bundle-popupmessagehandler-slick,
@ -1090,6 +1097,16 @@
</jar>
</target>
<!--BUNDLE-SPLASH-SCREEN-->
<target name="bundle-splash-screen">
<jar compress="false"
destfile="${bundles.dest}/splash-screen.jar"
manifest="${src}/net/java/sip/communicator/impl/splashscreen/splashscreen.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/splashscreen"
prefix="net/java/sip/communicator/impl/splashscreen"/>
</jar>
</target>
<!--BUNDLE-HISTORY-->
<target name="bundle-history">
<jar compress="false" destfile="${bundles.dest}/history.jar"

@ -26,6 +26,9 @@ org.osgi.framework.system.packages.extra= \
sun.security.action; \
sun.security.pkcs11
felix.auto.start.5=reference:file:sc-bundles/splash-screen.jar
felix.auto.start.10= \
reference:file:lib/bundle/org.apache.felix.bundlerepository-1.6.4.jar \
reference:file:sc-bundles/bouncycastle.jar \

@ -41,6 +41,7 @@ plugin.simpleaccreg.PROTOCOL_ORDER=SIP|Jabber|Facebook|Google Talk
# Bundles marked as "system" in the plugin editor
net.java.sip.communicator.plugin.pluginmanager.SYSTEM_BUNDLES=\
net.java.sip.communicator.impl.splashscreen, \
net.java.sip.communicator.plugin.aimaccregwizz,\
net.java.sip.communicator.plugin.advancedconfig,\
net.java.sip.communicator.argdelegation,\

@ -432,6 +432,10 @@
</fileset>
</copy>
<antcall target="enable-splash">
<param name="target.dir" value="${light.dir}"/>
</antcall>
<mkdir dir="${light.dir}/lib" />
<copy todir="${light.dir}/lib" overwrite="true">
<fileset dir="${sc.basedir}/lib">
@ -1122,6 +1126,7 @@
stubfile="${macosx.app.dir}/tmp/${macosx.stub.filename}"
extraclasspath="/System/Library/Java,$JAVAROOT"
workingdirectory="$APP_PACKAGE/Contents/Resources/Java"
splashfile="$JAVAROOT/splash.gif"
vmoptions="-agentlib:AEGetURLEventHandlerAgent ${jvmarg}">
<javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
@ -1250,6 +1255,11 @@
<antcall target="-macosx-include-jre"/>
<antcall target="enable-splash">
<param name="target.dir"
value="${macosx.app.dir}/${application.name}.app/Contents/Resources/Java"/>
</antcall>
<!-- Delete the tmp if it exists -->
<delete dir="${macosx.app.dir}/tmp"
quiet="yes" failonerror="false"/>
@ -1733,6 +1743,12 @@
</target>
<!-- Copies the splash to the ${target.dir} folder -->
<target name="enable-splash"
if="splashscreen.enable">
<copy file="${inst.resrc}/resources/splash.gif" todir="${target.dir}"/>
</target>
<target name="-delete-oldest-delta-data">
<resourcecount property="build.history.current.size">
<dirset dir="${delta.history.location}">
@ -2164,7 +2180,11 @@
value="${package.name}"/>
</target>
<!-- change the package.install file if used from deb target -->
<target name="-deb-package.install-file-update"
<target name="-deb-package.install-file-update">
<antcall target="-deb-package.install-file-update-non-src"/>
<antcall target="-deb-package.install-file-update-src"/>
</target>
<target name="-deb-package.install-file-update-non-src"
unless="debianize.src.pkg">
<concat destfile="${debianize.dir}/${package.name}.install"
append="true"
@ -2174,7 +2194,21 @@
append="true"
eol="lf"
fixlastline="true">lib/bundle/commons-logging.jar usr/share/${package.name}/lib/bundle/&#010;lib/bundle/log4j.jar usr/share/${package.name}/lib/bundle/&#010;</concat>
<antcall target="-deb-package.install-file-update-splash"/>
</target>
<target name="-deb-package.install-file-update-splash"
if="splashscreen.enable">
<concat destfile="${debianize.dir}/${package.name}.install"
append="true"
eol="lf"
fixlastline="true">resources/install/resources/splash.gif usr/share/${package.name}/&#010;</concat>
</target>
<target name="-deb-package.install-file-update-src"
if="debianize.src.pkg">
<property name="splashscreen.enable" value="true"/>
<antcall target="-deb-package.install-file-update-splash"/>
</target>
<!-- updates the startup scritp only if called from deb target -->
<target name="-deb-sh-file-update"
unless="debianize.src.pkg">
@ -2249,6 +2283,7 @@
<include name="install/build.xml"/>
<include name="install/ant-build-config.properties"/>
<include name="install/logging.properties"/>
<include name="install/resources/**/*"/>
</fileset>
</copy>
<copy todir="${target.dir}/src">

@ -18,7 +18,7 @@ LIBPATH=$SCDIR/lib
CLASSPATH=/usr/share/java/org.apache.felix.framework.jar:/usr/share/java/org.apache.felix.main.jar:$SCDIR/sc-bundles/sc-launcher.jar:$SCDIR/sc-bundles/util.jar/launchutils.jar:$LIBPATH
FELIX_CONFIG=$LIBPATH/felix.client.run.properties
LOG_CONFIG=$LIBPATH/logging.properties
COMMAND="$javabin $CLIENTARGS -classpath $CLASSPATH -Djna.library.path=/usr/lib/jni -Dfelix.config.properties=file:$FELIX_CONFIG -Djava.util.logging.config.file=$LOG_CONFIG net.java.sip.communicator.launcher.SIPCommunicator"
COMMAND="$javabin $CLIENTARGS -classpath $CLASSPATH -Djna.library.path=/usr/lib/jni -Dfelix.config.properties=file:$FELIX_CONFIG -Djava.util.logging.config.file=$LOG_CONFIG -splash:splash.gif net.java.sip.communicator.launcher.SIPCommunicator"
# set add LIBPATH to LD_LIBRARY_PATH for any sc natives (e.g. jmf .so's)
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/lib/jni"

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

@ -97,6 +97,7 @@ cp lib/native/linux-64/* $RPM_BUILD_ROOT/usr/share/jitsi/lib/native/
cp resources/install/logging.properties $RPM_BUILD_ROOT/usr/share/jitsi/lib/
cp lib/felix.client.run.properties $RPM_BUILD_ROOT/usr/share/jitsi/lib/
cp lib/jitsi-defaults.properties $RPM_BUILD_ROOT/usr/share/jitsi/lib/
cp resources/install/resources/splash.gif $RPM_BUILD_ROOT/usr/share/jitsi/
# Make felix deploy its bundles in ~/.felix/sip-communicator.bin
sed -i -e "s/felix.cache.profiledir=sip-communicator.bin/felix.cache.profile=sip-communicator.bin/" $RPM_BUILD_ROOT/usr/share/jitsi/lib/felix.client.run.properties

@ -66,6 +66,9 @@ static DWORD Run_runJavaFromRegKey(HKEY key, BOOL *searchForJava);
static DWORD Run_runJavaFromRuntimeLib(LPCTSTR runtimeLib, LPCTSTR javaHome, BOOL *searchForJava);
static LPSTR Run_skipWhitespace(LPSTR str);
typedef void (CALLBACK *SplashInit)();
typedef int (CALLBACK *SplashLoadFile)(const char* file);
static DWORD
Run_addPath(LPCTSTR path)
{
@ -1533,6 +1536,53 @@ Run_runJavaFromRuntimeLib
javaVMInitArgs.nOptions = optionStringCount;
javaVMInitArgs.options = options;
javaVMInitArgs.version = JNI_VERSION_1_2;
HMODULE hSplash = NULL;
LPTSTR lockFilePath = Run_getLockFilePath();
if(!(lockFilePath && Run_isFile(lockFilePath)))
{// Lets load and start splashscreen, if any
size_t javaHomeLength = _tcslen(javaHome);
LPTSTR path
= (LPTSTR) malloc(sizeof(TCHAR)
* (javaHomeLength + 20 + 1));
if (path)
{
if (javaHomeLength >= 1)
{
TCHAR *ch =
(TCHAR *) (javaHome + (javaHomeLength - 1));
if ((_T('\\') == *ch) || (_T('/') == *ch))
{
*ch = 0;
javaHomeLength--;
}
}
_tcscpy(path, javaHome);
_tcscpy(path + javaHomeLength,
_T("\\bin\\splashscreen.dll"));
hSplash = LoadLibrary(path);
if(hSplash > 0)
{
SplashInit splashInit =
(SplashInit)GetProcAddress(
hSplash, "SplashInit");
SplashLoadFile splashLoadFile =
(SplashLoadFile)GetProcAddress(
hSplash, "SplashLoadFile");
if (splashInit && splashLoadFile)
{
splashInit();
splashLoadFile("splash.gif");
}
}
}
}
if (jniCreateJavaVM(
&javaVM,
(void **) &jniEnv,
@ -1553,6 +1603,9 @@ Run_runJavaFromRuntimeLib
}
if (options)
free(options);
if(hSplash)
FreeLibrary(hSplash);
}
else
error = ERROR_OUTOFMEMORY;

@ -0,0 +1,167 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.splashscreen;
import org.osgi.framework.*;
import java.awt.*;
/**
* Activates if splash screen is available to draw progress and
* currently loading bundle name.
*
* @author Damian Minkov
*/
public class SplashScreenActivator
implements BundleActivator,
ServiceListener
{
/**
* A reference to the bundle context that is currently in use.
*/
private BundleContext bundleContext = null;
/**
* The splash screen if any.
*/
private SplashScreen splash;
/**
* The splash screen graphics.
*/
private Graphics2D g;
/**
* Progress so far.
*/
private int progress = 0;
/**
* The colors.
*/
private Color TEXT_BACKGROUND = new Color(203, 202, 202);
private Color TEXT_FOREGROUND = new Color(82, 82, 82);
private Color PROGRESS_FOREGROUND = new Color(177, 174, 173);
/**
* Starts if the splash screen is available.
*
* @throws Exception if starting the arg delegation bundle and registering
* the delegationPeer with the util package URI manager fails
*/
public void start(BundleContext bundleContext)
{
this.bundleContext = bundleContext;
splash = SplashScreen.getSplashScreen();
if(splash == null)
return;
g = splash.createGraphics();
if(g == null)
return;
bundleContext.addServiceListener(this);
}
/**
* Unsets the listener that we set when we start this bundle.
*
* @param bc an instance of the currently valid bundle context.
*/
public void stop(BundleContext bc)
{
bc.removeServiceListener(this);
this.g = null;
this.splash = null;
TEXT_BACKGROUND = null; TEXT_FOREGROUND = null;
PROGRESS_FOREGROUND = null;
}
@Override
public void serviceChanged(ServiceEvent serviceEvent)
{
if(splash == null)
return;
synchronized(splash)
{
try
{
if(!splash.isVisible())
{
stop(bundleContext);
return;
}
Bundle bundle =
serviceEvent.getServiceReference().getBundle();
if(bundle == null)
return;
Object bundleName =
bundle.getHeaders().get(Constants.BUNDLE_NAME);
if(bundleName == null)
return;
progress++;
int progressWidth = 233;
int progressHeight = 14;
int progressX = 168;
int progressY = 97;
int textHeight = 20;
int textBaseX = 150;
int textBaseY = 145 + (50 - textHeight)/2 + textHeight;
int currentProgressWidth = Math.min(2*progress, progressWidth);
g.setComposite(AlphaComposite.Clear);
g.setPaintMode();
// first clear the space for text
g.setColor(TEXT_BACKGROUND);
g.clearRect(
textBaseX - 1,// -1 to clear a pix left from some txt
textBaseY - textHeight,
(int) this.splash.getBounds().getWidth() - textBaseX,
textHeight + 5);
g.fillRect(
textBaseX - 1,// -1 to clear a pix left from some txt
textBaseY - textHeight,
(int) this.splash.getBounds().getWidth() - textBaseX,
textHeight + 5);
// then fill the progress
g.setColor(PROGRESS_FOREGROUND);
g.fillRect(progressX, progressY,
currentProgressWidth, progressHeight);
g.drawRect(progressX, progressY,
currentProgressWidth, progressHeight);
g.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setColor(TEXT_FOREGROUND);
g.drawString(bundleName.toString(), textBaseX, textBaseY);
splash.update();
}
catch(Throwable e)
{
stop(bundleContext);
return;
}
}
}
}

@ -0,0 +1,8 @@
Bundle-Activator: net.java.sip.communicator.impl.splashscreen.SplashScreenActivator
Bundle-Name: Splash Screen
Bundle-Description: A bundle that updates splash screen if present
Bundle-Vendor: jitsi.org
Bundle-Version: 0.0.1
Bundle-SymbolicName: net.java.sip.communicator.impl.splashscreen
Import-Package: org.osgi.framework,
org.osgi.service.startlevel
Loading…
Cancel
Save