void ProfileControl::setClockAlarmToneFile(const QString &filename) { if (filename == m_clockAlarmToneFile) { return; } m_clockAlarmToneFile = filename; profile_set_value(GeneralProfile, ClockAlarmToneKey, filename.toUtf8().constData()); emit clockAlarmToneFileChanged(); }
void ProfileControl::setMessageToneFile(const QString &filename) { if (filename == m_messageToneFile) { return; } m_messageToneFile = filename; profile_set_value(GeneralProfile, MessageToneKey, filename.toUtf8().constData()); emit messageToneFileChanged(); }
void ProfileControl::setInternetCallToneFile(const QString &filename) { if (filename == m_internetCallToneFile) { return; } m_internetCallToneFile = filename; profile_set_value(GeneralProfile, InternetCallToneKey, filename.toUtf8().constData()); emit internetCallToneFileChanged(); }
int main(int argc, char **argv) { static const char * const profiles[] = { "general", "silent", }; static const char * const keys[] = { #if 0 "ringing.alert.tone", #else "calendar.alarm.enabled", "clock.alarm.enabled", "email.alert.tone", "email.alert.volume", "im.alert.tone", "im.alert.volume", "keypad.sound.level", "ringing.alert.tone", "ringing.alert.type", "ringing.alert.volume", "sms.alert.tone", "sms.alert.volume", "system.sound.level", "touchscreen.sound.level", "vibrating.alert.enabled", #endif }; printf("\n================ %s ================\n", "init"); tracker_init(); printf("\n================ %s ================\n", "profiles"); for( int n = 0; n < 2; ++n ) { for( size_t i = 0; i < numof(profiles); ++i ) { printf("--\nSET '%s'\n", profiles[i]); profile_set_profile(profiles[i]); mysleep(1500); } } printf("\n================ %s ================\n", "values"); for( size_t i = 0; i < 8; ++i ) { const char *p = profiles[i % numof(profiles)]; const char *k = keys[i % numof(keys)]; char v[32]; snprintf(v, sizeof v, "dummy-%Zd.mp3", i); printf("--\nSET %s:%s=%s\n", p,k,v); profile_set_value(p, k, v); mysleep(1500); } printf("\n================ %s ================\n", "reset"); for( size_t p = 0; p < numof(profiles); ++p ) { for( size_t k = 0; k < numof(keys); ++k ) { profile_set_value(profiles[p], keys[k], ""); } } mysleep(2000); printf("\n================ %s ================\n", *profiles); profile_set_profile(*profiles); mysleep(1500); return 0; }
int main(int argc, char **argv) { int opt; char *p,*k,*v,**w; while( (opt = getopt(argc, argv, "hp:s:d:g:t:TlkvV:B:I:D:G:rR:")) != -1 ) { switch (opt) { case 'h': write(STDOUT_FILENO, usage, sizeof usage - 1); exit(0); case 'p': profile_set_profile(optarg); break; case 'l': p = profile_get_profile(); w = profile_get_profiles(); for( size_t i = 0; w && w[i]; ++i ) { printf("%s%s\n", w[i], strcmp(w[i],p) ? "" : "*"); } profile_free_profiles(w); free(p); break; case 'k': w = profile_get_keys(); for( size_t i = 0; w && w[i]; ++i ) { printf("%s\n", w[i]); } profile_free_keys(w); break; case 'r': w = profile_get_keys(); for( size_t i = 0; w && w[i]; ++i ) { profile_set_value(0, w[i], ""); } profile_free_keys(w); break; case 'R': w = profile_get_keys(); for( size_t i = 0; w && w[i]; ++i ) { profile_set_value(optarg, w[i], ""); } profile_free_keys(w); break; case 'v': case 'V': { p = (opt == 'v') ? 0 : optarg; profileval_t *t = profile_get_values(p); for( size_t i = 0; t && t[i].pv_key; ++i ) { printf("%s = %s (%s)\n", t[i].pv_key, t[i].pv_val, t[i].pv_type); } profile_free_values(t); } break; case 'T': exit(track()); case 's': parse(optarg, &p,&k,&v); profile_set_value(p, k, v); break; case 'd': parse(optarg, &p,&k,&v); profile_set_value(p, k, ""); break; case 'g': parse(optarg, &p,&k,&v); v = profile_get_value(p,k); printf("%s\n", v); free(v); break; case 'G': { parse(optarg, &p,&k,&v); char *s = profile_get_value(p,k); printf("STRING: '%s'\n", s); free(s); int b = profile_get_value_as_bool(p,k); printf("BOOL: %s (%d)\n", b ? "On" : "Off", b); int i = profile_get_value_as_int(p,k); printf("INT: %d\n", i); double d = profile_get_value_as_double(p,k); printf("DOUBLE:%g\n", d); } break; case 'B': { parse(optarg, &p,&k,&v); int v = profile_get_value_as_bool(p,k); printf("BOOL:%s (%d)\n", v ? "On" : "Off", v); } break; case 'I': { parse(optarg, &p,&k,&v); int v = profile_get_value_as_int(p,k); printf("INT:%d\n", v); } break; case 'D': { parse(optarg, &p,&k,&v); double v = profile_get_value_as_double(p,k); printf("DOUBLE:%g\n", v); } break; case 't': v = profile_get_type(optarg); printf("%s\n", v); free(v); break; default: /* '?' */ fprintf(stderr, "(use -h for usage info)\n"); exit(EXIT_FAILURE); } } return 0; }