KPlayer – multimedia player with mplayer backend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2345 lines
98KB

  1. /***************************************************************************
  2. kplayer.cpp
  3. -----------
  4. begin : Sat Nov 16 10:12:50 EST 2002
  5. copyright : (C) 2002-2007 by kiriuja
  6. email : http://kplayer.sourceforge.net/email.html
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation, either version 3 of the License, or *
  12. * (at your option) any later version. *
  13. ***************************************************************************/
  14. #include <tdeaboutdata.h>
  15. #include <tdeapplication.h>
  16. #include <tdecmdlineargs.h>
  17. #include <kcursor.h>
  18. #include <kedittoolbar.h>
  19. #include <kkeydialog.h>
  20. #include <tdelocale.h>
  21. #include <tdemenubar.h>
  22. #include <kstatusbar.h>
  23. #include <kstdaction.h>
  24. #include <kurl.h>
  25. #include <kurldrag.h>
  26. #include <twin.h>
  27. #include <tqdatetime.h>
  28. #include <tqdockarea.h>
  29. #include <tqeventloop.h>
  30. #include <tqfocusdata.h>
  31. #include <tqobjectlist.h>
  32. #include <tqwhatsthis.h>
  33. #ifdef DEBUG
  34. #define DEBUG_KPLAYER_WINDOW
  35. //#define DEBUG_KPLAYER_RESIZING
  36. //#define DEBUG_KPLAYER_SIZING_HACKS
  37. //#define DEBUG_KPLAYER_NOTIFY_KEY
  38. //#define DEBUG_KPLAYER_NOTIFY_MOUSE
  39. //#define DEBUG_KPLAYER_NOTIFY_DRAG
  40. #endif
  41. #include "kplayer.h"
  42. #include "kplayer.moc"
  43. #include "kplayerlogwindow.h"
  44. #include "kplayernodeaction.h"
  45. #include "kplayernodeview.h"
  46. #include "kplayerplaylist.h"
  47. #include "kplayersettings.h"
  48. #include "kplayersettingsdialog.h"
  49. #include "kplayerslideraction.h"
  50. #include "kplayerwidget.h"
  51. //void KPlayerX11SetInputFocus (uint id);
  52. void KPlayerX11DiscardConfigureEvents (uint id);
  53. void KPlayerX11GetKeyboardMouseState (uint id);
  54. //void KPlayerX11SendConfigureEvent (uint id, int x, int y, int w, int h);
  55. #define ID_STATUS_MSG 1
  56. #define ID_STATE_MSG 2
  57. #define ID_PROGRESS_MSG 3
  58. TQString resourcePath (const TQString& filename);
  59. extern TDEAboutData* about;
  60. KPlayerApplication::KPlayerApplication (void)
  61. : KUniqueApplication (true, true, true)
  62. {
  63. }
  64. KPlayerApplication::~KPlayerApplication()
  65. {
  66. delete about;
  67. }
  68. int KPlayerApplication::newInstance (void)
  69. {
  70. #ifdef DEBUG_KPLAYER_WINDOW
  71. kdDebugTime() << "New instance\n";
  72. #endif
  73. KPlayer* mainWindow = (KPlayer*) mainWidget();
  74. if ( ! mainWindow )
  75. {
  76. #ifdef DEBUG_KPLAYER_WINDOW
  77. kdDebugTime() << "Creating main window\n";
  78. #endif
  79. mainWindow = new KPlayer();
  80. /*if ( isRestored() && TDEMainWindow::canBeRestored (1) )
  81. {
  82. #ifdef DEBUG_KPLAYER_WINDOW
  83. kdDebugTime() << "Restoring main window\n";
  84. #endif
  85. mainWindow -> restore (1);
  86. }*/
  87. setMainWidget (mainWindow);
  88. }
  89. mainWindow -> start();
  90. about -> setLicenseTextFile (resourcePath ("COPYING"));
  91. return 0;
  92. }
  93. bool KPlayerApplication::notify (TQObject* object, TQEvent* event)
  94. {
  95. static bool overridden = false;
  96. if ( kPlayerEngine() && kPlayerSettings() && event )
  97. {
  98. switch ( event -> type() )
  99. {
  100. case TQEvent::AccelOverride:
  101. {
  102. TQKeyEvent* kevent = (TQKeyEvent*) event;
  103. #ifdef DEBUG_KPLAYER_NOTIFY_KEY
  104. kdDebugTime() << "KPlayerApplication::notify: event type AccelOverride"
  105. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  106. << " key " << kevent -> key() << " ascii " << kevent -> ascii() << " text " << kevent -> text()
  107. << " count " << kevent -> count() << " state " << kevent -> state() << " after " << kevent -> stateAfter()
  108. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  109. #endif
  110. bool result = KUniqueApplication::notify (object, event);
  111. overridden = kevent -> isAccepted();
  112. return result;
  113. }
  114. #ifdef DEBUG_KPLAYER_NOTIFY_KEY
  115. case TQEvent::KeyPress:
  116. case TQEvent::KeyRelease:
  117. {
  118. TQKeyEvent* kevent = (TQKeyEvent*) event;
  119. /*if ( event -> spontaneous() )
  120. {
  121. kPlayerSettings() -> setControl (kevent -> stateAfter() & TQt::ControlButton);
  122. kPlayerSettings() -> setShift (kevent -> stateAfter() & TQt::ShiftButton);
  123. }*/
  124. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  125. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  126. << " key " << kevent -> key() << " ascii " << kevent -> ascii() << " text " << kevent -> text()
  127. << " count " << kevent -> count() << " state " << kevent -> state() << " after " << kevent -> stateAfter()
  128. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  129. }
  130. break;
  131. #endif
  132. case TQEvent::Accel:
  133. {
  134. TQKeyEvent* kevent = (TQKeyEvent*) event;
  135. //kPlayerSettings() -> setControl (kevent -> stateAfter() & TQt::ControlButton);
  136. //kPlayerSettings() -> setShift (kevent -> stateAfter() & TQt::ShiftButton);
  137. #ifdef DEBUG_KPLAYER_NOTIFY_KEY
  138. kdDebugTime() << "KPlayerApplication::notify: event type Accel"
  139. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  140. << " key " << kevent -> key() << " ascii " << kevent -> ascii() << " text " << kevent -> text()
  141. << " count " << kevent -> count() << " state " << kevent -> state() << " after " << kevent -> stateAfter()
  142. << " accepted " << kevent -> isAccepted() << " overridden " << overridden << " autorepeat " << kevent -> isAutoRepeat()
  143. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  144. #endif
  145. if ( ! overridden &&
  146. (kevent -> state() & (TQt::ShiftButton | TQt::ControlButton)) == (TQt::ShiftButton | TQt::ControlButton)
  147. && (kevent -> key() >= TQt::Key_Exclam && kevent -> key() <= TQt::Key_Ampersand
  148. || kevent -> key() >= TQt::Key_ParenLeft && kevent -> key() <= TQt::Key_Plus
  149. || kevent -> key() == TQt::Key_Colon || kevent -> key() == TQt::Key_Less
  150. || kevent -> key() >= TQt::Key_Greater && kevent -> key() <= TQt::Key_At
  151. || kevent -> key() == TQt::Key_AsciiCircum || kevent -> key() == TQt::Key_Underscore
  152. || kevent -> key() >= TQt::Key_BraceLeft && kevent -> key() <= TQt::Key_AsciiTilde) )
  153. {
  154. int key;
  155. switch ( kevent -> key() )
  156. {
  157. case TQt::Key_Exclam:
  158. key = TQt::Key_1;
  159. break;
  160. case TQt::Key_QuoteDbl:
  161. key = TQt::Key_Apostrophe;
  162. break;
  163. case TQt::Key_NumberSign:
  164. key = TQt::Key_3;
  165. break;
  166. case TQt::Key_Dollar:
  167. key = TQt::Key_4;
  168. break;
  169. case TQt::Key_Percent:
  170. key = TQt::Key_5;
  171. break;
  172. case TQt::Key_Ampersand:
  173. key = TQt::Key_7;
  174. break;
  175. case TQt::Key_ParenLeft:
  176. key = TQt::Key_BracketLeft;
  177. break;
  178. case TQt::Key_ParenRight:
  179. key = TQt::Key_BracketRight;
  180. break;
  181. case TQt::Key_Asterisk:
  182. key = TQt::Key_8;
  183. break;
  184. case TQt::Key_Plus:
  185. key = TQt::Key_Equal;
  186. break;
  187. case TQt::Key_Colon:
  188. key = TQt::Key_Semicolon;
  189. break;
  190. case TQt::Key_Less:
  191. key = TQt::Key_Comma;
  192. break;
  193. case TQt::Key_Greater:
  194. key = TQt::Key_Period;
  195. break;
  196. case TQt::Key_Question:
  197. key = TQt::Key_Slash;
  198. break;
  199. case TQt::Key_At:
  200. key = TQt::Key_2;
  201. break;
  202. case TQt::Key_AsciiCircum:
  203. key = TQt::Key_6;
  204. break;
  205. case TQt::Key_Underscore:
  206. key = TQt::Key_Minus;
  207. break;
  208. case TQt::Key_BraceLeft:
  209. key = TQt::Key_BracketLeft;
  210. break;
  211. case TQt::Key_Bar:
  212. key = TQt::Key_Backslash;
  213. break;
  214. case TQt::Key_BraceRight:
  215. key = TQt::Key_BracketRight;
  216. break;
  217. case TQt::Key_AsciiTilde:
  218. key = TQt::Key_QuoteLeft;
  219. break;
  220. default:
  221. key = kevent -> key();
  222. }
  223. TQKeyEvent keyevent (kevent -> type(), key, kevent -> ascii() == kevent -> key() ? key : kevent -> ascii(),
  224. kevent -> state() & ~ TQt::ShiftButton, kevent -> text(), kevent -> isAutoRepeat(), kevent -> count());
  225. if ( kevent -> isAccepted() )
  226. keyevent.accept();
  227. else
  228. keyevent.ignore();
  229. #ifdef DEBUG_KPLAYER_NOTIFY_KEY
  230. kdDebugTime() << "KPlayerApplication::notify: passing keyboard event " << keyevent.type()
  231. << " spontaneous " << keyevent.spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  232. << " key " << keyevent.key() << " ascii " << keyevent.ascii() << " text " << keyevent.text()
  233. << " count " << keyevent.count() << " state " << keyevent.state() << " after " << keyevent.stateAfter()
  234. << " accepted " << keyevent.isAccepted() << " autorepeat " << keyevent.isAutoRepeat()
  235. << " shift " << kPlayerSettings() -> shift() << "\n";
  236. #endif
  237. return KUniqueApplication::notify (object, &keyevent);
  238. }
  239. }
  240. break;
  241. case TQEvent::MouseButtonDblClick:
  242. case TQEvent::MouseButtonPress:
  243. case TQEvent::MouseButtonRelease:
  244. kPlayerSettings() -> setControl (((TQMouseEvent*) event) -> stateAfter() & TQt::ControlButton);
  245. kPlayerSettings() -> setShift (((TQMouseEvent*) event) -> stateAfter() & TQt::ShiftButton);
  246. #ifdef DEBUG_KPLAYER_NOTIFY_MOUSE
  247. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  248. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  249. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  250. #endif
  251. break;
  252. case TQEvent::MouseMove:
  253. {
  254. TQMouseEvent* mevent = ((TQMouseEvent*) event);
  255. if ( ((mevent -> stateAfter() & TQt::ControlButton) == TQt::ControlButton) != kPlayerSettings() -> anyControl()
  256. || ((mevent -> stateAfter() & TQt::ShiftButton) == TQt::ShiftButton) != kPlayerSettings() -> anyShift() )
  257. {
  258. int state = mevent -> state() & ~ (TQt::ControlButton | TQt::ShiftButton);
  259. if ( kPlayerSettings() -> anyControl() )
  260. state |= TQt::ControlButton;
  261. if ( kPlayerSettings() -> anyShift() )
  262. state |= TQt::ShiftButton;
  263. TQMouseEvent mouseevent (TQEvent::MouseMove, mevent -> pos(), mevent -> button(), state);
  264. if ( mevent -> isAccepted() )
  265. mouseevent.accept();
  266. else
  267. mouseevent.ignore();
  268. return KUniqueApplication::notify (object, &mouseevent);
  269. }
  270. kPlayerSettings() -> setControl (mevent -> stateAfter() & TQt::ControlButton);
  271. kPlayerSettings() -> setShift (mevent -> stateAfter() & TQt::ShiftButton);
  272. #ifdef DEBUG_KPLAYER_NOTIFY_MOUSE
  273. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  274. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  275. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  276. #endif
  277. }
  278. break;
  279. case TQEvent::Wheel:
  280. kPlayerSettings() -> setControl (((TQWheelEvent*) event) -> state() & TQt::ControlButton);
  281. kPlayerSettings() -> setShift (((TQWheelEvent*) event) -> state() & TQt::ShiftButton);
  282. #ifdef DEBUG_KPLAYER_NOTIFY_WHEEL
  283. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  284. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  285. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  286. #endif
  287. break;
  288. #ifdef DEBUG_KPLAYER_NOTIFY_MENU
  289. case TQEvent::ContextMenu:
  290. //kPlayerSettings() -> setControl (((TQContextMenuEvent*) event) -> state() & TQt::ControlButton);
  291. //kPlayerSettings() -> setShift (((TQContextMenuEvent*) event) -> state() & TQt::ShiftButton);
  292. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  293. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  294. << " control " << kPlayerSettings() -> control() << " shift " << kPlayerSettings() -> shift() << "\n";
  295. break;
  296. #endif
  297. #ifdef DEBUG_KPLAYER_NOTIFY_DRAG
  298. case TQEvent::DragEnter:
  299. case TQEvent::DragMove:
  300. case TQEvent::Drop:
  301. {
  302. TQDropEvent* devent = (TQDropEvent*) event;
  303. kdDebugTime() << "KPlayerApplication::notify: event type " << event -> type()
  304. << " spontaneous " << event -> spontaneous() << " receiver " << (object ? object -> className() : "<none>")
  305. << " accepted " << devent -> isAccepted() << " action " << devent -> action()
  306. << " accepted " << devent -> isActionAccepted() << "\n";
  307. }
  308. break;
  309. #endif
  310. #ifdef DEBUG_KPLAYER_NOTIFY_DRAG
  311. case TQEvent::DragResponse:
  312. kdDebugTime() << "KPlayerApplication::notify: event type DragResponse spontaneous " << event -> spontaneous()
  313. << " receiver " << (object ? object -> className() : "<none>")
  314. << " accepted " << ((TQDragResponseEvent*) event) -> dragAccepted() << "\n";
  315. break;
  316. case TQEvent::DragLeave:
  317. kdDebugTime() << "KPlayerApplication::notify: event type DragLeave spontaneous " << event -> spontaneous()
  318. << " receiver " << (object ? object -> className() : "<none>") << "\n";
  319. break;
  320. #endif
  321. #ifdef DEBUG_KPLAYER_NOTIFY_RESIZE
  322. case TQEvent::Resize:
  323. if ( object == mainWidget() )
  324. {
  325. TQResizeEvent* revent = (TQResizeEvent*) event;
  326. kdDebugTime() << "KPlayerApplication::notify: Main window resize to " << revent -> size().width() << "x" << revent -> size().height() << "\n";
  327. }
  328. #endif
  329. default:
  330. break;
  331. }
  332. }
  333. return KUniqueApplication::notify (object, event);
  334. }
  335. /*int KPlayerApplication::x11ClientMessage (TQWidget* widget, XEvent* event, bool passive_only)
  336. {
  337. TDEApplication::x11ClientMessage (widget, event, passive_only);
  338. }*/
  339. #ifdef DEBUG_KPLAYER_RESIZING
  340. void dumpObject (const TQObject* object, int indent, int depth = 20)
  341. {
  342. TQString spaces;
  343. for ( int i = 0; i < indent * 2; i ++ )
  344. spaces += " ";
  345. if ( object -> inherits ("TQWidget") )
  346. {
  347. TQWidget* widget = (TQWidget*) object;
  348. kdDebugTime() << spaces << object -> className() << " " << object -> name ("<unnamed>") <<
  349. " " << widget -> winId() <<
  350. " " << widget -> minimumSize().width() << "x" << widget -> minimumSize().height() <<
  351. " " << widget -> minimumSizeHint().width() << "x" << widget -> minimumSizeHint().height() <<
  352. " " << widget -> sizeHint().width() << "x" << widget -> sizeHint().height() <<
  353. " " << widget -> geometry().x() << "x" << widget -> geometry().y() <<
  354. " " << widget -> geometry().width() << "x" << widget -> geometry().height() <<
  355. " " << widget -> frameGeometry().x() << "x" << widget -> frameGeometry().y() <<
  356. " " << widget -> frameGeometry().width() << "x" << widget -> frameGeometry().height() << "\n";
  357. }
  358. else if ( object -> inherits ("TQLayout") )
  359. {
  360. TQLayout* layout = (TQLayout*) object;
  361. kdDebugTime() << spaces << object -> className() << " " << object -> name ("<unnamed>") <<
  362. " " << layout -> minimumSize().width() << "x" << layout -> minimumSize().height() <<
  363. " " << layout -> sizeHint().width() << "x" << layout -> sizeHint().height() <<
  364. " " << layout -> geometry().width() << "x" << layout -> geometry().height() <<
  365. " " << layout -> margin() << "+" << layout -> spacing() <<
  366. " " << layout -> alignment() << " " << layout -> expanding() <<
  367. " " << layout -> hasHeightForWidth() << " " << layout -> heightForWidth (1) << "\n";
  368. }
  369. else
  370. kdDebugTime() << spaces << object -> className() << " " << object -> name ("<unnamed>") << "\n";
  371. indent ++;
  372. TQObjectList* objectlist = (TQObjectList*) object -> children();
  373. if ( objectlist && depth -- > 0 )
  374. for ( object = objectlist -> first(); object; object = objectlist -> next() )
  375. if ( object )
  376. dumpObject (object, indent, depth);
  377. }
  378. #endif
  379. KPlayer::KPlayer (TQWidget *parent, const char *name) : TDEMainWindow (parent, name)
  380. {
  381. #ifdef DEBUG_KPLAYER_WINDOW
  382. kdDebugTime() << "Creating main window\n";
  383. #endif
  384. m_status_label = m_state_label = m_progress_label = 0;
  385. m_menubar_normally_visible = m_statusbar_normally_visible = true;
  386. m_menubar_fullscreen_visible = m_statusbar_fullscreen_visible = false;
  387. m_messagelog_normally_visible = m_messagelog_fullscreen_visible = false;
  388. m_library_normally_visible = m_library_fullscreen_visible = false;
  389. m_set_display_size = m_initial_show = m_error_detected = m_maximized = false;
  390. m_full_screen = m_show_log = m_show_library = false;
  391. Toolbar toolbars [KPLAYER_TOOLBARS] = {
  392. { "mainToolBar", KStdAction::stdName (KStdAction::ShowToolbar), true, false },
  393. { "playlistToolBar", "options_show_playlist", true, false },
  394. { "progressToolBar", "settings_progress_toolbar", true, false },
  395. { "volumeToolBar", "settings_volume_toolbar", false, false },
  396. { "contrastToolBar", "settings_contrast_toolbar", false, false },
  397. { "brightnessToolBar", "settings_brightness_toolbar", false, false },
  398. { "hueToolBar", "settings_hue_toolbar", false, false },
  399. { "saturationToolBar", "settings_saturation_toolbar", false, false }
  400. };
  401. TQString captions [KPLAYER_TOOLBARS] = {
  402. i18n("Main Toolbar"),
  403. i18n("Playlist"),
  404. i18n("Progress"),
  405. i18n("Volume"),
  406. i18n("Contrast"),
  407. i18n("Brightness"),
  408. i18n("Hue"),
  409. i18n("Saturation")
  410. };
  411. const char* actions [KPLAYER_TOOLBARS - FIRST_SLIDER_TOOLBAR] = {
  412. "player_progress",
  413. "audio_volume",
  414. "video_contrast",
  415. "video_brightness",
  416. "video_hue",
  417. "video_saturation"
  418. };
  419. TQString whatsthis [KPLAYER_TOOLBARS] = {
  420. i18n("Main toolbar contains buttons for commonly used operations. Left clicking an icon will activate the corresponding action. Some of the buttons will pop up slider controls when clicked. The sliders let you change various player controls: sound volume, video contrast, brightness, hue and saturation. The video controls will only be available for video files."),
  421. i18n("Playlist toolbar shows the multimedia title currently loaded or being played, offers commands to go to the next or previous items on the playlist, and also lets you see the entire playlist that consists of items that are currently being played or have been played recently. If you select a different item from the list, KPlayer will load and start playing it. The toolbar also contains options to loop and shuffle the playlist."),
  422. i18n("Progress and seeking toolbar is shown when the time length of a media file is known. It displays the playback progress and also allows seeking, that is, moving the playback point back and forth within the file. To seek to a specific position, drag the slider thumb to that position with the left mouse button, or simply click at that position with the middle mouse button. To move forward or backward in steps, left click the slider to the left or right of the thumb, or click the Forward and Backward buttons."),
  423. i18n("Volume toolbar has a volume slider that shows the current sound volume and allows you to change it. This is the same slider you get from the volume pop-up slider button on the main toolbar, but it will not disappear when you click elsewhere. You can show or hide the toolbar using the Show Volume Toolbar option on the Settings menu. Clicking the Volume button on this toolbar will also hide it. In addition the toolbar has a Mute button that turns the sound off and back on."),
  424. i18n("Contrast toolbar has a contrast slider that shows the current video contrast and allows you to change it. This is the same slider you get from the contrast pop-up slider button on the main toolbar, but it will not disappear when you click elsewhere. You can show or hide the toolbar using the Show Contrast Toolbar option on the Settings menu. Clicking the Contrast button on this toolbar will also hide it."),
  425. i18n("Brightness toolbar has a brightness slider that shows the current video brightness and allows you to change it. This is the same slider you get from the brightness pop-up slider button on the main toolbar, but it will not disappear when you click elsewhere. You can show or hide the toolbar using the Show Brightness Toolbar option on the Settings menu. Clicking the Brightness button on this toolbar will also hide it."),
  426. i18n("Hue toolbar has a hue slider that shows the current video hue and allows you to change it. This is the same slider you get from the hue pop-up slider button on the main toolbar, but it will not disappear when you click elsewhere. You can show or hide the toolbar using the Show Hue Toolbar option on the Settings menu. Clicking the Hue button on this toolbar will also hide it."),
  427. i18n("Saturation toolbar has a saturation slider that shows the current video saturation and allows you to change it. This is the same slider you get from the saturation pop-up slider button on the main toolbar, but it will not disappear when you click elsewhere. You can show or hide the toolbar using the Show Saturation Toolbar option on the Settings menu. Clicking the Saturation button on this toolbar will also hide it.")
  428. };
  429. KPlayerEngine::initialize (actionCollection(), this, 0, kapp -> config());
  430. connect (engine(), SIGNAL (windowStateChanged (uint)), SLOT (windowStateChanged (uint)));
  431. connect (engine(), SIGNAL (syncronize (bool)), SLOT (syncronize (bool)));
  432. connect (engine(), SIGNAL (zoom()), SLOT (zoom()));
  433. connect (engine(), SIGNAL (correctSize()), SLOT (correctSize()));
  434. connect (engine(), SIGNAL (initialSize()), SLOT (initialSize()));
  435. connect (engine() -> videoActionList(), SIGNAL (updating (KPlayerActionList*)),
  436. SLOT (actionListUpdating (KPlayerActionList*)));
  437. connect (engine() -> videoActionList(), SIGNAL (updated (KPlayerActionList*)),
  438. SLOT (actionListUpdated (KPlayerActionList*)));
  439. connect (engine() -> audioActionList(), SIGNAL (updating (KPlayerActionList*)),
  440. SLOT (actionListUpdating (KPlayerActionList*)));
  441. connect (engine() -> audioActionList(), SIGNAL (updated (KPlayerActionList*)),
  442. SLOT (actionListUpdated (KPlayerActionList*)));
  443. connect (engine() -> subtitleActionList(), SIGNAL (updating (KPlayerActionList*)),
  444. SLOT (actionListUpdating (KPlayerActionList*)));
  445. connect (engine() -> subtitleActionList(), SIGNAL (updated (KPlayerActionList*)),
  446. SLOT (actionListUpdated (KPlayerActionList*)));
  447. TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs();
  448. if ( args -> count() > 0 && (args -> isSet ("play") || args -> isSet ("play-next")
  449. || ! args -> isSet ("queue") && ! args -> isSet ("queue-next") && ! args -> isSet ("add-to-new-playlist")
  450. && ! args -> isSet ("add-to-playlists") && ! args -> isSet ("add-to-collection")) )
  451. engine() -> clearStoreSections ("kplayer:/nowplaying");
  452. m_log = new KPlayerLogWindow (actionCollection(), this);
  453. connect (log(), SIGNAL (windowHidden()), SLOT (logWindowHidden()));
  454. connect (action ("log_clear"), SIGNAL (activated()), SLOT (fileClearLog()));
  455. m_library = new KPlayerLibraryWindow (actionCollection(), this);
  456. connect (library(), SIGNAL (windowHidden()), SLOT (libraryHidden()));
  457. connect (library() -> library(), SIGNAL (makeVisible()), SLOT (makeLibraryVisible()));
  458. connect (library() -> library(), SIGNAL (enableActionGroup (const TQString&, bool)),
  459. SLOT (enableSubmenu (const TQString&, bool)));
  460. connect (library() -> library() -> playlistActionList(), SIGNAL (updating (KPlayerActionList*)),
  461. SLOT (actionListUpdating (KPlayerActionList*)));
  462. connect (library() -> library() -> playlistActionList(), SIGNAL (updated (KPlayerActionList*)),
  463. SLOT (actionListUpdated (KPlayerActionList*)));
  464. connect (library() -> library() -> columnActionList(), SIGNAL (updating (KPlayerActionList*)),
  465. SLOT (actionListUpdating (KPlayerActionList*)));
  466. connect (library() -> library() -> columnActionList(), SIGNAL (updated (KPlayerActionList*)),
  467. SLOT (libraryActionListUpdated (KPlayerActionList*)));
  468. connect (library() -> library() -> editActionList(), SIGNAL (updating (KPlayerActionList*)),
  469. SLOT (actionListUpdating (KPlayerActionList*)));
  470. connect (library() -> library() -> editActionList(), SIGNAL (updated (KPlayerActionList*)),
  471. SLOT (libraryActionListUpdated (KPlayerActionList*)));
  472. connect (library() -> library() -> goToActionList(), SIGNAL (updating (KPlayerActionList*)),
  473. SLOT (actionListUpdating (KPlayerActionList*)));
  474. connect (library() -> library() -> goToActionList(), SIGNAL (updated (KPlayerActionList*)),
  475. SLOT (actionListUpdated (KPlayerActionList*)));
  476. connect (library() -> library() -> historyActionList(), SIGNAL (updating (KPlayerActionList*)),
  477. SLOT (actionListUpdating (KPlayerActionList*)));
  478. connect (library() -> library() -> historyActionList(), SIGNAL (updated (KPlayerActionList*)),
  479. SLOT (actionListUpdated (KPlayerActionList*)));
  480. m_playlist = new KPlayerPlaylist (actionCollection(), this);
  481. connect (playlist(), SIGNAL (started()), SLOT (playlistStarted()));
  482. connect (playlist(), SIGNAL (activated()), SLOT (playlistActivated()));
  483. connect (playlist(), SIGNAL (stopped()), SLOT (playlistStopped()));
  484. connect (playlist(), SIGNAL (enableActionGroup (const TQString&, bool)), SLOT (enableSubmenu (const TQString&, bool)));
  485. connect (playlist() -> playlistActionList(), SIGNAL (updating (KPlayerActionList*)),
  486. SLOT (actionListUpdating (KPlayerActionList*)));
  487. connect (playlist() -> playlistActionList(), SIGNAL (updated (KPlayerActionList*)),
  488. SLOT (actionListUpdated (KPlayerActionList*)));
  489. connect (playlist() -> recentActionList(), SIGNAL (updating (KPlayerActionList*)),
  490. SLOT (actionListUpdating (KPlayerActionList*)));
  491. connect (playlist() -> recentActionList(), SIGNAL (updated (KPlayerActionList*)),
  492. SLOT (actionListUpdated (KPlayerActionList*)));
  493. connect (playlist() -> devicesActionList(), SIGNAL (updating (KPlayerActionList*)),
  494. SLOT (actionListUpdating (KPlayerActionList*)));
  495. connect (playlist() -> devicesActionList(), SIGNAL (updated (KPlayerActionList*)),
  496. SLOT (actionListUpdated (KPlayerActionList*)));
  497. connect (playlist() -> playlistAddActionList(), SIGNAL (updating (KPlayerActionList*)),
  498. SLOT (actionListUpdating (KPlayerActionList*)));
  499. connect (playlist() -> playlistAddActionList(), SIGNAL (updated (KPlayerActionList*)),
  500. SLOT (actionListUpdated (KPlayerActionList*)));
  501. connect (actionCollection(), SIGNAL (actionStatusText(const TQString&)), SLOT (setStatusMessage(const TQString&)));
  502. connect (actionCollection(), SIGNAL (clearStatusText()), SLOT (clearStatusMessage()));
  503. actionCollection() -> setHighlightingEnabled (true);
  504. connect (process(), SIGNAL (stateChanged(KPlayerProcess::State, KPlayerProcess::State)),
  505. SLOT (playerStateChanged(KPlayerProcess::State, KPlayerProcess::State)));
  506. connect (process(), SIGNAL (progressChanged(float, KPlayerProcess::ProgressType)),
  507. SLOT (playerProgressChanged(float, KPlayerProcess::ProgressType)));
  508. connect (process(), SIGNAL (infoAvailable()), SLOT (playerInfoAvailable()));
  509. connect (process(), SIGNAL (sizeAvailable()), SLOT (playerSizeAvailable()));
  510. connect (process(), SIGNAL (messageReceived (TQString)), SLOT (playerMessageReceived (TQString)));
  511. connect (process(), SIGNAL (errorDetected()), SLOT (playerErrorDetected()));
  512. connect (configuration(), SIGNAL (updated()), SLOT (refreshSettings()));
  513. connect (kPlayerWorkspace(), SIGNAL (contextMenu(const TQPoint&)), SLOT (contextMenu(const TQPoint&)));
  514. setCentralWidget (kPlayerWorkspace());
  515. initStatusBar();
  516. initActions();
  517. log() -> initialize ((TQPopupMenu*) factory() -> container ("log_popup", this));
  518. playlist() -> initialize ((TQPopupMenu*) factory() -> container ("playlist_popup", this));
  519. library() -> library() -> initialize ((TQPopupMenu*) factory() -> container ("library_popup", this));
  520. uint i;
  521. for ( i = 0; i < menuBar() -> count(); i ++ )
  522. connect (popupMenu (i), SIGNAL (aboutToHide()), SLOT (clearStatusMessage()));
  523. for ( i = 0; i < KPLAYER_TOOLBARS; i ++ )
  524. m_toolbar[i] = toolbars[i];
  525. setAutoSaveSettings ("MainWindow", false);
  526. resetAutoSaveSettings(); // saveWindowSize = false;
  527. readOptions();
  528. TDEToolBar* toolbar = toolBar (m_toolbar[PLAYLIST_TOOLBAR].name);
  529. setDockEnabled (toolbar, DockLeft, false);
  530. setDockEnabled (toolbar, DockRight, false);
  531. setDockEnabled (library(), DockLeft, false);
  532. setDockEnabled (library(), DockRight, false);
  533. setDockEnabled (log(), DockLeft, false);
  534. setDockEnabled (log(), DockRight, false);
  535. TQWhatsThis::add (menuBar(), i18n("Menu bar contains names of drop-down menus. Left click a name to alternately show and hide that menu, or use Alt + the underlined letter in the name as a hot key, for example Alt+F to show the File menu."));
  536. TQWhatsThis::add (statusBar(), i18n("Status bar shows general information about the player status and progress."));
  537. TQWhatsThis::add (library(), i18n("Multimedia library is a window where that lets you organize your files, streams, devices, manage your playlists, and choose items for playing. It shows various information about your media files and allows you to search and group them and change their properties."));
  538. TQWhatsThis::add (log(), i18n("Message log is a window where KPlayer shows messages it receives from MPlayer. KPlayer can show it automatically when it detects an MPlayer error if that option is selected in KPlayer settings."));
  539. for ( i = 0; i < KPLAYER_TOOLBARS; i ++ )
  540. {
  541. toolbar = toolBar (m_toolbar[i].name);
  542. toolbar -> setCaption (captions[i]);
  543. TQWhatsThis::add (toolbar, whatsthis[i]);
  544. //kdDebugTime() << "Orientation " << sliderAction (m_toolbar[i].action) -> slider() -> orientation() << "\n";
  545. if ( i >= FIRST_SLIDER_TOOLBAR )
  546. ((KPlayerSliderAction*) action (actions [i - FIRST_SLIDER_TOOLBAR])) -> slider() -> setOrientation (toolbar -> orientation());
  547. }
  548. if ( settings() -> maximized() )
  549. showMaximized();
  550. enablePlayerActions();
  551. enableVideoActions();
  552. setEraseColor (TQColor (0, 0, 0));
  553. setAcceptDrops (true);
  554. //layout() -> setResizeMode (TQLayout::FreeResize);
  555. //KWin::setState (log() -> winId(), NET::SkipTaskbar | NET::SkipPager);
  556. setFocusPolicy (TQWidget::StrongFocus);
  557. setFocusProxy (kPlayerWorkspace() -> focusProxy());
  558. }
  559. void KPlayer::initActions (void)
  560. {
  561. #ifdef DEBUG_KPLAYER_WINDOW
  562. kdDebugTime() << "Creating actions\n";
  563. #endif
  564. TDEAction* action = KStdAction::quit (this, SLOT (fileQuit()), actionCollection());
  565. action -> setStatusText (i18n("Quits KPlayer"));
  566. action -> setWhatsThis (i18n("Quit command saves the playlist and all settings, stops playing and closes KPlayer."));
  567. action = KStdAction::showMenubar (this, SLOT (viewMenubar()), actionCollection());
  568. action -> setStatusText (i18n("Shows/hides the menu bar"));
  569. action -> setWhatsThis (i18n("Show Menubar command shows or hides the menu bar."));
  570. action = KStdAction::showStatusbar (this, SLOT (viewStatusbar()), actionCollection());
  571. action -> setStatusText (i18n("Shows/hides the status bar"));
  572. action -> setWhatsThis (i18n("Show Statusbar command shows or hides the status bar."));
  573. action = new TDEToggleAction (i18n("&Show Playlist"), 0, CTRL + Key_P, this, SLOT (viewPlaylist()), actionCollection(), "options_show_playlist");
  574. action -> setStatusText (i18n("Shows/hides the playlist"));
  575. action -> setWhatsThis (i18n("Show Playlist command shows or hides the playlist toolbar."));
  576. action = new TDEToggleAction (i18n("Sho&w Library"), 0, CTRL + Key_L, this, SLOT (viewLibrary()), actionCollection(), "options_show_library");
  577. action -> setStatusText (i18n("Shows/hides the multimedia library"));
  578. action -> setWhatsThis (i18n("Show Library command shows or hides the multimedia library."));
  579. action = new TDEToggleAction (i18n("Show Message &Log"), 0, CTRL + Key_G, this, SLOT (viewMessageLog()), actionCollection(), "options_show_log");
  580. action -> setStatusText (i18n("Shows/hides the message log"));
  581. action -> setWhatsThis (i18n("Show Message Log command shows or hides the message log."));
  582. action = new TDEToggleAction (i18n("Show Main &Toolbar"), 0, 0, this, SLOT (viewMainToolbar()), actionCollection(), "options_show_toolbar");
  583. action -> setStatusText (i18n("Shows/hides the main toolbar"));
  584. action -> setWhatsThis (i18n("Show Main Toolbar command shows or hides the main toolbar."));
  585. action = new TDEToggleAction (i18n("Show &Progress Toolbar"), 0, 0, this, SLOT (viewProgressToolbar()), actionCollection(), "settings_progress_toolbar");
  586. action -> setStatusText (i18n("Shows/hides the progress toolbar"));
  587. action -> setWhatsThis (i18n("Show Progress Toolbar command shows or hides the progress toolbar. This command is available when the time length of the current file is known."));
  588. action = new TDEToggleAction (i18n("Show &Volume Toolbar"), "volume", 0, this, SLOT (viewVolumeToolbar()), actionCollection(), "settings_volume_toolbar");
  589. action -> setStatusText (i18n("Shows/hides the volume toolbar"));
  590. action -> setWhatsThis (i18n("Show Volume Toolbar command shows or hides the volume toolbar."));
  591. action = new TDEToggleAction (i18n("Show C&ontrast Toolbar"), "contrast", 0, this, SLOT (viewContrastToolbar()), actionCollection(), "settings_contrast_toolbar");
  592. action -> setStatusText (i18n("Shows/hides the contrast toolbar"));
  593. action -> setWhatsThis (i18n("Show Contrast Toolbar command shows or hides the contrast toolbar. This command is available for video files."));
  594. action = new TDEToggleAction (i18n("Show &Brightness Toolbar"), "brightness", 0, this, SLOT (viewBrightnessToolbar()), actionCollection(), "settings_brightness_toolbar");
  595. action -> setStatusText (i18n("Shows/hides the brightness toolbar"));
  596. action -> setWhatsThis (i18n("Show Brightness Toolbar command shows or hides the brightness toolbar. This command is available for video files."));
  597. action = new TDEToggleAction (i18n("Show H&ue Toolbar"), "hue", 0, this, SLOT (viewHueToolbar()), actionCollection(), "settings_hue_toolbar");
  598. action -> setStatusText (i18n("Shows/hides the hue toolbar"));
  599. action -> setWhatsThis (i18n("Show Hue Toolbar command shows or hides the hue toolbar. This command is available for video files."));
  600. action = new TDEToggleAction (i18n("Show &Saturation Toolbar"), "saturation", 0, this, SLOT (viewSaturationToolbar()), actionCollection(), "settings_saturation_toolbar");
  601. action -> setStatusText (i18n("Shows/hides the saturation toolbar"));
  602. action -> setWhatsThis (i18n("Show Saturation Toolbar command shows or hides the saturation toolbar. This command is available for video files."));
  603. action = KStdAction::keyBindings (this, SLOT (settingsKeyBindings()), actionCollection());
  604. action -> setStatusText (i18n("Opens the KPlayer key bindings dialog"));
  605. action -> setWhatsThis (i18n("Configure Shortcuts command opens a dialog that lets you see and change KPlayer's shortcut key bindings, or associations between actions and the corresponding keys or combinations of keys that activate them. If you change the bindings, make sure not to duplicate an existing shortcut and also not to use the Shift key for your new shortcuts, because the Shift key has a special function in KPlayer."));
  606. action = KStdAction::configureToolbars (this, SLOT (settingsConfigureToolbars()), actionCollection());
  607. action -> setStatusText (i18n("Opens the KPlayer toolbar configuration dialog"));
  608. action -> setWhatsThis (i18n("Configure Toolbars command opens a dialog that lets you see and change KPlayer's toolbars and controls assigned to them."));
  609. action = KStdAction::preferences (this, SLOT (settingsConfigure()), actionCollection());
  610. action -> setStatusText (i18n("Opens the KPlayer configuration dialog"));
  611. action -> setWhatsThis (i18n("Configure KPlayer command opens a dialog that lets you configure the program, modifying various aspects of its functionality, user interface and interaction with MPlayer. For more information see the Configuration dialog chapter and the Advanced configuration micro-HOWTO in the user manual."));
  612. createGUI ("kplayerui.rc", false);
  613. action = actionCollection() -> action (KStdAction::stdName (KStdAction::ShowMenubar));
  614. if ( action )
  615. {
  616. action -> setStatusText (i18n("Shows/hides the menu bar"));
  617. action -> setWhatsThis (i18n("Show Menubar command shows or hides the menu bar."));
  618. }
  619. action = actionCollection() -> action (KStdAction::stdName (KStdAction::ShowStatusbar));
  620. if ( action )
  621. {
  622. action -> setStatusText (i18n("Shows/hides the status bar"));
  623. action -> setWhatsThis (i18n("Show Statusbar command shows or hides the status bar."));
  624. }
  625. action = actionCollection() -> action ("help_contents");
  626. if ( action )
  627. {
  628. action -> setStatusText (i18n("Opens the KPlayer user manual"));
  629. action -> setWhatsThis (i18n("KPlayer Handbook command opens and displays the KPlayer user manual."));
  630. }
  631. action = actionCollection() -> action ("help_whats_this");
  632. if ( action )
  633. {
  634. action -> setStatusText (i18n("Lets you click any part of KPlayer to get its description"));
  635. action -> setWhatsThis (i18n("What's This command changes the mouse pointer to a question mark and lets you click a KPlayer interface element to get a quick description of its purpose and functionality."));
  636. }
  637. action = actionCollection() -> action ("help_report_bug");
  638. if ( action )
  639. {
  640. disconnect (action, SIGNAL(activated()), 0, 0);
  641. connect (action, SIGNAL(activated()), SLOT(helpReportBug()));
  642. action -> setStatusText (i18n("Opens the manual section on bug reporting"));
  643. action -> setWhatsThis (i18n("Report Bug command opens the section of KPlayer user manual that explains how to report a bug in KPlayer, including all the information that may be helpful in finding and fixing the bug."));
  644. }
  645. action = actionCollection() -> action ("help_about_app");
  646. if ( action )
  647. {
  648. action -> setStatusText (i18n("Shows information about this version of KPlayer"));
  649. action -> setWhatsThis (i18n("About KPlayer command displays some brief information about KPlayer's version number, authors and license agreement."));
  650. }
  651. action = actionCollection() -> action ("help_about_kde");
  652. if ( action )
  653. {
  654. action -> setStatusText (i18n("Shows information about your TDE version"));
  655. action -> setWhatsThis (i18n("About TDE command shows some information about the version of TDE that you are running."));
  656. }
  657. }
  658. void KPlayer::initStatusBar (void)
  659. {
  660. statusBar() -> insertItem (i18n("Ready"), ID_STATUS_MSG, 1);
  661. statusBar() -> insertItem (i18n("Idle"), ID_STATE_MSG, 1, true);
  662. statusBar() -> insertItem ("", ID_PROGRESS_MSG, 1, true);
  663. TQObjectList* children = (TQObjectList*) statusBar() -> children();
  664. for ( uint i = 0; i < children -> count(); i ++ )
  665. {
  666. TQObject* child = children -> at (i);
  667. if ( child -> inherits ("KStatusBarLabel") )
  668. {
  669. KStatusBarLabel* label = (KStatusBarLabel*) child;
  670. if ( label -> text() == i18n("Ready") )
  671. m_status_label = label;
  672. else if ( label -> text() == i18n("Idle") )
  673. m_state_label = label;
  674. else if ( label -> text().isEmpty() )
  675. m_progress_label = label;
  676. }
  677. }
  678. statusBar() -> setMinimumHeight (statusBar() -> layout() -> minimumSize().height());
  679. if ( m_status_label )
  680. {
  681. connect (m_status_label, SIGNAL (itemPressed (int)), this, SLOT (statusPressed()));
  682. TQWhatsThis::add (m_status_label, i18n("Status area of the status bar tells you if there have been playback errors."));
  683. }
  684. if ( m_state_label )
  685. TQWhatsThis::add (m_state_label, i18n("State area of the status bar displays the current player state."));
  686. if ( m_progress_label )
  687. TQWhatsThis::add (m_progress_label, i18n("Progress area of the status bar shows playback progress and the total length if known."));
  688. }
  689. void KPlayer::refreshSettings (void)
  690. {
  691. #ifdef DEBUG_KPLAYER_WINDOW
  692. kdDebugTime() << "KPlayer::refreshSettings\n";
  693. #endif
  694. TQApplication::postEvent (this, new TQEvent (TQEvent::LayoutHint));
  695. //activateLayout();
  696. if ( ! settings() -> properties() -> url().isEmpty() )
  697. setCaption (settings() -> properties() -> caption());
  698. enableVideoActions();
  699. }
  700. void KPlayer::saveOptions (void)
  701. {
  702. #ifdef DEBUG_KPLAYER_WINDOW
  703. kdDebugTime() << "Saving options\n";
  704. #endif
  705. config() -> deleteGroup ("General Options");
  706. saveMainWindowSettings (config(), "General Options");
  707. config() -> setGroup ("General Options");
  708. TQt::Dock dock = DockTornOff;
  709. int index = 0, offset = 0;
  710. bool newline = true;
  711. bool docked = getLocation (log(), dock, index, newline, offset) &&
  712. (dock == DockTop || dock == DockBottom || dock == DockRight || dock == DockLeft);
  713. if ( docked )
  714. {
  715. config() -> writeEntry ("Message Log Dock", dock);
  716. config() -> writeEntry ("Message Log Index", index);
  717. config() -> writeEntry ("Message Log New Line", newline);
  718. config() -> writeEntry ("Message Log Offset", offset);
  719. #ifdef DEBUG_KPLAYER_WINDOW
  720. kdDebugTime() << "Log dock " << dock << " " << index << " " << newline << " " << offset << " " << log() -> x() << "x" << log() -> y() << " " << log() -> width() << "x" << log() -> height() << "\n";
  721. #endif
  722. }
  723. config() -> writeEntry ("Message Log Left", log() -> x());
  724. config() -> writeEntry ("Message Log Top", log() -> y());
  725. config() -> writeEntry ("Message Log Width", log() -> width());
  726. config() -> writeEntry ("Message Log Height", log() -> height());
  727. config() -> writeEntry ("Message Log Docked", docked);
  728. dock = DockTornOff;
  729. index = offset = 0;
  730. newline = true;
  731. docked = getLocation (library(), dock, index, newline, offset) &&
  732. (dock == DockTop || dock == DockBottom || dock == DockRight || dock == DockLeft);
  733. if ( docked )
  734. {
  735. config() -> writeEntry ("Playlist Dock", dock);
  736. config() -> writeEntry ("Playlist Index", index);
  737. config() -> writeEntry ("Playlist New Line", newline);
  738. config() -> writeEntry ("Playlist Offset", offset);
  739. #ifdef DEBUG_KPLAYER_WINDOW
  740. kdDebugTime() << "Library dock " << dock << " " << index << " " << newline << " " << offset << " " << library() -> x() << "x" << library() -> y() << " " << library() -> width() << "x" << library() -> height() << "\n";
  741. #endif
  742. }
  743. config() -> writeEntry ("Playlist Left", library() -> x());
  744. config() -> writeEntry ("Playlist Top", library() -> y());
  745. config() -> writeEntry ("Playlist Width", library() -> width());
  746. config() -> writeEntry ("Playlist Height", library() -> height());
  747. config() -> writeEntry ("Playlist Docked", docked);
  748. if ( ! m_full_screen && ! isMaximized() )
  749. {
  750. config() -> writeEntry ("Main Window Left", x());
  751. config() -> writeEntry ("Main Window Top", y());
  752. config() -> writeEntry ("Main Window Width", width());
  753. config() -> writeEntry ("Main Window Height", height());
  754. }
  755. else
  756. {
  757. config() -> writeEntry ("Main Window Left", m_normal_geometry.x());
  758. config() -> writeEntry ("Main Window Top", m_normal_geometry.y());
  759. config() -> writeEntry ("Main Window Width", m_normal_geometry.width());
  760. config() -> writeEntry ("Main Window Height", m_normal_geometry.height());
  761. }
  762. config() -> writeEntry ("Menu Bar Normally Visible", m_menubar_normally_visible);
  763. config() -> writeEntry ("Menu Bar FullScreen Visible", m_menubar_fullscreen_visible);
  764. config() -> writeEntry ("Status Bar Normally Visible", m_statusbar_normally_visible);
  765. config() -> writeEntry ("Status Bar FullScreen Visible", m_statusbar_fullscreen_visible);
  766. config() -> writeEntry ("Message Log Normally Visible", m_messagelog_normally_visible);
  767. config() -> writeEntry ("Message Log FullScreen Visible", m_messagelog_fullscreen_visible);
  768. config() -> writeEntry ("Playlist Editor Normally Visible", m_library_normally_visible);
  769. config() -> writeEntry ("Playlist Editor FullScreen Visible", m_library_fullscreen_visible);
  770. for ( int i = 0; i < KPLAYER_TOOLBARS; i ++ )
  771. {
  772. config() -> writeEntry (TQString (m_toolbar[i].name) + " Normally Visible", m_toolbar[i].normally_visible);
  773. config() -> writeEntry (TQString (m_toolbar[i].name) + " FullScreen Visible", m_toolbar[i].fullscreen_visible);
  774. }
  775. }
  776. void KPlayer::readOptions (void)
  777. {
  778. #ifdef DEBUG_KPLAYER_WINDOW
  779. kdDebugTime() << "Reading options\n";
  780. #endif
  781. applyMainWindowSettings (config(), "General Options");
  782. config() -> setGroup ("General Options");
  783. TQRect available (availableGeometry());
  784. int width = config() -> readNumEntry ("Main Window Width", 500);
  785. if ( width > available.width() )
  786. width = available.width();
  787. int height = config() -> readNumEntry ("Main Window Height", 350);
  788. if ( height > available.height() )
  789. height = available.height();
  790. int x = config() -> readNumEntry ("Main Window Left", -1);
  791. if ( x + width > available.width() )
  792. x = available.width() - width;
  793. int y = config() -> readNumEntry ("Main Window Top", -1);
  794. if ( y + height > available.height() )
  795. y = available.height() - height;
  796. if ( x >= 0 && y >= 0 )
  797. move (x, y);
  798. if ( width >= minimumWidth() && height >= minimumHeight() )
  799. resize (width, height);
  800. m_normal_geometry.setRect (x, y, width, height);
  801. TQt::Dock dock = (TQt::Dock) config() -> readNumEntry ("Message Log Dock", TQt::DockBottom);
  802. bool docked = config() -> readBoolEntry ("Message Log Docked", true);
  803. bool newline = config() -> readBoolEntry ("Message Log New Line", true);
  804. int index = config() -> readNumEntry ("Message Log Index", 0);
  805. int offset = config() -> readNumEntry ("Message Log Offset", 0);
  806. int left = config() -> readNumEntry ("Message Log Left", 0);
  807. int top = config() -> readNumEntry ("Message Log Top", 0);
  808. width = config() -> readNumEntry ("Message Log Width", 0);
  809. height = config() -> readNumEntry ("Message Log Height", 0);
  810. #ifdef DEBUG_KPLAYER_WINDOW
  811. kdDebugTime() << "Log dock " << dock << " " << index << " " << newline << " " << offset << " " << left << "x" << top << " " << width << "x" << height << "\n";
  812. #endif
  813. if ( width > 0 && height > 0 )
  814. {
  815. log() -> setFixedExtentWidth (width);
  816. log() -> setFixedExtentHeight (height);
  817. }
  818. moveDockWindow (log(), dock, newline, index, offset);
  819. if ( ! docked )
  820. log() -> undock();
  821. if ( width > 0 && height > 0 )
  822. log() -> setGeometry (left, top, width, height);
  823. dock = (TQt::Dock) config() -> readNumEntry ("Playlist Dock", TQt::DockBottom);
  824. docked = config() -> readBoolEntry ("Playlist Docked", true);
  825. newline = config() -> readBoolEntry ("Playlist New Line", true);
  826. index = config() -> readNumEntry ("Playlist Index", 0);
  827. offset = config() -> readNumEntry ("Playlist Offset", 0);
  828. left = config() -> readNumEntry ("Playlist Left", 0);
  829. top = config() -> readNumEntry ("Playlist Top", 0);
  830. width = config() -> readNumEntry ("Playlist Width", 600);
  831. height = config() -> readNumEntry ("Playlist Height", 300);
  832. #ifdef DEBUG_KPLAYER_WINDOW
  833. kdDebugTime() << "Library dock " << dock << " " << index << " " << newline << " " << offset << " " << left << "x" << top << " " << width << "x" << height << "\n";
  834. #endif
  835. if ( width > 0 && height > 0 )
  836. {
  837. library() -> setFixedExtentWidth (width);
  838. library() -> setFixedExtentHeight (height);
  839. }
  840. moveDockWindow (library(), dock, newline, index, offset);
  841. if ( ! docked )
  842. library() -> undock();
  843. if ( width > 0 && height > 0 )
  844. library() -> setGeometry (left, top, width, height);
  845. m_menubar_normally_visible = config() -> readBoolEntry ("Menu Bar Normally Visible", m_menubar_normally_visible);
  846. m_menubar_fullscreen_visible = config() -> readBoolEntry ("Menu Bar FullScreen Visible", m_menubar_fullscreen_visible);
  847. showMenubar();
  848. m_statusbar_normally_visible = config() -> readBoolEntry ("Status Bar Normally Visible", m_statusbar_normally_visible);
  849. m_statusbar_fullscreen_visible = config() -> readBoolEntry ("Status Bar FullScreen Visible", m_statusbar_fullscreen_visible);
  850. showStatusbar();
  851. for ( int i = 0; i < KPLAYER_TOOLBARS; i ++ )
  852. {
  853. m_toolbar[i].normally_visible = config() -> readBoolEntry (TQString (m_toolbar[i].name) + " Normally Visible", m_toolbar[i].normally_visible);
  854. m_toolbar[i].fullscreen_visible = config() -> readBoolEntry (TQString (m_toolbar[i].name) + " FullScreen Visible", m_toolbar[i].fullscreen_visible);
  855. //kdDebugTime() << "Show " << m_toolbar[i].name << " " << m_toolbar[i].action << "\n";
  856. showToolbar (i);
  857. }
  858. m_messagelog_normally_visible = config() -> readBoolEntry ("Message Log Normally Visible", m_messagelog_normally_visible);
  859. m_messagelog_fullscreen_visible = config() -> readBoolEntry ("Message Log FullScreen Visible", m_messagelog_fullscreen_visible);
  860. showMessageLog();
  861. m_library_normally_visible = config() -> readBoolEntry ("Playlist Editor Normally Visible", m_library_normally_visible);
  862. m_library_fullscreen_visible = config() -> readBoolEntry ("Playlist Editor FullScreen Visible", m_library_fullscreen_visible);
  863. showLibrary();
  864. #ifdef DEBUG_KPLAYER_WINDOW
  865. kdDebugTime() << "Done reading options\n";
  866. #endif
  867. }
  868. /*void KPlayer::saveProperties (TDEConfig* config) const
  869. {
  870. config -> writeEntry ("File URL", settings() -> url().url());
  871. }
  872. void KPlayer::readProperties (TDEConfig* config)
  873. {
  874. library() -> load (config -> readEntry ("File URL"), false);
  875. }*/
  876. void KPlayer::enableToolbar (int index)
  877. {
  878. Toolbar& toolbar = m_toolbar [index];
  879. TDEToggleAction* action = toggleAction (toolbar.action);
  880. //if ( action -> isEnabled() )
  881. // return;
  882. action -> setEnabled (true);
  883. showToolbar (index);
  884. }
  885. void KPlayer::disableToolbar (int index)
  886. {
  887. Toolbar& toolbar = m_toolbar [index];
  888. TDEToggleAction* action = toggleAction (toolbar.action);
  889. //if ( ! action -> isEnabled() )
  890. // return;
  891. if ( action -> isChecked() )
  892. {
  893. action -> setChecked (false);
  894. toolBar (toolbar.name) -> hide();
  895. }
  896. action -> setEnabled (false);
  897. }
  898. void KPlayer::enablePlayerActions (void)
  899. {
  900. #ifdef DEBUG_KPLAYER_WINDOW
  901. kdDebugTime() << "KPlayer: Enabling player actions\n";
  902. #endif
  903. if ( process() -> state() == KPlayerProcess::Idle || process() -> isInfoAvailable()
  904. || settings() -> properties() -> hasLength() )
  905. {
  906. if ( settings() -> properties() -> hasLength() )
  907. enableToolbar (PROGRESS_TOOLBAR);
  908. else
  909. disableToolbar (PROGRESS_TOOLBAR);
  910. }
  911. enableSubmenu ("seek", settings() -> properties() -> hasLength() && process() -> state() == KPlayerProcess::Playing);
  912. enableSubmenu ("audio", process() -> state() != KPlayerProcess::Paused);
  913. enableSubmenu ("advanced", process() -> state() != KPlayerProcess::Paused);
  914. }
  915. void KPlayer::enableVideoActions (void)
  916. {
  917. #ifdef DEBUG_KPLAYER_WINDOW
  918. kdDebugTime() << "KPlayer: Enabling video actions\n";
  919. #endif
  920. bool video = settings() -> properties() -> hasVideo();
  921. bool unpaused = video && process() -> state() != KPlayerProcess::Paused;
  922. if ( process() -> state() != KPlayerProcess::Running )
  923. {
  924. for ( int i = FIRST_VIDEO_TOOLBAR; i < KPLAYER_TOOLBARS; i ++ )
  925. if ( video )
  926. enableToolbar (i);
  927. else
  928. disableToolbar (i);
  929. }
  930. enableSubtitleActions();
  931. enableSubmenu ("video", unpaused);
  932. }
  933. TQPopupMenu* KPlayer::popupMenu (int index)
  934. {
  935. TQMenuData* data = menuBar();
  936. if ( ! data )
  937. return 0;
  938. int id = data -> idAt (index);
  939. if ( id == -1 )
  940. return 0;
  941. TQMenuItem* item = data -> findItem (id);
  942. if ( ! item )
  943. return 0;
  944. return item -> popup();
  945. }
  946. void KPlayer::actionListUpdating (KPlayerActionList* list)
  947. {
  948. unplugActionList (list -> name());
  949. }
  950. void KPlayer::actionListUpdated (KPlayerActionList* list)
  951. {
  952. bool has_actions = ! list -> isEmpty();
  953. TQString name (list -> name());
  954. if ( has_actions )
  955. plugActionList (name, list -> actions());
  956. enableSubmenu (name, has_actions);
  957. }
  958. void KPlayer::libraryActionListUpdated (KPlayerActionList* list)
  959. {
  960. bool has_actions = ! list -> isEmpty();
  961. TQString name (list -> name());
  962. if ( has_actions )
  963. plugActionList (name, list -> actions());
  964. enableSubmenu (name, has_actions && library() -> isVisible());
  965. }
  966. void KPlayer::enableSubmenu (TQMenuData* data, const TQString& name, bool enable)
  967. {
  968. for ( uint i = 0; i < data -> count(); i ++ )
  969. {
  970. int id = data -> idAt (i);
  971. if ( id != -1 )
  972. {
  973. TQMenuItem* item = data -> findItem (id);
  974. if ( item )
  975. {
  976. TQPopupMenu* popup = item -> popup();
  977. if ( popup )
  978. {
  979. if ( popup -> name() == name )
  980. data -> setItemEnabled (id, enable && popup -> count() > 0);
  981. else
  982. enableSubmenu (popup, name, enable);
  983. }
  984. }
  985. }
  986. }
  987. }
  988. void KPlayer::enableSubmenu (const TQString& name, bool enable)
  989. {
  990. #ifdef DEBUG_KPLAYER_WINDOW
  991. kdDebugTime() << "KPlayer::enableSubmenu " << name << " " << enable << "\n";
  992. #endif
  993. enableSubmenu (menuBar(), name, enable);
  994. TQPopupMenu* popup = (TQPopupMenu*) factory() -> container ("player_popup", this);
  995. if ( popup )
  996. enableSubmenu (popup, name, enable);
  997. popup = (TQPopupMenu*) factory() -> container ("library_popup", this);
  998. if ( popup )
  999. enableSubmenu (popup, name, enable);
  1000. }
  1001. void KPlayer::enableSubtitleActions (void)
  1002. {
  1003. #ifdef DEBUG_KPLAYER_WINDOW
  1004. kdDebugTime() << "KPlayer: Enabling subtitle actions\n";
  1005. #endif
  1006. enableSubmenu ("subtitles", settings() -> hasSubtitles() && process() -> state() != KPlayerProcess::Paused);
  1007. }
  1008. /*void KPlayer::checkBarActions (void)
  1009. {
  1010. toggleAction (KStdAction::stdName (KStdAction::ShowMenubar)) -> setChecked (menuBar() -> isVisible());
  1011. for ( int i = 0; i < KPLAYER_TOOLBARS; i ++ )
  1012. toggleAction (m_toolbar[i].action) -> setChecked (toolBar (m_toolbar[i].name) -> isVisible());
  1013. toggleAction (KStdAction::stdName (KStdAction::ShowStatusbar)) -> setChecked (statusBar() -> isVisible());
  1014. }*/
  1015. void KPlayer::dragEnterEvent (TQDragEnterEvent *event)
  1016. {
  1017. #ifdef DEBUG_KPLAYER_WINDOW
  1018. kdDebugTime() << "Drag enter event\n";
  1019. #endif
  1020. event -> accept (KURLDrag::canDecode (event));
  1021. }
  1022. void KPlayer::dropEvent (TQDropEvent* event)
  1023. {
  1024. #ifdef DEBUG_KPLAYER_WINDOW
  1025. kdDebugTime() << "Drop event\n";
  1026. #endif
  1027. KURL::List urls;
  1028. if ( ! KURLDrag::decode (event, urls) )
  1029. return;
  1030. playlist() -> playUrls (urls);
  1031. }
  1032. bool KPlayer::isFullScreen (void) const
  1033. {
  1034. return (KWin::windowInfo (winId(), NET::WMState).state() & NET::FullScreen) == NET::FullScreen;
  1035. }
  1036. bool KPlayer::isMaximized (void) const
  1037. {
  1038. return (KWin::windowInfo (winId(), NET::WMState).state() & NET::Max) == NET::Max;
  1039. }
  1040. void KPlayer::showMaximized (void)
  1041. {
  1042. #ifdef DEBUG_KPLAYER_WINDOW
  1043. bool maximized = isMaximized();
  1044. #endif
  1045. TDEMainWindow::showMaximized();
  1046. KWin::clearState (winId(), 1 << 9); // KDE 3.2 FullScreen
  1047. KWin::setState (winId(), NET::Max);
  1048. #ifdef DEBUG_KPLAYER_WINDOW
  1049. kdDebugTime() << "KPlayer::showMaximized " << maximized << " -> " << isMaximized() << "\n";
  1050. #endif
  1051. //syncronizeEvents();
  1052. //activateLayout();
  1053. }
  1054. void KPlayer::showNormal (void)
  1055. {
  1056. #ifdef DEBUG_KPLAYER_WINDOW
  1057. bool maximized = isMaximized();
  1058. #endif
  1059. TDEMainWindow::showNormal();
  1060. //TDEMainWindow::showNormal();
  1061. KWin::clearState (winId(), NET::Max | (1 << 9)); // KDE 3.2 FullScreen
  1062. #ifdef DEBUG_KPLAYER_WINDOW
  1063. kdDebugTime() << "KPlayer::showNormal " << maximized << " -> " << isMaximized() << "\n";
  1064. #endif
  1065. //syncronizeEvents();
  1066. //activateLayout();
  1067. }
  1068. void KPlayer::start (void)
  1069. {
  1070. if ( isMinimized() )
  1071. {
  1072. #ifdef DEBUG_KPLAYER_WINDOW
  1073. kdDebugTime() << "Restoring minimized window\n";
  1074. #endif
  1075. clearWState (WState_Visible); // or showNormal won't work
  1076. showNormal();
  1077. }
  1078. else
  1079. show();
  1080. raise();
  1081. setActiveWindow(); // doesn't work after restoring from minimized state
  1082. KWin::forceActiveWindow (winId());
  1083. #ifdef DEBUG_KPLAYER_RESIZING
  1084. kdDebugTime() << "Main window minimum size " << minimumWidth() << "x" << minimumHeight()
  1085. << ", maximum size " << maximumWidth() << "x" << maximumHeight()
  1086. << ", size " << width() << "x" << height() << "\n";
  1087. #endif
  1088. KPlayerX11GetKeyboardMouseState (winId());
  1089. TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs();
  1090. if ( args -> count() > 0 )
  1091. {
  1092. KURL::List urls;
  1093. for ( int i = 0; i < args -> count(); i ++ )
  1094. urls << args -> url (i);
  1095. if ( args -> isSet ("play") )
  1096. playlist() -> playUrls (urls);
  1097. else if ( args -> isSet ("queue") )
  1098. playlist() -> queueUrls (urls);
  1099. else if ( args -> isSet ("play-next") )
  1100. playlist() -> playNextUrls (urls);
  1101. else if ( args -> isSet ("queue-next") )
  1102. playlist() -> queueNextUrls (urls);
  1103. else if ( args -> isSet ("add-to-new-playlist") )
  1104. library() -> library() -> treeView() -> addToNewPlaylistUrls (urls);
  1105. else if ( args -> isSet ("add-to-playlists") )
  1106. library() -> library() -> treeView() -> addToPlaylistsUrls (urls);
  1107. else if ( args -> isSet ("add-to-collection") )
  1108. library() -> library() -> treeView() -> addToCollectionUrls (urls);
  1109. else
  1110. playlist() -> playUrls (urls);
  1111. //openUrl (TDECmdLineArgs::makeURL (args -> arg (args -> count() - 1)));
  1112. }
  1113. args -> clear();
  1114. }
  1115. //bool KPlayerX11TestGrab (Display*, int);
  1116. /*bool KPlayer::event (TQEvent* ev)
  1117. {
  1118. kdDebugTime() << "KPlayer event: type " << ev -> type()
  1119. << " spontaneous " << ev -> spontaneous() << "\n";
  1120. //if ( ev -> type() == TQEvent::LayoutHint && isFullScreen() )
  1121. // return false;
  1122. return TDEMainWindow::event (ev);
  1123. }*/
  1124. void KPlayer::contextMenu (const TQPoint& global_position)
  1125. {
  1126. #ifdef DEBUG_KPLAYER_RESIZING
  1127. kdDebugTime() << "Main " << winId() << " wspace " << kPlayerWorkspace() -> winId()
  1128. << " widget " << kPlayerWidget() -> winId() << "\n";
  1129. dumpObject (this, 0);
  1130. dumpObject (actionCollection(), 0);
  1131. #endif
  1132. TQPopupMenu* popup = (TQPopupMenu*) factory() -> container ("player_popup", this);
  1133. if ( popup )
  1134. popup -> popup (global_position);
  1135. }
  1136. void KPlayer::contextMenuEvent (TQContextMenuEvent* event)
  1137. {
  1138. TDEMainWindow::contextMenuEvent (event);
  1139. contextMenu (event -> globalPos());
  1140. event -> accept();
  1141. }
  1142. void KPlayer::playlistStarted (void)
  1143. {
  1144. setStatusText (i18n("Ready"));
  1145. log() -> setError (false);
  1146. if ( m_status_label )
  1147. m_status_label -> unsetCursor();
  1148. }
  1149. void KPlayer::playlistActivated (void)
  1150. {
  1151. setCaption (settings() -> properties() -> caption());
  1152. clearStatusMessage();
  1153. if ( m_progress_label )
  1154. m_progress_label -> setText ("");
  1155. connect (settings() -> properties(), SIGNAL (updated()), this, SLOT (refreshProperties()));
  1156. enableVideoActions();
  1157. }
  1158. void KPlayer::playlistStopped (void)
  1159. {
  1160. if ( m_error_detected && ! log() -> isEmpty() )
  1161. log() -> setError (true);
  1162. m_error_detected = false;
  1163. playerProgressChanged (process() -> position(), KPlayerProcess::Position);
  1164. }
  1165. void KPlayer::statusPressed (void)
  1166. {
  1167. if ( log() -> hasError() || m_error_detected )
  1168. showMessageLog (true);
  1169. }
  1170. void KPlayer::refreshProperties (void)
  1171. {
  1172. setCaption (settings() -> properties() -> caption());
  1173. enableVideoActions();
  1174. }
  1175. void KPlayer::closeEvent (TQCloseEvent* event)
  1176. {
  1177. disconnect (log(), SIGNAL (windowHidden()), this, SLOT (logWindowHidden()));
  1178. disconnect (library(), SIGNAL (windowHidden()), this, SLOT (libraryHidden()));
  1179. disconnect (settings() -> properties(), SIGNAL (updated()), this, SLOT (refreshProperties()));
  1180. disconnect (configuration(), SIGNAL (updated()), this, SLOT (refreshSettings()));
  1181. saveOptions();
  1182. library() -> library() -> terminate();
  1183. playlist() -> terminate();
  1184. KPlayerEngine::terminate();
  1185. TDEMainWindow::closeEvent (event);
  1186. #ifdef DEBUG_KPLAYER_WINDOW
  1187. kdDebugTime() << "KPlayer::closeEvent\n";
  1188. #endif
  1189. }
  1190. void KPlayer::fileClearLog (void)
  1191. {
  1192. setStatusText (i18n("Ready"));
  1193. if ( m_status_label )
  1194. m_status_label -> unsetCursor();
  1195. }
  1196. void KPlayer::fileQuit (void)
  1197. {
  1198. close();
  1199. }
  1200. void KPlayer::viewPlaylist (void)
  1201. {
  1202. showToolbar (PLAYLIST_TOOLBAR, toggleAction (m_toolbar[PLAYLIST_TOOLBAR].action) -> isChecked());
  1203. }
  1204. void KPlayer::viewLibrary (void)
  1205. {
  1206. showLibrary (toggleAction ("options_show_library") -> isChecked());
  1207. }
  1208. void KPlayer::makeLibraryVisible (void)
  1209. {
  1210. #ifdef DEBUG_KPLAYER_WINDOW
  1211. kdDebugTime() << "KPlayer::makeLibraryVisible\n";
  1212. #endif
  1213. showLibrary (true);
  1214. }
  1215. void KPlayer::showLibrary (bool show)
  1216. {
  1217. #ifdef DEBUG_KPLAYER_WINDOW
  1218. kdDebugTime() << "showLibrary " << show << " => " << settings() -> fullScreen() << "\n";
  1219. #endif
  1220. if ( settings() -> fullScreen() )
  1221. m_library_fullscreen_visible = show;
  1222. else
  1223. m_library_normally_visible = show;
  1224. showLibrary();
  1225. }
  1226. void KPlayer::showLibrary (void)
  1227. {
  1228. bool show = settings() -> fullScreen() ? m_library_fullscreen_visible : m_library_normally_visible;
  1229. #ifdef DEBUG_KPLAYER_WINDOW
  1230. kdDebugTime() << "showLibrary " << show << " <= " << settings() -> fullScreen() << "\n";
  1231. #endif
  1232. toggleAction ("options_show_library") -> setChecked (show);
  1233. m_show_library = show;
  1234. if ( show )
  1235. {
  1236. library() -> show();
  1237. library() -> setFocus();
  1238. }
  1239. else
  1240. library() -> hide();
  1241. }
  1242. void KPlayer::showMenubar (void)
  1243. {
  1244. bool show = settings() -> fullScreen() ? m_menubar_fullscreen_visible : m_menubar_normally_visible;
  1245. toggleAction (KStdAction::stdName (KStdAction::ShowMenubar)) -> setChecked (show);
  1246. toggleAction (KStdAction::stdName (KStdAction::ShowMenubar)) -> setStatusText (i18n("Shows/hides the menu bar"));
  1247. if ( show )
  1248. menuBar() -> show();
  1249. else
  1250. menuBar() -> hide();
  1251. }
  1252. void KPlayer::viewMenubar (void)
  1253. {
  1254. bool show = toggleAction (KStdAction::stdName (KStdAction::ShowMenubar)) -> isChecked();
  1255. if ( settings() -> fullScreen() )
  1256. m_menubar_fullscreen_visible = show;
  1257. else
  1258. m_menubar_normally_visible = show;
  1259. if ( show )
  1260. menuBar() -> show();
  1261. else
  1262. menuBar() -> hide();
  1263. }
  1264. void KPlayer::showStatusbar (void)
  1265. {
  1266. bool show = settings() -> fullScreen() ? m_statusbar_fullscreen_visible : m_statusbar_normally_visible;
  1267. toggleAction (KStdAction::stdName (KStdAction::ShowStatusbar)) -> setChecked (show);
  1268. toggleAction (KStdAction::stdName (KStdAction::ShowStatusbar)) -> setStatusText (i18n("Shows/hides the status bar"));
  1269. if ( show )
  1270. statusBar() -> show();
  1271. else
  1272. statusBar() -> hide();
  1273. }
  1274. void KPlayer::viewStatusbar (void)
  1275. {
  1276. bool show = toggleAction (KStdAction::stdName (KStdAction::ShowStatusbar)) -> isChecked();
  1277. if ( settings() -> fullScreen() )
  1278. m_statusbar_fullscreen_visible = show;
  1279. else
  1280. m_statusbar_normally_visible = show;
  1281. if ( show )
  1282. statusBar() -> show();
  1283. else
  1284. statusBar() -> hide();
  1285. }
  1286. void KPlayer::showMessageLog (void)
  1287. {
  1288. bool show = settings() -> fullScreen() ? m_messagelog_fullscreen_visible : m_messagelog_normally_visible;
  1289. toggleAction ("options_show_log") -> setChecked (show);
  1290. m_show_log = show;
  1291. if ( show )
  1292. log() -> show();
  1293. else
  1294. log() -> hide();
  1295. }
  1296. void KPlayer::showMessageLog (bool show)
  1297. {
  1298. if ( settings() -> fullScreen() )
  1299. m_messagelog_fullscreen_visible = show;
  1300. else
  1301. m_messagelog_normally_visible = show;
  1302. showMessageLog();
  1303. setStatusText (i18n("Ready"));
  1304. log() -> setError (false);
  1305. if ( m_status_label )
  1306. m_status_label -> unsetCursor();
  1307. }
  1308. void KPlayer::viewMessageLog (void)
  1309. {
  1310. showMessageLog (toggleAction ("options_show_log") -> isChecked());
  1311. }
  1312. void KPlayer::showToolbar (int index)
  1313. {
  1314. bool show = settings() -> fullScreen() ? m_toolbar[index].fullscreen_visible : m_toolbar[index].normally_visible;
  1315. #ifdef DEBUG_KPLAYER_WINDOW
  1316. kdDebugTime() << "showToolbar '" << m_toolbar[index].name << "' " << show << " <= " << settings() -> fullScreen() << "\n";
  1317. #endif
  1318. toggleAction (m_toolbar[index].action) -> setChecked (show);
  1319. if ( show )
  1320. {
  1321. TDEToolBar* toolbar = toolBar (m_toolbar[index].name);
  1322. toolbar -> show();
  1323. int hint = toolbar -> minimumSizeHint().height();
  1324. if ( toolbar -> orientation() == TQt::Vertical && kPlayerWorkspace() -> height() < hint
  1325. && ! settings() -> fullScreen() && ! settings() -> maximized() )
  1326. {
  1327. settings() -> setDisplaySize (TQSize (settings() -> displaySize().width(), hint));
  1328. zoom();
  1329. }
  1330. }
  1331. else
  1332. toolBar (m_toolbar[index].name) -> hide();
  1333. }
  1334. void KPlayer::showToolbar (int index, bool show)
  1335. {
  1336. if ( settings() -> fullScreen() )
  1337. m_toolbar[index].fullscreen_visible = show;
  1338. else
  1339. m_toolbar[index].normally_visible = show;
  1340. showToolbar (index);
  1341. }
  1342. void KPlayer::viewMainToolbar (void)
  1343. {
  1344. showToolbar (MAIN_TOOLBAR, toggleAction (m_toolbar[MAIN_TOOLBAR].action) -> isChecked());
  1345. }
  1346. void KPlayer::viewProgressToolbar (void)
  1347. {
  1348. showToolbar (PROGRESS_TOOLBAR, toggleAction (m_toolbar[PROGRESS_TOOLBAR].action) -> isChecked());
  1349. }
  1350. void KPlayer::viewVolumeToolbar (void)
  1351. {
  1352. showToolbar (VOLUME_TOOLBAR, toggleAction (m_toolbar[VOLUME_TOOLBAR].action) -> isChecked());
  1353. }
  1354. void KPlayer::viewContrastToolbar (void)
  1355. {
  1356. showToolbar (CONTRAST_TOOLBAR, toggleAction (m_toolbar[CONTRAST_TOOLBAR].action) -> isChecked());
  1357. }
  1358. void KPlayer::viewBrightnessToolbar (void)
  1359. {
  1360. showToolbar (BRIGHTNESS_TOOLBAR, toggleAction (m_toolbar[BRIGHTNESS_TOOLBAR].action) -> isChecked());
  1361. }
  1362. void KPlayer::viewHueToolbar (void)
  1363. {
  1364. showToolbar (HUE_TOOLBAR, toggleAction (m_toolbar[HUE_TOOLBAR].action) -> isChecked());
  1365. }
  1366. void KPlayer::viewSaturationToolbar (void)
  1367. {
  1368. showToolbar (SATURATION_TOOLBAR, toggleAction (m_toolbar[SATURATION_TOOLBAR].action) -> isChecked());
  1369. }
  1370. void KPlayer::settingsKeyBindings (void)
  1371. {
  1372. // reportedly was buggy in KDE 3.0x
  1373. KKeyDialog::configure (actionCollection());
  1374. //KKeyDialog keydlg (true);
  1375. //keydlg.insert (actionCollection());
  1376. //keydlg.configure (true);
  1377. }
  1378. void KPlayer::settingsConfigureToolbars (void)
  1379. {
  1380. saveMainWindowSettings (config(), "General Options");
  1381. KEditToolbar dialog (actionCollection());
  1382. connect (&dialog, SIGNAL (newToolbarConfig()), SLOT (newToolbarConfiguration()));
  1383. dialog.exec();
  1384. }
  1385. void KPlayer::newToolbarConfiguration (void)
  1386. {
  1387. createGUI();
  1388. applyMainWindowSettings (config(), "General Options");
  1389. }
  1390. void KPlayer::settingsConfigure (void)
  1391. {
  1392. KPlayerSettingsDialog (this).exec();
  1393. }
  1394. void KPlayer::helpReportBug (void)
  1395. {
  1396. kapp -> invokeHelp ("howto-bug-reporting");
  1397. }
  1398. void KPlayer::playerStateChanged (KPlayerProcess::State state, KPlayerProcess::State previous)
  1399. {
  1400. static const TQString stateMessages [4] = { i18n("Idle"), i18n("Running"), i18n("Playing"), i18n("Paused") };
  1401. #ifdef DEBUG_KPLAYER_WINDOW
  1402. kdDebugTime() << "Main window received state change: " << previous << " => " << state << "\n";
  1403. #endif
  1404. clearStatusMessage();
  1405. if ( state != process() -> state() )
  1406. return;
  1407. if ( m_state_label )
  1408. m_state_label -> setText (stateMessages [state]);
  1409. if ( state == KPlayerProcess::Running && previous != state )
  1410. {
  1411. if ( ! m_error_detected )
  1412. action ("log_clear") -> activate();
  1413. else if ( ! log() -> isEmpty() )
  1414. log() -> addLine ("------------------------------------------------------------");
  1415. if ( m_error_detected && ! log() -> isEmpty() )
  1416. log() -> setError (true);
  1417. m_error_detected = false;
  1418. }
  1419. if ( state == KPlayerProcess::Idle && previous != state && engine() -> stopped() )
  1420. {
  1421. if ( m_error_detected && ! log() -> isEmpty() )
  1422. log() -> setError (true);
  1423. m_error_detected = false;
  1424. }
  1425. enablePlayerActions();
  1426. enableVideoActions();
  1427. }
  1428. void KPlayer::playerProgressChanged (float progress, KPlayerProcess::ProgressType type)
  1429. {
  1430. static const TQString cacheFillMessage (i18n("Cache fill: %1%"));
  1431. static const TQString indexGenerationMessage (i18n("Generating index: %1%"));
  1432. static const TQString fileTransferMessage (i18n("Transferring file: %1%"));
  1433. if ( ! m_progress_label )
  1434. return;
  1435. if ( type == KPlayerProcess::Position )
  1436. m_progress_label -> setText (process() -> positionString());
  1437. else
  1438. {
  1439. int value = limit (int (progress + 0.5), 0, 100);
  1440. #ifdef DEBUG_KPLAYER_WINDOW
  1441. kdDebugTime() << "Progress " << type << " " << progress << " " << value << "\n";
  1442. #endif
  1443. m_progress_label -> setText ((type == KPlayerProcess::CacheFill ? cacheFillMessage
  1444. : type == KPlayerProcess::IndexGeneration ? indexGenerationMessage
  1445. : fileTransferMessage).arg (value));
  1446. }
  1447. }
  1448. void KPlayer::playerInfoAvailable (void)
  1449. {
  1450. enablePlayerActions();
  1451. if ( settings() -> properties() -> hasLength() )
  1452. playerProgressChanged (process() -> position(), KPlayerProcess::Position);
  1453. }
  1454. void KPlayer::playerSizeAvailable (void)
  1455. {
  1456. enableVideoActions();
  1457. }
  1458. void KPlayer::playerMessageReceived (TQString message)
  1459. {
  1460. if ( message.isEmpty() )
  1461. return;
  1462. log (message);
  1463. }
  1464. void KPlayer::playerErrorDetected (void)
  1465. {
  1466. #ifdef DEBUG_KPLAYER_WINDOW
  1467. kdDebugTime() << "Error detected\n";
  1468. #endif
  1469. setStatusText (i18n("Error"));
  1470. if ( log() -> isHidden() && m_status_label )
  1471. m_status_label -> setCursor (KCursor::handCursor());
  1472. m_error_detected = true;
  1473. if ( configuration() -> showMessagesOnError() )
  1474. showMessageLog (true);
  1475. }
  1476. void KPlayer::logWindowHidden (void)
  1477. {
  1478. #ifdef DEBUG_KPLAYER_WINDOW
  1479. kdDebugTime() << "Log window hidden signal\n";
  1480. if ( log() -> isVisible() )
  1481. kdDebugTime() << " but the log window is visible\n";
  1482. else if ( ! log() -> isHidden() )
  1483. kdDebugTime() << " but the log window is not hidden\n";
  1484. #endif
  1485. showMessageLog (false);
  1486. }
  1487. void KPlayer::libraryHidden (void)
  1488. {
  1489. #ifdef DEBUG_KPLAYER_WINDOW
  1490. kdDebugTime() << "Library window hidden signal\n";
  1491. if ( library() -> isVisible() )
  1492. kdDebugTime() << " but the library is visible\n";
  1493. else if ( ! library() -> isHidden() )
  1494. kdDebugTime() << " but the library is not hidden\n";
  1495. #endif
  1496. showLibrary (false);
  1497. }
  1498. void KPlayer::log (TQString message)
  1499. {
  1500. if ( message.isEmpty() )
  1501. return;
  1502. log() -> addLine (message);
  1503. }
  1504. void KPlayer::setStatusText (const TQString& text)
  1505. {
  1506. statusBar() -> clear();
  1507. //statusBar() -> changeItem (text, ID_STATUS_MSG);
  1508. if ( m_status_label )
  1509. m_status_label -> setText (text);
  1510. }
  1511. void KPlayer::setStatusMessage (const TQString& text)
  1512. {
  1513. if ( text.isEmpty() )
  1514. {
  1515. clearStatusMessage();
  1516. return;
  1517. }
  1518. TQPopupMenu* popup = (TQPopupMenu*) factory() -> container ("player_popup", this);
  1519. if ( ! popup || ! popup -> isVisible() )
  1520. popup = (TQPopupMenu*) factory() -> container ("library_popup", this);
  1521. if ( ! popup || ! popup -> isVisible() )
  1522. for ( uint i = 0; i < menuBar() -> count(); i ++ )
  1523. if ( (popup = popupMenu (i)) && popup -> isVisible() )
  1524. break;
  1525. if ( popup && popup -> isVisible() )
  1526. {
  1527. statusBar() -> message (text);
  1528. m_progress_label -> hide();
  1529. m_state_label -> hide();
  1530. }
  1531. }
  1532. void KPlayer::clearStatusMessage (void)
  1533. {
  1534. statusBar() -> clear();
  1535. m_state_label -> show();
  1536. m_progress_label -> show();
  1537. }
  1538. void KPlayer::showEvent (TQShowEvent* event)
  1539. {
  1540. #ifdef DEBUG_KPLAYER_WINDOW
  1541. kdDebugTime() << "KPlayer::showEvent\n";
  1542. #endif
  1543. TDEMainWindow::showEvent (event);
  1544. if ( m_initial_show )
  1545. return;
  1546. m_initial_show = true;
  1547. if ( x() != m_normal_geometry.x() && m_normal_geometry.x() >= 0
  1548. && y() != m_normal_geometry.y() && m_normal_geometry.y() >= 0 )
  1549. {
  1550. #ifdef DEBUG_KPLAYER_WINDOW
  1551. kdDebugTime() << "KPlayer::showEvent: adjusting position to " << m_normal_geometry.x() << "x" << m_normal_geometry.y() << "\n";
  1552. #endif
  1553. move (m_normal_geometry.x(), m_normal_geometry.y());
  1554. }
  1555. if ( width() != m_normal_geometry.width() && m_normal_geometry.width() >= minimumWidth()
  1556. && height() != m_normal_geometry.height() && m_normal_geometry.height() >= minimumHeight() )
  1557. {
  1558. #ifdef DEBUG_KPLAYER_WINDOW
  1559. kdDebugTime() << "KPlayer::showEvent: adjusting size to " << m_normal_geometry.width() << "x" << m_normal_geometry.height() << "\n";
  1560. #endif
  1561. resize (m_normal_geometry.width(), m_normal_geometry.height());
  1562. }
  1563. /*if ( focusProxy() )
  1564. KPlayerX11SetInputFocus (focusProxy() -> winId());
  1565. #ifdef DEBUG_KPLAYER_WINDOW
  1566. else
  1567. kdDebugTime() << "KPlayer::showEvent: no focus proxy\n";
  1568. #endif*/
  1569. }
  1570. void KPlayer::windowActivationChange (bool old)
  1571. {
  1572. TDEMainWindow::windowActivationChange (old);
  1573. bool active = isActiveWindow();
  1574. #ifdef DEBUG_KPLAYER_WINDOW
  1575. kdDebugTime() << "Main window activation " << old << " -> " << active << "\n";
  1576. #endif
  1577. if ( active )
  1578. KPlayerX11GetKeyboardMouseState (winId());
  1579. /*if ( active && focusProxy() )
  1580. KPlayerX11SetInputFocus (focusProxy() -> winId());
  1581. #ifdef DEBUG_KPLAYER_WINDOW
  1582. else if ( active )
  1583. kdDebugTime() << " no focus proxy\n";
  1584. #endif*/
  1585. }
  1586. void KPlayer::focusInEvent (TQFocusEvent* event)
  1587. {
  1588. #ifdef DEBUG_KPLAYER_WINDOW
  1589. kdDebugTime() << "Window focus in event\n";
  1590. #endif
  1591. TDEMainWindow::focusInEvent (event);
  1592. }
  1593. void KPlayer::focusOutEvent (TQFocusEvent* event)
  1594. {
  1595. #ifdef DEBUG_KPLAYER_WINDOW
  1596. kdDebugTime() << "Window focus out event\n";
  1597. #endif
  1598. TDEMainWindow::focusOutEvent (event);
  1599. }
  1600. void KPlayer::moveEvent (TQMoveEvent* event)
  1601. {
  1602. #ifdef DEBUG_KPLAYER_RESIZING
  1603. bool maximized = isMaximized();
  1604. #endif
  1605. TDEMainWindow::moveEvent (event);
  1606. if ( ! m_full_screen && ! m_set_display_size && ! settings() -> maximized() && ! isMaximized() && m_initial_show )
  1607. m_normal_geometry.setRect (x(), y(), width(), height());
  1608. #ifdef DEBUG_KPLAYER_RESIZING
  1609. kdDebugTime() << "WiMove " << event -> oldPos().x() << "x" << event -> oldPos().y()
  1610. << " => " << event -> pos().x() << "x" << event -> pos().y() << ", "
  1611. << maximized << " -> " << isMaximized() << "\n";
  1612. kdDebugTime() << " Normal geometry " << m_normal_geometry.x() << "x" << m_normal_geometry.y()
  1613. << " " << m_normal_geometry.width() << "x" << m_normal_geometry.height() << "\n";
  1614. #endif
  1615. }
  1616. void KPlayer::resizeEvent (TQResizeEvent* event)
  1617. {
  1618. #ifdef DEBUG_KPLAYER_RESIZING
  1619. bool maximized = isMaximized();
  1620. #endif
  1621. TDEMainWindow::resizeEvent (event);
  1622. if ( ! m_full_screen && ! m_set_display_size && ! settings() -> maximized() && ! isMaximized() && m_initial_show )
  1623. m_normal_geometry.setSize (TQSize (width(), height()));
  1624. #ifdef DEBUG_KPLAYER_RESIZING
  1625. kdDebugTime() << "WiSize " << event -> oldSize(). width() << "x" << event -> oldSize(). height()
  1626. << " => " << event -> size(). width() << "x" << event -> size(). height() << ", maximized "
  1627. << maximized << " -> " << isMaximized() << " spontaneous " << event -> spontaneous() << "\n";
  1628. kdDebugTime() << " Normal geometry " << m_normal_geometry.x() << "x" << m_normal_geometry.y()
  1629. << " " << m_normal_geometry.width() << "x" << m_normal_geometry.height() << "\n";
  1630. #endif
  1631. if ( m_set_display_size )
  1632. {
  1633. if ( kPlayerWorkspace() -> isResizing() )
  1634. m_set_display_size = false;
  1635. else
  1636. TQTimer::singleShot (0, this, SLOT (setDisplaySize()));
  1637. }
  1638. }
  1639. void KPlayer::setDisplaySize (void)
  1640. {
  1641. #ifdef DEBUG_KPLAYER_RESIZING
  1642. kdDebugTime() << "KPlayer::setDisplaySize\n";
  1643. #endif
  1644. #ifdef DEBUG_KPLAYER_SIZING_HACKS
  1645. if ( ! m_full_screen && ! isMaximized() )
  1646. {
  1647. move (m_normal_geometry.x(), m_normal_geometry.y());
  1648. resize (m_normal_geometry.width(), m_normal_geometry.height());
  1649. }
  1650. #endif
  1651. m_set_display_size = false;
  1652. engine() -> setDisplaySize();
  1653. }
  1654. void KPlayer::setMinimumSize (int w, int h)
  1655. {
  1656. TQSize prev (size()), msh (minimumSizeHint());
  1657. #ifdef DEBUG_KPLAYER_RESIZING
  1658. kdDebugTime() << "Set minimum size " << w << "x" << h << " => " << msh.width() << "x" << msh.height() << "\n";
  1659. #endif
  1660. w = msh.width();
  1661. h = msh.height();
  1662. TDEMainWindow::setMinimumSize (w, h);
  1663. #ifdef DEBUG_KPLAYER_RESIZING
  1664. dumpObject (this, 0, 1);
  1665. if ( prev != size() )
  1666. kdDebugTime() << " Size changed\n";
  1667. #endif
  1668. if ( prev != size() && m_previous_size == prev )
  1669. m_previous_size = size();
  1670. }
  1671. /*TQSize KPlayer::sizeHint (void) const
  1672. {
  1673. return minimumSizeHint() + kPlayerWidget() -> videoSize();
  1674. }*/
  1675. TQSize KPlayer::minimumSizeHint (void) const
  1676. {
  1677. KPlayer* that = (KPlayer*) this;
  1678. TQSize size (configuration() -> minimumSliderLength(), 0);
  1679. if ( ! that -> menuBar() -> isHidden() )
  1680. size.setHeight (that -> menuBar() -> sizeHint().height());
  1681. size.setHeight (size.height() + topDock() -> height());
  1682. size.setHeight (size.height() + bottomDock() -> height());
  1683. size.setWidth (size.width() + leftDock() -> width());
  1684. size.setWidth (size.width() + rightDock() -> width());
  1685. if ( ! that -> statusBar() -> isHidden() )
  1686. {
  1687. int x = that -> statusBar() -> minimumSizeHint().width();
  1688. if ( x > size.width() )
  1689. size.setWidth (x);
  1690. size.setHeight (size.height() + that -> statusBar() -> minimumHeight());
  1691. }
  1692. #ifdef DEBUG_KPLAYER_RESIZING
  1693. kdDebugTime() << "Minimum size hint " << size.width() << "x" << size.height() << "\n";
  1694. #endif
  1695. return size.boundedTo (availableGeometry().size());
  1696. }
  1697. void KPlayer::toFullScreen (void)
  1698. {
  1699. #ifdef DEBUG_KPLAYER_WINDOW
  1700. kdDebugTime() << "KPlayer::toFullScreen\n";
  1701. #endif
  1702. bool active = isActiveWindow();
  1703. if ( isMaximized() )
  1704. m_maximized = true;
  1705. else if ( ! m_full_screen && ! m_set_display_size )
  1706. m_normal_geometry.setRect (x(), y(), width(), height());
  1707. setAcceptDrops (false);
  1708. #ifdef DEBUG_KPLAYER_RESIZING
  1709. kdDebugTime() << "Pre full screen: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1710. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1711. kdDebugTime() << " " << m_normal_geometry.x() << "x" << m_normal_geometry.y() << " " << m_normal_geometry.width() << "x" << m_normal_geometry.height() << "\n";
  1712. #endif
  1713. showMenubar();
  1714. showStatusbar();
  1715. showMessageLog();
  1716. for ( int i = 0; i < KPLAYER_TOOLBARS; i ++ )
  1717. showToolbar (i);
  1718. showLibrary();
  1719. if ( ! m_full_screen )
  1720. {
  1721. m_full_screen = true;
  1722. showFullScreen();
  1723. }
  1724. //syncronizeEvents();
  1725. #ifdef DEBUG_KPLAYER_RESIZING
  1726. kdDebugTime() << "Full screen: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1727. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1728. #endif
  1729. layout() -> setSpacing (-1);
  1730. activateLayout();
  1731. #ifdef DEBUG_KPLAYER_RESIZING
  1732. kdDebugTime() << "Full screen: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1733. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1734. dumpObject (this, 0);
  1735. #endif
  1736. if ( active )
  1737. {
  1738. setActiveWindow();
  1739. KWin::forceActiveWindow (winId());
  1740. }
  1741. setAcceptDrops (true);
  1742. enablePlayerActions();
  1743. }
  1744. void KPlayer::toNormalScreen (void)
  1745. {
  1746. #ifdef DEBUG_KPLAYER_WINDOW
  1747. kdDebugTime() << "KPlayer::toNormalScreen\n";
  1748. #endif
  1749. #ifdef DEBUG_KPLAYER_RESIZING
  1750. dumpObject (this, 0);
  1751. #endif
  1752. bool active = isActiveWindow();
  1753. layout() -> setSpacing (0);
  1754. setAcceptDrops (false);
  1755. showMenubar();
  1756. showStatusbar();
  1757. showMessageLog();
  1758. for ( int i = 0; i < KPLAYER_TOOLBARS; i ++ )
  1759. showToolbar (i);
  1760. showLibrary();
  1761. #ifdef DEBUG_KPLAYER_RESIZING
  1762. kdDebugTime() << "Full screen: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1763. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1764. #endif
  1765. #ifdef DEBUG_KPLAYER_SIZING_HACKS
  1766. if ( ! m_maximized )
  1767. {
  1768. //move (m_normal_geometry.x(), m_normal_geometry.y());
  1769. //resize (m_normal_geometry.width(), m_normal_geometry.height());
  1770. setGeometry (0, 0, width(), height() - 2);
  1771. setGeometry (m_normal_geometry);
  1772. activateLayout();
  1773. //m_initial_show = false;
  1774. }
  1775. #endif
  1776. #ifdef DEBUG_KPLAYER_RESIZING
  1777. kdDebugTime() << "Full screen: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1778. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1779. #endif
  1780. if ( m_full_screen )
  1781. {
  1782. m_full_screen = false;
  1783. showNormal();
  1784. }
  1785. #ifdef DEBUG_KPLAYER_SIZING_HACKS
  1786. /*if ( ! m_maximized )
  1787. {
  1788. #ifdef DEBUG_KPLAYER_WINDOW
  1789. kdDebugTime() << " Using normal geometry\n";
  1790. #endif
  1791. move (m_normal_geometry.x(), m_normal_geometry.y());
  1792. resize (m_normal_geometry.width(), m_normal_geometry.height());
  1793. }*/
  1794. #endif
  1795. #ifdef DEBUG_KPLAYER_RESIZING
  1796. kdDebugTime() << "Normal: " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  1797. kdDebugTime() << " " << frameGeometry().x() << "x" << frameGeometry().y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  1798. #endif
  1799. if ( active )
  1800. {
  1801. setActiveWindow();
  1802. KWin::forceActiveWindow (winId());
  1803. }
  1804. setAcceptDrops (true);
  1805. enablePlayerActions();
  1806. }
  1807. void KPlayer::initialSize (void)
  1808. {
  1809. #ifdef DEBUG_KPLAYER_WINDOW
  1810. kdDebugTime() << "KPlayer::initialSize (" << isMaximized() << ")\n";
  1811. #endif
  1812. TQSize size (settings() -> displaySize());
  1813. if ( settings() -> constrainedSize() || settings() -> properties() -> hasVideo() || ! size.isEmpty() )
  1814. return;
  1815. for ( int i = 0; i <= VOLUME_TOOLBAR; i ++ )
  1816. if ( toolBar (m_toolbar[i].name) -> orientation() == TQt::Vertical && m_toolbar[i].normally_visible )
  1817. // && toggleAction (m_toolbar[i].action) -> isChecked() )
  1818. {
  1819. size.setHeight (kPlayerWorkspace() -> height());
  1820. break;
  1821. }
  1822. #ifdef DEBUG_KPLAYER_RESIZING
  1823. kdDebugTime() << " " << log() -> isHidden() << " " << log() -> place() << " " << library() -> isHidden() << " " << library() -> place() << "\n";
  1824. #endif
  1825. if ( library() -> isShown() && library() -> place() == TQDockWindow::InDock
  1826. || log() -> isShown() && log() -> place() == TQDockWindow::InDock )
  1827. size.setWidth (kPlayerWorkspace() -> width());
  1828. settings() -> setDisplaySize (size);
  1829. }
  1830. void KPlayer::correctSize (void)
  1831. {
  1832. //syncronizeEvents();
  1833. bool maximized = isMaximized();
  1834. #ifdef DEBUG_KPLAYER_WINDOW
  1835. kdDebugTime() << "KPlayer::correctSize (" << maximized << ")\n";
  1836. #endif
  1837. if ( settings() -> fullScreen() )
  1838. layout() -> setSpacing (-1);
  1839. else if ( ! maximized && settings() -> maximized() )
  1840. {
  1841. #ifdef DEBUG_KPLAYER_SIZING_HACKS
  1842. if ( m_maximized )
  1843. {
  1844. #ifdef DEBUG_KPLAYER_WINDOW
  1845. kdDebugTime() << " Using normal geometry\n";
  1846. #endif
  1847. //syncronizeEvents();
  1848. move (m_normal_geometry.x(), m_normal_geometry.y());
  1849. resize (m_normal_geometry.width(), m_normal_geometry.height());
  1850. m_maximized = false;
  1851. activateLayout();
  1852. }
  1853. #endif
  1854. #ifdef DEBUG_KPLAYER_WINDOW
  1855. kdDebugTime() << "KPlayer::correctSize: setMaximized (false)\n";
  1856. #endif
  1857. settings() -> setMaximized (maximized);
  1858. }
  1859. if ( settings() -> constrainedSize() )
  1860. {
  1861. if ( maximized && ! settings() -> maximized() )
  1862. {
  1863. #ifdef DEBUG_KPLAYER_WINDOW
  1864. kdDebugTime() << "KPlayer::correctSize: setMaximized (true)\n";
  1865. #endif
  1866. settings() -> setMaximized (maximized);
  1867. }
  1868. return;
  1869. }
  1870. if ( m_previous_size != size() )
  1871. {
  1872. if ( maximized )
  1873. {
  1874. #ifdef DEBUG_KPLAYER_WINDOW
  1875. kdDebugTime() << "KPlayer::correctSize: setMaximized (true)\n";
  1876. #endif
  1877. settings() -> setMaximized (maximized);
  1878. }
  1879. else
  1880. settings() -> setDisplaySize (settings() -> adjustSize (kPlayerWorkspace() -> size(), m_previous_size.width() == width()));
  1881. }
  1882. #ifdef DEBUG_KPLAYER_WINDOW
  1883. else
  1884. kdDebugTime() << " Using previous size\n";
  1885. #endif
  1886. }
  1887. void KPlayer::windowStateChanged (uint wid)
  1888. {
  1889. #ifdef DEBUG_KPLAYER_WINDOW
  1890. kdDebugTime() << "KPlayer::windowStateChanged (" << wid << ")\n";
  1891. #endif
  1892. if ( wid == winId() )
  1893. {
  1894. m_set_display_size = true;
  1895. m_full_screen = isFullScreen();
  1896. #ifdef DEBUG_KPLAYER_WINDOW
  1897. kdDebugTime() << " Full screen " << m_full_screen << "\n";
  1898. #endif
  1899. bool full_screen = settings() -> fullScreen();
  1900. settings() -> setFullScreen (m_full_screen);
  1901. if ( ! full_screen && m_full_screen )
  1902. toFullScreen();
  1903. else if ( full_screen && ! m_full_screen )
  1904. toNormalScreen();
  1905. }
  1906. }
  1907. void KPlayer::syncronize (bool user_resize)
  1908. {
  1909. #ifdef DEBUG_KPLAYER_WINDOW
  1910. kdDebugTime() << "KPlayer::syncronize (" << user_resize << ")\n";
  1911. #endif
  1912. if ( settings() -> fullScreen() )
  1913. {
  1914. if ( ! m_full_screen && ! user_resize )
  1915. toFullScreen();
  1916. return;
  1917. }
  1918. if ( m_full_screen )
  1919. {
  1920. if ( user_resize )
  1921. return;
  1922. else
  1923. toNormalScreen();
  1924. }
  1925. if ( settings() -> maximized() )
  1926. {
  1927. if ( ! isMaximized() )
  1928. showMaximized();
  1929. return;
  1930. }
  1931. if ( isMaximized() )
  1932. showNormal();
  1933. }
  1934. //extern uint qGlobalPostedEventsCount (void);
  1935. /*void KPlayer::syncronizeEvents (void)
  1936. {
  1937. #ifdef DEBUG_KPLAYER_WINDOW
  1938. kdDebugTime() << "KPlayer::syncronizeEvents\n";
  1939. #endif
  1940. TQApplication::syncX();
  1941. bool rv = TQApplication::eventLoop() -> processEvents (TQEventLoop::ExcludeUserInput | TQEventLoop::ExcludeSocketNotifiers);
  1942. #ifdef DEBUG_KPLAYER_WINDOW
  1943. kdDebugTime() << "KPlayer::syncronizeEvents: processEvents returned " << rv << "\n";
  1944. //kdDebugTime() << "KPlayer::syncronizeEvents: posted event count " << qGlobalPostedEventsCount() << "\n";
  1945. #endif
  1946. //TQApplication::sendPostedEvents();
  1947. //TQApplication::sendPostedEvents (this, TQEvent::Resize);
  1948. //TQApplication::sendPostedEvents (this, TQEvent::Move);
  1949. //TQApplication::sendPostedEvents (this, TQEvent::LayoutHint);
  1950. //TQApplication::sendPostedEvents (kPlayerWorkspace(), TQEvent::Resize);
  1951. #ifdef DEBUG_KPLAYER_WINDOW
  1952. //kdDebugTime() << "KPlayer::syncronizeEvents: posted event count " << qGlobalPostedEventsCount() << "\n";
  1953. //kdDebugTime() << "KPlayer::syncronizeEvents done\n";
  1954. #endif
  1955. }*/
  1956. void KPlayer::zoom (void)
  1957. {
  1958. if ( m_full_screen )
  1959. return;
  1960. #ifdef DEBUG_KPLAYER_WINDOW
  1961. kdDebugTime() << "KPlayer::zoom\n";
  1962. #endif
  1963. TQSize target (minimumSizeHint());
  1964. TQRect available (availableGeometry());
  1965. TDEMainWindow::setMinimumSize (target.width(), target.height());
  1966. do_zoom();
  1967. target = frameGeometry().size() + settings() -> displaySize().expandedTo (TQSize (1, 1)) - centralWidget() -> size();
  1968. TQt::Dock dock;
  1969. int index, offset;
  1970. bool newline;
  1971. if ( ! log() -> isHidden() && getLocation (log(), dock, index, newline, offset)
  1972. && ((dock == TQt::DockLeft || dock == TQt::DockRight) && target.width() >= available.width()
  1973. || (dock == TQt::DockTop || dock == TQt::DockBottom) && target.height() >= available.height()) )
  1974. {
  1975. #ifdef DEBUG_KPLAYER_RESIZING
  1976. kdDebugTime() << "Log dock " << dock << " " << index << " " << newline << " " << offset << " " << log() -> x() << "x" << log() -> y() << " " << log() -> width() << "x" << log() -> height() << "\n";
  1977. kdDebugTime() << "Minimum log size " << log() -> minimumWidth() << "x" << log() -> minimumHeight() << "\n";
  1978. #endif
  1979. if ( (dock == TQt::DockLeft || dock == TQt::DockRight)
  1980. && log() -> width() - log() -> minimumWidth() > target.width() - available.width() )
  1981. {
  1982. #ifdef DEBUG_KPLAYER_RESIZING
  1983. kdDebugTime() << "New log width " << (log() -> width() - target.width() + available.width()) << "\n";
  1984. #endif
  1985. log() -> setFixedExtentWidth (log() -> width() - target.width() + available.width());
  1986. }
  1987. else if ( (dock == TQt::DockTop || dock == TQt::DockBottom)
  1988. && log() -> height() - log() -> minimumHeight() > target.height() - available.height() )
  1989. {
  1990. #ifdef DEBUG_KPLAYER_RESIZING
  1991. kdDebugTime() << "New log height " << (log() -> height() - target.height() + available.height() - 1) << "\n";
  1992. #endif
  1993. log() -> setFixedExtentHeight (log() -> height() - target.height() + available.height() - 1);
  1994. }
  1995. else if ( m_show_log )
  1996. log() -> undock();
  1997. else
  1998. log() -> hide();
  1999. do_zoom();
  2000. target = frameGeometry().size() + settings() -> displaySize().expandedTo (TQSize (1, 1)) - centralWidget() -> size();
  2001. }
  2002. if ( ! library() -> isHidden() && getLocation (library(), dock, index, newline, offset)
  2003. && ((dock == TQt::DockLeft || dock == TQt::DockRight) && target.width() >= available.width()
  2004. || (dock == TQt::DockTop || dock == TQt::DockBottom) && target.height() >= available.height()) )
  2005. {
  2006. #ifdef DEBUG_KPLAYER_RESIZING
  2007. kdDebugTime() << "Library dock " << dock << " " << index << " " << newline << " " << offset << " " << library() -> x() << "x" << library() -> y() << " " << library() -> width() << "x" << library() -> height() << "\n";
  2008. kdDebugTime() << "Minimum library size " << library() -> minimumWidth() << "x" << library() -> minimumHeight() << "\n";
  2009. #endif
  2010. if ( (dock == TQt::DockLeft || dock == TQt::DockRight)
  2011. && library() -> width() - library() -> minimumWidth() > target.width() - available.width() )
  2012. {
  2013. #ifdef DEBUG_KPLAYER_RESIZING
  2014. kdDebugTime() << "New library width " << (library() -> width() - target.width() + available.width()) << "\n";
  2015. #endif
  2016. library() -> setFixedExtentWidth (library() -> width() - target.width() + available.width());
  2017. }
  2018. else if ( (dock == TQt::DockTop || dock == TQt::DockBottom)
  2019. && library() -> height() - library() -> minimumHeight() > target.height() - available.height() )
  2020. //>= target.height() - available.height() )
  2021. {
  2022. #ifdef DEBUG_KPLAYER_RESIZING
  2023. kdDebugTime() << "New library height " << (library() -> height() - target.height() + available.height() - 1) << "\n";
  2024. #endif
  2025. library() -> setFixedExtentHeight (library() -> height() - target.height() + available.height() - 1);
  2026. }
  2027. else if ( m_show_library )
  2028. library() -> undock();
  2029. else
  2030. library() -> hide();
  2031. do_zoom();
  2032. target = frameGeometry().size() + settings() -> displaySize().expandedTo (TQSize (1, 1)) - centralWidget() -> size();
  2033. }
  2034. int i = 0;
  2035. while ( centralWidget() -> size() != settings() -> displaySize().expandedTo (TQSize (1, 1)) && i ++ < 5 )
  2036. {
  2037. settings() -> setDisplaySize (settings() -> constrainSize (centralWidget() -> size()
  2038. + available.size() - frameGeometry().size() - TQSize (1, 1)));
  2039. do_zoom();
  2040. }
  2041. m_show_log = m_show_library = false;
  2042. do_move (frameGeometry());
  2043. m_previous_size = size();
  2044. activateLayout();
  2045. //KPlayerX11SendConfigureEvent (winId(), geometry().x(), geometry().y(), width(), height());
  2046. //syncronizeEvents();
  2047. //layout() -> invalidate();
  2048. //TQApplication::postEvent (this, new TQResizeEvent (size(), size()));
  2049. //KPlayerX11SendConfigureEvent (winId(), geometry().x(), geometry().y(), width(), height());
  2050. TQApplication::syncX();
  2051. //KPlayerX11DiscardConfigureEvents (winId());
  2052. KPlayerX11DiscardConfigureEvents (kPlayerWorkspace() -> winId());
  2053. //syncronizeEvents();
  2054. TQApplication::postEvent (this, new TQEvent (TQEvent::LayoutHint));
  2055. //checkBarActions();
  2056. #ifdef DEBUG_KPLAYER_WINDOW
  2057. kdDebugTime() << "Zoom done\n";
  2058. #endif
  2059. }
  2060. void KPlayer::do_move (const TQRect& frame)
  2061. {
  2062. TQRect available (availableGeometry());
  2063. bool xl = geometry().left() < available.left();
  2064. bool xr = frame.right() > available.right();
  2065. bool yt = frame.top() < available.top();
  2066. bool yb = frame.bottom() > available.bottom();
  2067. if ( xl || xr || yt || yb )
  2068. {
  2069. int xc = ! xl && ! xr ? x() : xr && available.width() > frame.width() ? available.right() - frame.width()
  2070. : available.left();
  2071. int yc = ! yt && ! yb ? y() : yb && available.height() > frame.height() ? available.bottom() - frame.height()
  2072. : available.top();
  2073. #ifdef DEBUG_KPLAYER_RESIZING
  2074. kdDebugTime() << "Moving to " << xc << "x" << yc << "\n";
  2075. #endif
  2076. move (xc, yc);
  2077. }
  2078. }
  2079. void KPlayer::activateLayout (void)
  2080. {
  2081. #ifdef DEBUG_KPLAYER_RESIZING
  2082. kdDebugTime() << "KPlayer::activateLayout\n";
  2083. #endif
  2084. layout() -> activate();
  2085. TQApplication::sendPostedEvents (this, TQEvent::Resize);
  2086. TQApplication::sendPostedEvents (this, TQEvent::Move);
  2087. TQApplication::sendPostedEvents (this, TQEvent::LayoutHint);
  2088. TQApplication::sendPostedEvents (kPlayerWorkspace(), TQEvent::Resize);
  2089. #ifdef DEBUG_KPLAYER_RESIZING
  2090. kdDebugTime() << "KPlayer::activateLayout done\n";
  2091. #endif
  2092. }
  2093. void KPlayer::do_zoom (void)
  2094. {
  2095. TQRect available (availableGeometry());
  2096. //if ( isMaximized() )
  2097. // showNormal();
  2098. activateLayout();
  2099. TQSize minimum (minimumSizeHint());
  2100. TQSize video (settings() -> displaySize().expandedTo (TQSize (1, 1)));
  2101. TQSize cwsize (centralWidget() -> size());
  2102. TQSize target (size() + video - cwsize);
  2103. if ( target.width() < minimum.width() || target.height() < minimum.height() )
  2104. {
  2105. settings() -> setDisplaySize (cwsize);
  2106. video = settings() -> displaySize().expandedTo (TQSize (1, 1));
  2107. target = size();
  2108. }
  2109. #ifdef DEBUG_KPLAYER_RESIZING
  2110. kdDebugTime() << "Display " << video.width() << "x" << video.height() << "\n";
  2111. kdDebugTime() << " Window " << geometry().x() << "x" << geometry().y() << " " << width() << "x" << height() << "\n";
  2112. kdDebugTime() << " WFrame " << x() << "x" << y() << " " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  2113. kdDebugTime() << " WSpace " << cwsize.width() << "x" << cwsize.height() << "\n";
  2114. kdDebugTime() << " Widget " << kPlayerWidget() -> size().width() << "x" << kPlayerWidget() -> size().height() << "\n";
  2115. kdDebugTime() << " Target " << target.width() << "x" << target.height() << "\n";
  2116. /* << "\n Total " << minimumSize().width() << "x" << minimumSize().height()
  2117. << " " << minimumSizeHint().width() << "x" << minimumSizeHint().height()
  2118. << " " << sizeHint().width() << "x" << sizeHint().height()
  2119. << "\n Top " << topDock() -> minimumSize().width() << "x" << topDock() -> minimumSize().height()
  2120. << " " << topDock() -> minimumSizeHint().width() << "x" << topDock() -> minimumSizeHint().height()
  2121. << " " << topDock() -> sizeHint().width() << "x" << topDock() -> sizeHint().height()
  2122. << "\n Bottom " << bottomDock() -> minimumSize().width() << "x" << bottomDock() -> minimumSize().height()
  2123. << " " << bottomDock() -> minimumSizeHint().width() << "x" << bottomDock() -> minimumSizeHint().height()
  2124. << " " << bottomDock() -> sizeHint().width() << "x" << bottomDock() -> sizeHint().height()
  2125. << "\n Layout " << layout() -> minimumSize().width() << "x" << layout() -> minimumSize().height()
  2126. << " " << layout() -> sizeHint().width() << "x" << layout() -> sizeHint().height()
  2127. << "\n " << layout() -> minimumSize().width() << "x" << layout() -> minimumSize().height()
  2128. << " " << layout() -> sizeHint().width() << "x" << layout() -> sizeHint().height() << "\n"; */
  2129. #endif
  2130. int i = 0;
  2131. while ( target != size() && i ++ < 5 )
  2132. {
  2133. cwsize = target - size();
  2134. TQRect rect (frameGeometry());
  2135. rect.addCoords (0, 0, cwsize.width(), cwsize.height());
  2136. if ( rect.width() > available.width() || rect.height() > available.height() )
  2137. break;
  2138. do_move (rect);
  2139. resize (target);
  2140. //if ( isMaximized() )
  2141. // showNormal();
  2142. activateLayout();
  2143. cwsize = centralWidget() -> size();
  2144. target = size() + video - cwsize;
  2145. if ( target.width() < minimum.width() || target.height() < minimum.height() )
  2146. {
  2147. settings() -> setDisplaySize (cwsize);
  2148. video = settings() -> displaySize().expandedTo (TQSize (1, 1));
  2149. target = size();
  2150. }
  2151. #ifdef DEBUG_KPLAYER_RESIZING
  2152. kdDebugTime() << "Window " << width() << "x" << height() << "\n";
  2153. kdDebugTime() << " WFrame " << frameGeometry().width() << "x" << frameGeometry().height() << "\n";
  2154. kdDebugTime() << " WSpace " << cwsize.width() << "x" << cwsize.height() << "\n";
  2155. kdDebugTime() << " Widget " << kPlayerWidget() -> size().width() << "x" << kPlayerWidget() -> size().height() << "\n";
  2156. kdDebugTime() << " Target " << target.width() << "x" << target.height() << "\n";
  2157. /* << " Total " << minimumSize().width() << "x" << minimumSize().height()
  2158. << " " << minimumSizeHint().width() << "x" << minimumSizeHint().height()
  2159. << " " << sizeHint().width() << "x" << sizeHint().height()
  2160. << "\n Top " << topDock() -> minimumSize().width() << "x" << topDock() -> minimumSize().height()
  2161. << " " << topDock() -> minimumSizeHint().width() << "x" << topDock() -> minimumSizeHint().height()
  2162. << " " << topDock() -> sizeHint().width() << "x" << topDock() -> sizeHint().height()
  2163. << "\n Bottom " << bottomDock() -> minimumSize().width() << "x" << bottomDock() -> minimumSize().height()
  2164. << " " << bottomDock() -> minimumSizeHint().width() << "x" << bottomDock() -> minimumSizeHint().height()
  2165. << " " << bottomDock() -> sizeHint().width() << "x" << bottomDock() -> sizeHint().height()
  2166. << "\n Layout " << layout() -> minimumSize().width() << "x" << layout() -> minimumSize().height()
  2167. << " " << layout() -> sizeHint().width() << "x" << layout() -> sizeHint().height()
  2168. << "\n " << layout() -> minimumSize().width() << "x" << layout() -> minimumSize().height()
  2169. << " " << layout() -> sizeHint().width() << "x" << layout() -> sizeHint().height() << "\n"; */
  2170. #endif
  2171. }
  2172. #ifdef DEBUG_KPLAYER_RESIZING
  2173. if ( target != size() )
  2174. kdDebugTime() << "Zoom unsuccessful\n";
  2175. #endif
  2176. }
  2177. TQRect KPlayer::availableGeometry (void) const
  2178. {
  2179. TQRect rect;
  2180. if ( ! TQApplication::desktop() -> isVirtualDesktop() )
  2181. {
  2182. rect = TQApplication::desktop() -> availableGeometry();
  2183. #ifdef DEBUG_KPLAYER_RESIZING
  2184. kdDebugTime() << "Screen " << TQApplication::desktop() -> screenGeometry().x()
  2185. << "x" << TQApplication::desktop() -> screenGeometry().y()
  2186. << " " << TQApplication::desktop() -> screenGeometry().width()
  2187. << "x" << TQApplication::desktop() -> screenGeometry().height() << "\n";
  2188. #endif
  2189. }
  2190. else
  2191. for ( int i = 0; i < TQApplication::desktop() -> numScreens(); i ++ )
  2192. {
  2193. rect |= TQApplication::desktop() -> availableGeometry (i);
  2194. #ifdef DEBUG_KPLAYER_RESIZING
  2195. kdDebugTime() << "Screen " << i << " " << TQApplication::desktop() -> screenGeometry (i).x()
  2196. << "x" << TQApplication::desktop() -> screenGeometry (i).y()
  2197. << " " << TQApplication::desktop() -> screenGeometry (i).width()
  2198. << "x" << TQApplication::desktop() -> screenGeometry (i).height() << "\n";
  2199. kdDebugTime() << "Available " << TQApplication::desktop() -> availableGeometry (i).x()
  2200. << "x" << TQApplication::desktop() -> availableGeometry (i).y()
  2201. << " " << TQApplication::desktop() -> availableGeometry (i).width()
  2202. << "x" << TQApplication::desktop() -> availableGeometry (i).height() << "\n";
  2203. #endif
  2204. }
  2205. #ifdef DEBUG_KPLAYER_RESIZING
  2206. kdDebugTime() << "Desktop " << TQApplication::desktop() -> width() << "x" << TQApplication::desktop() -> height() << "\n";
  2207. kdDebugTime() << "Total available geometry " << rect.width() << "x" << rect.height() << "\n";
  2208. #endif
  2209. return rect;
  2210. }
  2211. /*void KPlayer::barOrientationChanged (Orientation)
  2212. {
  2213. kdDebugTime() << "A bar orientation has changed.\n";
  2214. kdDebugTime() << "Central Widget Size: " << centralWidget() -> width() << "x" << centralWidget() -> height()
  2215. << ", KPlayer Widget Size: " << kPlayerWidget() -> width() << "x" << kPlayerWidget() -> height() << ".\n";
  2216. }
  2217. void KPlayer::barPlaceChanged (TQDockWindow::Place)
  2218. {
  2219. kdDebugTime() << "A bar place has changed.\n";
  2220. kdDebugTime() << "Central Widget Size: " << centralWidget() -> width() << "x" << centralWidget() -> height()
  2221. << ", KPlayer Widget Size: " << kPlayerWidget() -> width() << "x" << kPlayerWidget() -> height() << ".\n";
  2222. }
  2223. void KPlayer::barVisibilityChanged (bool)
  2224. {
  2225. kdDebugTime() << "A bar visibility has changed.\n";
  2226. kdDebugTime() << "Central Widget Size: " << centralWidget() -> width() << "x" << centralWidget() -> height()
  2227. << ", KPlayer Widget Size: " << kPlayerWidget() -> width() << "x" << kPlayerWidget() -> height() << ".\n";
  2228. }*/