Remove splash, fix #93
This commit is contained in:
parent
f63633570f
commit
874c92aeb5
@ -36,7 +36,6 @@ src/xqf-ui.c
|
||||
src/xqf.c
|
||||
#src/xutils.c
|
||||
#src/zipped.c
|
||||
src/splash.c
|
||||
src/country-filter.c
|
||||
src/loadpixmap.c
|
||||
src/trayicon.c
|
||||
|
@ -99,7 +99,6 @@ redial.c \
|
||||
q3maps.c \
|
||||
utmaps.c \
|
||||
loadpixmap.c \
|
||||
splash.c \
|
||||
scripts.c \
|
||||
addmaster.h \
|
||||
addserver.h \
|
||||
@ -143,7 +142,6 @@ q3maps.h \
|
||||
utmaps.h \
|
||||
i18n.h \
|
||||
loadpixmap.h \
|
||||
splash.h \
|
||||
scripts.h
|
||||
|
||||
noinst_SCRIPTS = gensyms.pl
|
||||
|
21
src/pref.c
21
src/pref.c
@ -46,7 +46,6 @@
|
||||
#include "debug.h"
|
||||
#include "sort.h"
|
||||
#include "q3maps.h"
|
||||
#include "splash.h"
|
||||
#include "srv-list.h"
|
||||
#include "scripts.h"
|
||||
|
||||
@ -101,7 +100,6 @@ int default_save_lists;
|
||||
int default_save_srvinfo;
|
||||
int default_save_plrinfo;
|
||||
int default_auto_favorites;
|
||||
int default_show_splash;
|
||||
int default_auto_maps;
|
||||
int skip_startup_mapscan;
|
||||
int default_show_tray_icon;
|
||||
@ -179,7 +177,6 @@ static GtkWidget *save_lists_check_button;
|
||||
static GtkWidget *save_srvinfo_check_button;
|
||||
static GtkWidget *save_plrinfo_check_button;
|
||||
static GtkWidget *auto_favorites_check_button;
|
||||
static GtkWidget *show_splash_button;
|
||||
static GtkWidget *auto_maps_check_button;
|
||||
|
||||
/*Tray Icon*/
|
||||
@ -1299,11 +1296,6 @@ static void get_new_defaults (void) {
|
||||
config_set_bool ("refresh favorites", default_auto_favorites = i);
|
||||
}
|
||||
|
||||
i = GTK_TOGGLE_BUTTON (show_splash_button)->active;
|
||||
if (i != default_show_splash) {
|
||||
config_set_bool ("splash screen", default_show_splash = i);
|
||||
}
|
||||
|
||||
i = GTK_TOGGLE_BUTTON (auto_maps_check_button)->active;
|
||||
if (i != default_auto_maps) {
|
||||
config_set_bool ("search maps", default_auto_maps = i);
|
||||
@ -3965,14 +3957,10 @@ static GtkWidget *appearance_options_page (void) {
|
||||
static void scan_maps_callback (GtkWidget *widget, gpointer data) {
|
||||
int i;
|
||||
|
||||
create_splashscreen();
|
||||
|
||||
for (i = 0; i < GAMES_TOTAL; i++) {
|
||||
scan_maps_for(i);
|
||||
}
|
||||
|
||||
destroy_splashscreen();
|
||||
|
||||
server_clist_set_list (cur_server_list);
|
||||
}
|
||||
|
||||
@ -4010,11 +3998,6 @@ static GtkWidget *general_options_page (void) {
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
show_splash_button = gtk_check_button_new_with_label (_("Show splash screen"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_splash_button), default_show_splash);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), show_splash_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (show_splash_button);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
|
||||
@ -5167,7 +5150,6 @@ int prefs_load (void) {
|
||||
default_save_srvinfo = config_get_bool("save srvinfo=true");
|
||||
default_save_plrinfo = config_get_bool("save players=false");
|
||||
default_auto_favorites = config_get_bool("refresh favorites=false");
|
||||
default_show_splash = config_get_bool("splash screen=true");
|
||||
default_auto_maps = config_get_bool("search maps=false");
|
||||
default_show_tray_icon = config_get_bool("showtray=false");
|
||||
|
||||
@ -5206,8 +5188,6 @@ int prefs_load (void) {
|
||||
fprintf (stderr, "prefs_load(): program version %s\n", (newversion)? "changed" : "not changed");
|
||||
#endif
|
||||
|
||||
create_splashscreen();
|
||||
|
||||
/* Convert "dir" -> "real_dir" for all game types */
|
||||
|
||||
for (i = 0; i < GAMES_TOTAL; i++) {
|
||||
@ -5230,7 +5210,6 @@ static void scan_maps_for(enum server_type type) {
|
||||
char* msg = g_strdup_printf(_("Searching for %s maps"),games[type].name);
|
||||
guint per = 100/GAMES_TOTAL;
|
||||
|
||||
splash_increase_progress(msg,per);
|
||||
if (games[type].init_maps) {
|
||||
games[type].init_maps(games[type].type);
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ extern int default_save_lists;
|
||||
extern int default_save_srvinfo;
|
||||
extern int default_save_plrinfo;
|
||||
extern int default_auto_favorites;
|
||||
extern int default_show_splash;
|
||||
extern int default_show_tray_icon;
|
||||
extern int default_always_resolve;
|
||||
extern int default_toolbar_style;
|
||||
|
139
src/splash.c
139
src/splash.c
@ -1,139 +0,0 @@
|
||||
/* XQF - Quake server browser and launcher
|
||||
* Splash screen
|
||||
* Copyright (C) 2002 Ludwig Nussel <l-n@users.sourceforge.net>
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include "gnuconfig.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "splash.h"
|
||||
#include "xqf-ui.h"
|
||||
#include "loadpixmap.h"
|
||||
#include "i18n.h"
|
||||
#include "pref.h"
|
||||
#include "xutils.h"
|
||||
|
||||
static GtkWidget* splashscreen;
|
||||
static guint current_progress;
|
||||
|
||||
void destroy_splashscreen(void) {
|
||||
if (!splashscreen) return;
|
||||
|
||||
gtk_widget_destroy(splashscreen);
|
||||
splashscreen = NULL;
|
||||
}
|
||||
|
||||
void create_splashscreen (void) {
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *logo;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *progress;
|
||||
|
||||
if (splashscreen) return;
|
||||
|
||||
if (!default_show_splash) return;
|
||||
|
||||
splashscreen = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_object_set_data (GTK_OBJECT (splashscreen), "splashscreen", splashscreen);
|
||||
gtk_window_set_title (GTK_WINDOW (splashscreen), _("XQF: Loading"));
|
||||
gtk_window_set_position (GTK_WINDOW (splashscreen), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_modal (GTK_WINDOW (splashscreen), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW (splashscreen), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_ref (vbox1);
|
||||
gtk_object_set_data_full (GTK_OBJECT (splashscreen), "vbox1", vbox1,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_container_add (GTK_CONTAINER (splashscreen), vbox1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 3);
|
||||
|
||||
logo = load_pixmap (splashscreen, "splash.png");
|
||||
gtk_widget_ref (logo);
|
||||
gtk_object_set_data_full (GTK_OBJECT (splashscreen), "logo", logo,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (logo);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), logo, TRUE, TRUE, 0);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_ref (entry);
|
||||
gtk_object_set_data_full (GTK_OBJECT (splashscreen), "entry", entry,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), entry, FALSE, FALSE, 0);
|
||||
gtk_entry_set_editable (GTK_ENTRY (entry), FALSE);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), _("Loading ..."));
|
||||
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_widget_ref (progress);
|
||||
gtk_object_set_data_full (GTK_OBJECT (splashscreen), "progress", progress,
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (progress);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), progress, FALSE, FALSE, 0);
|
||||
gtk_progress_configure (GTK_PROGRESS (progress), 42, 0, 100);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (splashscreen), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy_splashscreen), NULL);
|
||||
|
||||
gtk_widget_show (splashscreen);
|
||||
|
||||
// force it to draw now.
|
||||
gdk_flush();
|
||||
|
||||
// go into main loop, processing events.
|
||||
while (gtk_events_pending() || !GTK_WIDGET_REALIZED(logo))
|
||||
gtk_main_iteration();
|
||||
|
||||
// test
|
||||
while (gdk_events_pending())
|
||||
gdk_flush();
|
||||
|
||||
current_progress = 0;
|
||||
}
|
||||
|
||||
/* set percentage on splash screen, thanks to lopster for this code */
|
||||
void splash_set_progress(const char* message, guint per) {
|
||||
GtkProgressBar* progress;
|
||||
GtkEntry* entry;
|
||||
|
||||
if (!splashscreen) return;
|
||||
|
||||
if (per > 100) per = 100;
|
||||
|
||||
current_progress = per;
|
||||
|
||||
progress = GTK_PROGRESS_BAR(lookup_widget(splashscreen, "progress"));
|
||||
entry = GTK_ENTRY(lookup_widget(splashscreen, "entry"));
|
||||
if (message)
|
||||
gtk_entry_set_text(entry, message);
|
||||
gtk_progress_bar_update(progress, per*1.0/100);
|
||||
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
}
|
||||
|
||||
void splash_increase_progress(const char* message, guint per) {
|
||||
if (!splashscreen) return;
|
||||
splash_set_progress(message,current_progress+per);
|
||||
}
|
39
src/splash.h
39
src/splash.h
@ -1,39 +0,0 @@
|
||||
/* XQF - Quake server browser and launcher
|
||||
* Splash screen
|
||||
* Copyright (C) 2002 Ludwig Nussel <l-n@users.sourceforge.net>
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifndef SPLASH_H
|
||||
#define SPLASH_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define MAPLOAD_PERCENT .8
|
||||
|
||||
void create_splashscreen (void);
|
||||
|
||||
void destroy_splashscreen(void);
|
||||
|
||||
/* set percentage on splash screen to absolute value, thanks to lopster for
|
||||
* this code
|
||||
* */
|
||||
void splash_set_progress(const char* message, guint per);
|
||||
|
||||
/* add per to current percentage */
|
||||
void splash_increase_progress(const char* message, guint per);
|
||||
|
||||
#endif
|
@ -78,7 +78,6 @@
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "redial.h"
|
||||
#include "splash.h"
|
||||
#include "loadpixmap.h"
|
||||
#include "trayicon.h"
|
||||
#include "scripts.h"
|
||||
@ -4306,7 +4305,6 @@ int main (int argc, char *argv[]) {
|
||||
filters_init ();
|
||||
|
||||
host_cache_load ();
|
||||
splash_increase_progress (_("Reading server lists"),10);
|
||||
init_masters (newversion);
|
||||
|
||||
client_init ();
|
||||
@ -4324,14 +4322,10 @@ int main (int argc, char *argv[]) {
|
||||
dialog_ok (NULL, _("You need at least qstat version %s for xqf to function properly"), required_qstat_version);
|
||||
}
|
||||
|
||||
splash_increase_progress (_("Loading icons ..."),10);
|
||||
|
||||
create_main_window ();
|
||||
|
||||
init_pixmaps (main_window);
|
||||
|
||||
splash_set_progress (_("Starting ..."),100);
|
||||
|
||||
play_sound (sound_xqf_start, 0);
|
||||
|
||||
script_action_start ();
|
||||
@ -4352,8 +4346,6 @@ int main (int argc, char *argv[]) {
|
||||
|
||||
if (default_auto_favorites && !cmdline_add_server) refresh_callback (NULL, NULL);
|
||||
|
||||
destroy_splashscreen ();
|
||||
|
||||
g_timeout_add (0, check_cmdline_launch, NULL);
|
||||
|
||||
debug (1, "startup time %ds", time (NULL) - xqf_start_time);
|
||||
|
Loading…
x
Reference in New Issue
Block a user