14 static boolean allpassed;
18 static uint64_t oldver = 0;
22 oldver = atoll(old_vhash);
25 if (oldver > 0 && oldver < 3200000) {
28 if (lives_file_test(ocfdir, LIVES_FILE_TEST_IS_DIR)) {
33 if (lives_file_test(fname, LIVES_FILE_TEST_EXISTS)) {
38 if (lives_file_test(fname, LIVES_FILE_TEST_EXISTS)) {
45 if (lives_file_test(fname, LIVES_FILE_TEST_EXISTS)) {
59 if (oldver > 0 && oldver < 3200000) {
62 if (
do_yesno_dialogf(
_(
"The locations of LiVES configuration files have changed.\n"
63 "%s is now %s\nand %s is now %s\nThe files have been copied to the new locations.\n"
64 "\nWould you like me to remove the old files ?\n"),
73 if (lives_file_test(oldconfigdir, LIVES_FILE_TEST_IS_DIR)) {
85 boolean create =
TRUE;
90 LiVESResponseType retval;
91 char *keymap_file, *stock_icons_dir, *devmapdir;
93 if (!lives_file_test(config_datadir, LIVES_FILE_TEST_IS_DIR)) {
107 if (!lives_file_test(keymap_file, LIVES_FILE_TEST_EXISTS)) {
111 retval = LIVES_RESPONSE_NONE;
112 if (!lives_file_test(keymap_template, LIVES_FILE_TEST_EXISTS)) {
115 if (retval == LIVES_RESPONSE_BROWSE) {
118 LIVES_FILE_CHOOSER_ACTION_SELECT_FILE, NULL, NULL);
119 if (xkeymap_template && *xkeymap_template) {
121 keymap_template = xkeymap_template;
126 }
while (retval == LIVES_RESPONSE_RETRY);
128 if (retval != LIVES_RESPONSE_CANCEL) {
130 retval = LIVES_RESPONSE_NONE;
131 lives_cp(keymap_template, keymap_file);
132 if (!lives_file_test(keymap_file, LIVES_FILE_TEST_EXISTS)) {
135 (
_(
"Unable to create default keymap file: %s\nPlease make sure the directory\n%s\nis writable.\n"),
136 keymap_file, config_datadir)));
140 }
while (retval == LIVES_RESPONSE_RETRY);
148 if (!lives_file_test(keymap_file, LIVES_FILE_TEST_EXISTS)) {
150 retval = LIVES_RESPONSE_NONE;
151 if (lives_file_test(keymap_template, LIVES_FILE_TEST_EXISTS)) {
152 lives_cp(keymap_template, keymap_file);
158 if (1 || !lives_file_test(devmapdir, LIVES_FILE_TEST_IS_DIR)) {
163 retval = LIVES_RESPONSE_NONE;
164 if (!lives_file_test(sys_devmap_dir, LIVES_FILE_TEST_IS_DIR)) {
167 if (retval == LIVES_RESPONSE_BROWSE) {
168 char *xsys_devmap_dir =
choose_file(sys_devmap_dir, NULL, NULL,
169 LIVES_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, NULL);
170 if (xsys_devmap_dir && *xsys_devmap_dir) {
172 sys_devmap_dir = xsys_devmap_dir;
177 }
while (retval == LIVES_RESPONSE_RETRY);
179 if (retval != LIVES_RESPONSE_CANCEL) {
181 retval = LIVES_RESPONSE_NONE;
184 }
while (retval == LIVES_RESPONSE_RETRY);
186 if (retval != LIVES_RESPONSE_CANCEL) {
196 stock_icons_dir = lives_build_path(config_datadir,
STOCK_ICONS_DIR, NULL);
198 if (!lives_file_test(stock_icons_dir, LIVES_FILE_TEST_IS_DIR)) {
205 retval = LIVES_RESPONSE_NONE;
206 if (!lives_file_test(sys_stock_icons_dir, LIVES_FILE_TEST_IS_DIR)) {
208 sys_stock_icons_dir);
209 if (retval == LIVES_RESPONSE_BROWSE) {
210 char *xsys_stock_icons_dir =
choose_file(sys_stock_icons_dir, NULL, NULL,
211 LIVES_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL, NULL);
212 if (xsys_stock_icons_dir && *xsys_stock_icons_dir) {
214 sys_stock_icons_dir = xsys_stock_icons_dir;
219 }
while (retval == LIVES_RESPONSE_RETRY);
221 if (retval != LIVES_RESPONSE_CANCEL) {
223 retval = LIVES_RESPONSE_NONE;
226 }
while (retval == LIVES_RESPONSE_RETRY);
228 if (retval != LIVES_RESPONSE_CANCEL) {
244 static LiVESResponseType prompt_existing_dir(
const char *dirname, uint64_t freespace,
boolean wrtable) {
250 _(
"You have chosen to use your home directory as the LiVES working directory.\n"
251 "This is NOT recommended as it will possibly result in the loss of unrelated files.\n"
252 "Click Yes if you REALLY want to continue, or No to create or select another directory.\n")))
253 return LIVES_RESPONSE_CANCEL;
257 _(
"A directory named\n%s\nalready exists. Do you wish to use this directory ?\n\n(Free space = %s)\n"),
260 if (!res)
return LIVES_RESPONSE_CANCEL;
261 return LIVES_RESPONSE_OK;
264 msg =
lives_strdup_printf(
_(
"A directory named\n%s\nalready exists.\nHowever, LiVES could not write to this directory "
265 "or read its free space.\nClick Abort to exit from LiVES, or Retry to select another "
266 "location.\n"), dirname);
270 return LIVES_RESPONSE_RETRY;
272 return LIVES_RESPONSE_OK;
276 static boolean prompt_new_dir(
char *dirname, uint64_t freespace,
boolean wrtable) {
280 res =
do_warning_dialogf(
_(
"\nCreate the directory\n%s\n?\n\n(Free space = %s)"), dirname, fspstr);
284 "Please try again and choose a different location.\n"),
293 if (can_retry) rstr =
_(
"\nPlease click Retry to select an alternative directory, or Abort to exit immediately"
295 else rstr = lives_strdup(
"");
297 msg =
lives_strdup_printf(
_(
"The name of the %s provided\n(%s)\nis too long (maximum is %d characters)\n%s"),
298 ftype, fname, max, rstr);
304 void dir_toolong_error(
const char *dirname,
const char *dirtype,
size_t max,
boolean can_retry) {
306 if (can_retry) rstr =
_(
"\nPlease click Retry to select an alternative directory, or Abort to exit immediately"
308 else rstr = lives_strdup(
"");
309 msg =
lives_strdup_printf(
_(
"The name of the %s provided\n(%s)\nis too long (maximum is %d characters)\n%s"),
310 dirtype, dirname, max, rstr);
336 if (!pdirname || !*pdirname)
return LIVES_RESPONSE_RETRY;
340 return LIVES_RESPONSE_RETRY;
344 lives_snprintf(cdir,
PATH_MAX,
"%s", *pdirname);
347 *pdirname = lives_strdup(cdir);
351 return LIVES_RESPONSE_RETRY;
356 if (lives_file_test(*pdirname, LIVES_FILE_TEST_EXISTS) &&
357 (strlen(*pdirname) < chklen || strncmp(*pdirname + strlen(*pdirname) - chklen,
366 return LIVES_RESPONSE_RETRY;
372 return LIVES_RESPONSE_RETRY;
376 if (lives_file_test(*pdirname, LIVES_FILE_TEST_IS_DIR)) {
380 if (!prompt_existing_dir(*pdirname, freesp,
TRUE)) {
382 return LIVES_RESPONSE_RETRY;
386 if (!prompt_existing_dir(*pdirname, 0,
FALSE)) {
387 return LIVES_RESPONSE_RETRY;
393 if (!prompt_new_dir(*pdirname, freesp,
TRUE)) {
395 return LIVES_RESPONSE_RETRY;
398 if (!prompt_new_dir(*pdirname, 0,
FALSE)) {
400 return LIVES_RESPONSE_RETRY;
409 return LIVES_RESPONSE_OK;
414 LiVESWidget *dirbutton;
415 LiVESResponseType response;
416 char *dirname = NULL, *mp;
421 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(dirbutton),
FILESEL_TYPE_KEY,
429 gtk_window_set_urgency_hint(LIVES_WINDOW(wizard->
dialog),
TRUE);
437 if (response == LIVES_RESPONSE_CANCEL)
return FALSE;
479 static void on_init_aplayer_toggled(LiVESToggleButton * tbutton, livespointer user_data) {
480 int audp = LIVES_POINTER_TO_INT(user_data);
501 LiVESWidget *dialog, *dialog_vbox, *radiobutton2 = NULL, *label;
502 LiVESWidget *okbutton, *cancelbutton;
505 #ifdef HAVE_PULSE_AUDIO
506 LiVESWidget *radiobutton0;
510 LiVESWidget *radiobutton1;
513 LiVESAccelGroup *accel_group;
515 LiVESSList *radiobutton_group = NULL;
517 char *txt0, *txt1, *txt2, *txt3, *txt4, *txt5, *txt6, *msg, *wid;
519 LiVESResponseType response;
521 if (startup_phase == 2) {
522 txt0 = (
_(
"LiVES FAILED TO START YOUR SELECTED AUDIO PLAYER !\n\n"));
525 txt0 = lives_strdup(
"");
529 _(
"Before starting LiVES, you need to choose an audio player.\n\nPULSE AUDIO is recommended for most users"));
531 #ifndef HAVE_PULSE_AUDIO
532 txt2 = (
_(
", but this version of LiVES was not compiled with pulse audio support.\n\n"));
536 _(
", but you do not have pulseaudio installed on your system.\n "
537 "You are advised to install pulseaudio first before running LiVES.\n\n"));
538 }
else txt2 = lives_strdup(
".\n\n");
541 txt3 = (
_(
"JACK audio is recommended for pro users"));
544 txt4 = (
_(
", but this version of LiVES was not compiled with jack audio support.\n\n"));
547 txt4 = (
_(
", but you do not have jackd installed. You may wish to install jackd first before running LiVES.\n\n"));
550 _(
", but may prevent LiVES from starting on some systems.\nIf LiVES will not start with jack,"
551 "you can restart and try with another audio player instead.\n\n"));
555 txt5 = (
_(
"SOX may be used if neither of the preceding players work, "));
558 txt6 = (
_(
"but many audio features will be disabled.\n\n"));
560 txt6 = (
_(
"but you do not have sox installed.\nYou are advised to install it before running LiVES.\n\n"));
581 #ifdef HAVE_PULSE_AUDIO
601 #ifdef HAVE_PULSE_AUDIO
622 #ifdef HAVE_PULSE_AUDIO
623 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton0), LIVES_WIDGET_TOGGLED_SIGNAL,
624 LIVES_GUI_CALLBACK(on_init_aplayer_toggled),
629 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton1), LIVES_WIDGET_TOGGLED_SIGNAL,
630 LIVES_GUI_CALLBACK(on_init_aplayer_toggled),
635 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton2), LIVES_WIDGET_TOGGLED_SIGNAL,
636 LIVES_GUI_CALLBACK(on_init_aplayer_toggled),
640 LIVES_RESPONSE_CANCEL);
643 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
656 return LIVES_RESPONSE_CANCEL;
680 return (response == LIVES_RESPONSE_OK);
684 static void add_test(LiVESWidget * table,
int row,
char *ttext,
boolean noskip) {
687 lives_table_attach(LIVES_TABLE(table), label, 0, 1, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 10, 10);
695 lives_table_attach(LIVES_TABLE(table), label, 1, 2, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 10, 10);
698 lives_table_attach(LIVES_TABLE(table), image, 2, 3, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 0, 10);
706 static boolean pass_test(LiVESWidget * table,
int row) {
710 #if GTK_CHECK_VERSION(3, 10, 0)
716 lives_table_attach(LIVES_TABLE(table), label, 1, 2, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 10, 10);
719 lives_table_attach(LIVES_TABLE(table), image, 2, 3, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 0, 10);
727 static boolean _fail_test(LiVESWidget * table,
int row,
char *ftext,
const char *type) {
729 #if GTK_CHECK_VERSION(3, 10, 0)
737 lives_table_attach(LIVES_TABLE(table), label, 3, 4, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 10, 10);
743 lives_table_attach(LIVES_TABLE(table), label, 1, 2, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 10, 10);
746 lives_table_attach(LIVES_TABLE(table), image, 2, 3, row, row + 1, (LiVESAttachOptions)0, (LiVESAttachOptions)0, 0, 10);
755 return _fail_test(table, row, ftext,
_(
"Failed"));
759 return _fail_test(table, row, ftext,
_(
"Skipped"));
769 LiVESWidget *dialog_vbox;
773 LiVESWidget *okbutton;
774 LiVESWidget *cancelbutton;
776 LiVESAccelGroup *accel_group;
780 char *com, *rname, *afile, *tmp;
791 boolean success, success2, success3, success4;
792 boolean imgext_switched =
FALSE;
794 LiVESResponseType response;
798 int out_fd, info_fd, testcase = 0;
814 title = (
_(
"Testing Configuration"));
816 title = (
_(
"Troubleshoot"));
832 LIVES_RESPONSE_CANCEL);
835 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
856 gtk_window_set_urgency_hint(LIVES_WINDOW(dialog),
TRUE);
861 gtk_window_set_urgency_hint(LIVES_WINDOW(dialog),
TRUE);
870 add_test(table, testcase,
_(
"Checking for \"sox\" presence"),
TRUE);
873 success =
fail_test(table, testcase,
_(
"You should install sox to be able to use all the audio features in LiVES"));
876 success = pass_test(table, testcase);
880 add_test(table, ++testcase,
_(
"Checking if sox can convert audio"), success);
895 out_fd =
lives_open3(afile, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
901 int bytes = 44100 * 4;
923 afile = lives_build_filename(
prefs->
workdir,
cfile->handle,
"testout.wav", NULL);
926 cfile->handle, afile);
952 fail_test(table, testcase,
_(
"You should install sox_fmt_all or similar"));
953 else pass_test(table, testcase);
980 add_test(table, ++testcase,
_(
"Checking for \"mplayer\", \"mplayer2\" or \"mpv\" presence"),
TRUE);
984 _(
"You should install mplayer, mplayer2 or mpv to be able to use all the decoding features in LiVES"));
1008 success2 = pass_test(table, testcase);
1024 add_test(table, ++testcase, msg, success2);
1044 pass_test(table, testcase);
1046 fail_test(table, testcase,
_(
"You should install mplayer,mplayer2 or mpv with pcm/wav support"));
1053 if (!lives_file_test(rname, LIVES_FILE_TEST_IS_DIR)) {
1056 }
else success4 =
TRUE;
1063 add_test(table, ++testcase, msg, success2);
1068 if (success2 && !success4) {
1074 add_test(table, ++testcase, msg,
TRUE);
1079 if (!strcmp(mp_cmd,
"mpv")) lookfor =
"image";
1080 else lookfor =
"png file";
1083 com =
lives_strdup_printf(
"LANG=en LANGUAGE=en %s -vo help | %s -i \"%s\" >/dev/null 2>&1",
1093 pass_test(table, testcase);
1101 if (!success3 && success2 && success4) {
1110 (tmp = lives_filename_from_utf8(rname, -1, NULL, NULL, NULL)));
1128 if (info_fd != -1) {
1136 if (
cfile->frames <= 0) {
1143 pass_test(table, testcase);
1166 add_test(table, ++testcase, msg, success2);
1170 if (!strcmp(mp_cmd,
"mpv")) {
1171 if (success2 && success3 && !success4) {
1172 tmp = (
_(
"Already checked"));
1178 }
else lookfor =
"jpeg file";
1182 com =
lives_strdup_printf(
"LANG=en LANGUAGE=en %s -vo help | %s -i \"%s\" >/dev/null 2>&1",
1195 pass_test(table, testcase);
1207 msg =
lives_strdup_printf(
_(
"You should install %s with either png/alpha or jpeg support"), mp_cmd);
1223 add_test(table, ++testcase,
_(
"Checking for \"convert\" presence"),
TRUE);
1226 success =
fail_test(table, testcase,
_(
"Install imageMagick to be able to use all of the rendered effects"));
1228 success = pass_test(table, testcase);
1245 if (imgext_switched) {
1247 _(
"\n\n\tImage decoding type has been switched to jpeg. You can revert this in Preferences/Decoding.\t\n"));
1253 _(
"\n\n\tClick Cancel to exit and install any missing components, or Next to continue\t\n"));
1272 return (response == LIVES_RESPONSE_OK);
1278 LiVESWidget *dialog, *dialog_vbox, *radiobutton, *label;
1282 LiVESSList *radiobutton_group = NULL;
1283 LiVESResponseType resp;
1284 char *txt1, *txt2, *txt3, *msg, *wid;
1286 txt1 = (
_(
"\n\nFinally, you can choose the default startup interface for LiVES.\n"));
1287 txt2 = (
_(
"\n\nLiVES has two main interfaces and you can start up with either of them.\n"));
1288 txt3 = (
_(
"\n\nThe default can always be changed later from Preferences.\n"));
1327 _(
"Set Quota Limits (Optional)"), LIVES_RESPONSE_SHOW_DETAILS);
1331 _(
"Finish"), LIVES_RESPONSE_OK);
1365 static char *explain_missing(
const char *exe) {
1367 "Installation is recommended as it provides the following features\n\t- "), exe);
1377 "enabling additional files to be cached in memory.\n\n"));
1379 "Youtube and other sites.\n\n"));
1381 "so that they can be recorded.\n\n"));
1385 "Installation is optional, but may enable additional features\n\t- "), exe);
1387 else return lives_strdup_free(pt1,
"");
1393 #define ADD_TO_TEXT(what, exec) if (!capable->has_##what) { \
1394 text = lives_concat(text, explain_missing(exec)) ;\
1398 char *title = (
_(
"What is missing ?")), *text = lives_strdup(
"");
1418 text =
lives_concat(text, (
_(
"\n\nIf you DO have any of these missing components, please ensure they are "
1419 "located in your $PATH before restarting LiVES")));