void AVDirector::RunApplication(float fCullValue, HINSTANCE hIns, HWND parentHandle, bool isChild, AVRECT &windowRect, wchar_t *application) { m_Application = new AVWinD3D((WNDPROC)AVDirector::WndProc, hIns, windowRect, parentHandle, application, isChild); m_Application->InitWinD3D(application, true, true, D3DCULL_CCW); MSG msg; ZeroMemory( &msg, sizeof( msg ) ); _initMatrix(fCullValue); _initLight(); SetFog(fCullValue - 100.f, fCullValue - 50.f); if(m_Application->isChild()) return; while( msg.message != WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { RunToInnerSystem(); tickTime(); if(m_bIsFrameCheck) calculateFPS(); } } }
void AVDirector::RunApplication() { m_Application = new AVWinD3D((WNDPROC)AVDirector::WndProc); m_Application->InitWinD3D(); MSG msg; ZeroMemory( &msg, sizeof( msg ) ); while( msg.message != WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { RunToInnerSystem(); tickTime(); } } }
/** * MiniClock Screen displays the current time with hours & minutes only * *\verbatim * * +--------------------+ +--------------------+ * | | | 11:32 | * | 11:32 | | | * | | +--------------------+ * | | * +--------------------+ * *\endverbatim * * \param rep Time since last screen update * \param display 1 if screen is visible or data should be updated * \param flags_ptr Mode flags * \return Always 0 */ int mini_clock_screen(int rep, int display, int *flags_ptr) { char now[40]; time_t thetime; struct tm *rtime; static const char *timeFormat = NULL; static int heartbeat = 0; int xoffs; /* toggle colon display */ heartbeat ^= 1; if ((*flags_ptr & INITIALIZED) == 0) { *flags_ptr |= INITIALIZED; /* get config values */ timeFormat = config_get_string("MiniClock", "TimeFormat", 0, "%H:%M"); sock_send_string(sock, "screen_add N\n"); sock_send_string(sock, "screen_set N -name {Mini Clock Screen} -heartbeat off\n"); sock_send_string(sock, "widget_add N one string\n"); } time(&thetime); rtime = localtime(&thetime); if (strftime(now, sizeof(now), timeFormat, rtime) == 0) *now = '\0'; tickTime(now, heartbeat); xoffs = (lcd_wid > strlen(now)) ? (((lcd_wid - strlen(now)) / 2) + 1) : 1; sock_printf(sock, "widget_set N one %d %d {%s}\n", xoffs, (lcd_hgt / 2), now); return 0; } /* End mini_clock_screen() */
/** * TimeDate Screen displays current time and date, uptime, OS ver... * *\verbatim * * +--------------------+ +--------------------+ * |## Linux 2.6.11 ###@| |### TIME: myhost ##@| * |Up xxx days hh:mm:ss| |17.05.2005 11:32:57a| * | Wed May 17, 1998 | +--------------------+ * |11:32:57a 100% idle| * +--------------------+ * *\endverbatim * * \param rep Time since last screen update * \param display 1 if screen is visible or data should be updated * \param flags_ptr Mode flags * \return Always 0 */ int time_screen(int rep, int display, int *flags_ptr) { char now[40]; char today[40]; int xoffs; int days, hour, min, sec; static int heartbeat = 0; static const char *timeFormat = NULL; static const char *dateFormat = NULL; time_t thetime; struct tm *rtime; double uptime, idle; if ((*flags_ptr & INITIALIZED) == 0) { *flags_ptr |= INITIALIZED; /* get config values */ timeFormat = config_get_string("TimeDate", "TimeFormat", 0, "%H:%M:%S"); dateFormat = config_get_string("TimeDate", "DateFormat", 0, "%b %d %Y"); sock_send_string(sock, "screen_add T\n"); sock_printf(sock, "screen_set T -name {Time Screen: %s}\n", get_hostname()); sock_send_string(sock, "widget_add T title title\n"); sock_send_string(sock, "widget_add T one string\n"); if (lcd_hgt >= 4) { sock_send_string(sock, "widget_add T two string\n"); sock_send_string(sock, "widget_add T three string\n"); /* write title bar: OS name, OS version, hostname */ sock_printf(sock, "widget_set T title {%s %s: %s}\n", get_sysname(), get_sysrelease(), get_hostname()); } else { /* write title bar: hostname */ sock_printf(sock, "widget_set T title {TIME: %s}\n", get_hostname()); } } /* toggle colon display */ heartbeat ^= 1; time(&thetime); rtime = localtime(&thetime); if (strftime(today, sizeof(today), dateFormat, rtime) == 0) *today = '\0'; if (strftime(now, sizeof(now), timeFormat, rtime) == 0) *now = '\0'; tickTime(now, heartbeat); if (lcd_hgt >= 4) { char tmp[40]; /* should be large enough */ machine_get_uptime(&uptime, &idle); /* display the uptime... */ days = (int) uptime / 86400; hour = ((int) uptime % 86400) / 3600; min = ((int) uptime % 3600) / 60; sec = ((int) uptime % 60); if (lcd_wid >= 20) sprintf(tmp, "Up %3d day%s %02d:%02d:%02d", days, ((days != 1) ? "s" : ""), hour, min, sec); else sprintf(tmp, "Up %dd %02d:%02d:%02d", days, hour, min, sec); xoffs = (lcd_wid > strlen(tmp)) ? ((lcd_wid - strlen(tmp)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set T one %i 2 {%s}\n", xoffs, tmp); /* display the date */ xoffs = (lcd_wid > strlen(today)) ? ((lcd_wid - strlen(today)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set T two %i 3 {%s}\n", xoffs, today); /* display the time & idle time... */ sprintf(tmp, "%s %3i%% idle", now, (int) idle); xoffs = (lcd_wid > strlen(tmp)) ? ((lcd_wid - strlen(tmp)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set T three %i 4 {%s}\n", xoffs, tmp); } else { /* 2 line version of the screen */ xoffs = (lcd_wid > (strlen(today) + strlen(now) + 1)) ? ((lcd_wid - ((strlen(today) + strlen(now) + 1))) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set T one %i 2 {%s %s}\n", xoffs, today, now); } return 0; } /* End time_screen() */
/** * OldTime Screen displays current time and date... * *\verbatim * * +--------------------+ +--------------------+ * |## DATE & TIME ####@| |### TIME: myhost ##@| * | myhost | |2005-05-17 11:32:57a| * |11:32:75a Wednesday,| +--------------------+ * | May 17, 2005 | * +--------------------+ * * Alternate 2-line version without the title bar: * * +----------------+ * | 2012-12-27 @| * | 15:07:01 | * +----------------+ * *\endverbatim * * \param rep Time since last screen update * \param display 1 if screen is visible or data should be updated * \param flags_ptr Mode flags * \return Always 0 */ int clock_screen(int rep, int display, int *flags_ptr) { char now[40]; char today[40]; int xoffs; static int heartbeat = 0; static int showTitle = 1; static const char *timeFormat = NULL; static const char *dateFormat = NULL; time_t thetime; struct tm *rtime; if ((*flags_ptr & INITIALIZED) == 0) { char tmp[257]; /* should be large enough for host name */ *flags_ptr |= INITIALIZED; /* get config values */ timeFormat = config_get_string("OldTime", "TimeFormat", 0, "%H:%M:%S"); dateFormat = config_get_string("OldTime", "DateFormat", 0, "%b %d %Y"); showTitle = config_get_bool("OldTime", "ShowTitle", 0, 1); sock_send_string(sock, "screen_add O\n"); sock_printf(sock, "screen_set O -name {Old Clock Screen: %s}\n", get_hostname()); if (!showTitle) sock_send_string(sock, "screen_set O -heartbeat off\n"); sock_send_string(sock, "widget_add O one string\n"); if (lcd_hgt >= 4) { sock_send_string(sock, "widget_add O title title\n"); sock_send_string(sock, "widget_add O two string\n"); sock_send_string(sock, "widget_add O three string\n"); sock_printf(sock, "widget_set O title {DATE & TIME}\n"); sprintf(tmp, "%s", get_hostname()); xoffs = (lcd_wid > strlen(tmp)) ? (((lcd_wid - strlen(tmp)) / 2) + 1) : 1; sock_printf(sock, "widget_set O one %i 2 {%s}\n", xoffs, tmp); } else { if (showTitle) { sock_send_string(sock, "widget_add O title title\n"); sock_printf(sock, "widget_set O title {TIME: %s}\n", get_hostname()); } else { sock_send_string(sock, "widget_add O two string\n"); } } } /* toggle colon display */ heartbeat ^= 1; time(&thetime); rtime = localtime(&thetime); if (strftime(today, sizeof(today), dateFormat, rtime) == 0) *today = '\0'; if (strftime(now, sizeof(now), timeFormat, rtime) == 0) *now = '\0'; tickTime(now, heartbeat); if (lcd_hgt >= 4) { /* 4-line version of the screen */ xoffs = (lcd_wid > strlen(today)) ? ((lcd_wid - strlen(today)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set O two %i 3 {%s}\n", xoffs, today); xoffs = (lcd_wid > strlen(now)) ? ((lcd_wid - strlen(now)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set O three %i 4 {%s}\n", xoffs, now); } else { /* 2-line version of the screen */ if (showTitle) { xoffs = (lcd_wid > (strlen(today) + strlen(now) + 1)) ? ((lcd_wid - ((strlen(today) + strlen(now) + 1))) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set O one %i 2 {%s %s}\n", xoffs, today, now); } else { xoffs = (lcd_wid > strlen(today)) ? ((lcd_wid - strlen(today)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set O one %i 1 {%s}\n", xoffs, today); xoffs = (lcd_wid > strlen(now)) ? ((lcd_wid - strlen(now)) / 2) + 1 : 1; if (display) sock_printf(sock, "widget_set O two %i 2 {%s}\n", xoffs, now); } } return 0; } /* End clock_screen() */
void MetaWindow::tick(qint64 time){ QTime tickTime(0, (time/60000)%60, (time/1000)%60); timeLabel->setText(tickTime.toString("mm:ss")); }
void PlaybackWidget::tick(qint64 time){ QTime tickTime(0, (time/60000)%60, (time/1000)%60); timeLabel->setText(tickTime.toString("mm:ss")); }