Changeset 188 for smplayer/trunk/src/baseguiplus.cpp
- Timestamp:
- Jan 24, 2017, 12:41:54 PM (8 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 186
- Property svn:mergeinfo changed
-
smplayer/trunk/src/baseguiplus.cpp
r182 r188 1 1 /* smplayer, GUI front-end for mplayer. 2 Copyright (C) 2006-201 6Ricardo Villalba <rvm@users.sourceforge.net>2 Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net> 3 3 4 4 This program is free software; you can redistribute it and/or modify … … 62 62 #include "preferencesdialog.h" 63 63 #include "prefinput.h" 64 #endif 65 66 #ifdef CHROMECAST_SUPPORT 67 #include "chromecast.h" 64 68 #endif 65 69 … … 137 141 playlistdock->setFloating(false); // To avoid that the playlist is visible for a moment 138 142 playlistdock->setWidget(playlist); 143 playlistdock->setWindowTitle(playlist->windowTitle()); 139 144 playlistdock->setAllowedAreas(Qt::TopDockWidgetArea | 140 145 Qt::BottomDockWidgetArea … … 149 154 150 155 connect( playlistdock, SIGNAL(closed()), this, SLOT(playlistClosed()) ); 156 connect(playlist, SIGNAL(windowTitleChanged(const QString &)), playlistdock, SLOT(setWindowTitle(const QString &))); 151 157 #if USE_DOCK_TOPLEVEL_EVENT 152 158 connect( playlistdock, SIGNAL(topLevelChanged(bool)), … … 166 172 detachVideoAct->setCheckable(true); 167 173 connect(detachVideoAct, SIGNAL(toggled(bool)), this, SLOT(detachVideo(bool))); 174 #endif 175 176 #ifdef CHROMECAST_SUPPORT 177 playOnChromecastAct = new MyAction(this, "play_on_chromecast"); 178 connect(playOnChromecastAct, SIGNAL(triggered()), this, SLOT(playOnChromecast())); 168 179 #endif 169 180 … … 200 211 #endif 201 212 213 #ifdef SEND_AUDIO_OPTION 214 sendAudio_menu = new QMenu(this); 215 sendAudio_menu->menuAction()->setObjectName("send_audio_menu"); 216 updateSendAudioMenu(); 217 #endif 218 202 219 #ifdef GLOBALSHORTCUTS 203 220 global_shortcuts = new GlobalShortcuts(this); … … 206 223 #endif 207 224 225 #ifdef CHROMECAST_SUPPORT 226 Chromecast::instance()->setSettings(settings); 227 #endif 228 208 229 retranslateStrings(); 209 230 loadConfig(); … … 213 234 saveConfig(); 214 235 tray->hide(); 236 237 #ifdef CHROMECAST_SUPPORT 238 Chromecast::deleteInstance(); 239 #endif 215 240 } 216 241 … … 237 262 #ifdef SCREENS_SUPPORT 238 263 videoMenu->insertMenu(videosize_menu->menuAction(), sendToScreen_menu); 239 //optionsMenu->addMenu(sendToScreen_menu);240 264 241 265 if (!pref->tablet_mode) { … … 245 269 246 270 access_menu->insertMenu(tabletModeAct, sendToScreen_menu); 271 #endif 272 273 #ifdef SEND_AUDIO_OPTION 274 audioMenu->insertMenu(audiofilter_menu->menuAction(), sendAudio_menu); 275 #endif 276 277 #ifdef CHROMECAST_SUPPORT 278 playMenu->addSeparator(); 279 playMenu->addAction(playOnChromecastAct); 247 280 #endif 248 281 } … … 265 298 } 266 299 300 void BaseGuiPlus::updateWidgets() { 301 qDebug("BaseGuiPlus::updateWidgets"); 302 303 BaseGui::updateWidgets(); 304 305 #ifdef CHROMECAST_SUPPORT 306 playOnChromecastAct->setEnabled(!core->mdat.filename.isEmpty()); 307 #endif 308 } 309 267 310 void BaseGuiPlus::closeWindow() { 268 311 qDebug("BaseGuiPlus::closeWindow"); … … 304 347 305 348 #if DOCK_PLAYLIST 306 349 // playlistdock->setWindowTitle( tr("Playlist") ); 307 350 #endif 308 351 309 352 #ifdef DETACH_VIDEO_OPTION 310 353 detachVideoAct->change("Detach video"); 354 #endif 355 356 #ifdef CHROMECAST_SUPPORT 357 playOnChromecastAct->change(Images::icon("chromecast"), tr("Play on &Chromecast")); 311 358 #endif 312 359 … … 318 365 detached_label->setText("<img src=\"" + Images::file("send_to_screen") + "\">" + 319 366 "<p style=\"color: white;\">" + tr("Video is sent to an external screen") +"</p"); 367 #endif 368 369 #ifdef SEND_AUDIO_OPTION 370 sendAudio_menu->menuAction()->setText( tr("Send &audio to") ); 371 sendAudio_menu->menuAction()->setIcon(Images::icon("send_audio")); 320 372 #endif 321 373 } … … 477 529 478 530 void BaseGuiPlus::updateMediaInfo() { 479 531 qDebug("BaseGuiPlus::updateMediaInfo"); 480 532 BaseGui::updateMediaInfo(); 481 533 … … 980 1032 #endif 981 1033 1034 #ifdef SEND_AUDIO_OPTION 1035 void BaseGuiPlus::updateSendAudioMenu() { 1036 qDebug("BaseGuiPlus::updateSendAudioMenu"); 1037 1038 sendAudio_menu->clear(); 1039 QAction * a = new QAction(sendAudio_menu); 1040 a->setText(tr("&Default audio device")); 1041 a->setData(""); 1042 connect(a, SIGNAL(triggered()), this, SLOT(sendAudioClicked())); 1043 sendAudio_menu->addAction(a); 1044 1045 #if USE_PULSEAUDIO_DEVICES 1046 addListToSendAudioMenu( DeviceInfo::paDevices(), "pulse"); 1047 #endif 1048 1049 #if USE_ALSA_DEVICES 1050 addListToSendAudioMenu( DeviceInfo::alsaDevices(), "alsa"); 1051 #endif 1052 1053 #if USE_DSOUND_DEVICES 1054 if (PlayerID::player(pref->mplayer_bin) == PlayerID::MPLAYER) { 1055 addListToSendAudioMenu( DeviceInfo::dsoundDevices(), "dsound"); 1056 } 1057 #endif 1058 1059 #if MPV_AUDIO_DEVICES 1060 if (PlayerID::player(pref->mplayer_bin) == PlayerID::MPV) { 1061 DeviceInfo::setMpvBin(pref->mplayer_bin); 1062 1063 #if USE_MPV_ALSA_DEVICES 1064 addListToSendAudioMenu( DeviceInfo::mpvAlsaDevices(), "alsa"); 1065 #endif 1066 1067 #if USE_MPV_WASAPI_DEVICES 1068 addListToSendAudioMenu( DeviceInfo::mpvWasapiDevices(), "wasapi"); 1069 #endif 1070 } 1071 #endif 1072 } 1073 1074 void BaseGuiPlus::addListToSendAudioMenu(const DeviceList & audio_devices, const QString & device_name) { 1075 for (int n = 0; n < audio_devices.count(); n++) { 1076 QAction * a = new QAction(sendAudio_menu); 1077 a->setText( DeviceInfo::printableName(device_name, audio_devices[n]) ); 1078 a->setData( DeviceInfo::internalName(device_name, audio_devices[n]) ); 1079 connect(a, SIGNAL(triggered()), this, SLOT(sendAudioClicked())); 1080 sendAudio_menu->addAction(a); 1081 } 1082 } 1083 1084 void BaseGuiPlus::sendAudioClicked() { 1085 QAction * a = qobject_cast<QAction *> (sender()); 1086 if (a) { 1087 QString device = a->data().toString(); 1088 qDebug() << "BaseGuiPlus::sendAudioClicked: device:" << device; 1089 core->changeAO(device); 1090 } 1091 } 1092 #endif 1093 1094 #ifdef CHROMECAST_SUPPORT 1095 void BaseGuiPlus::playOnChromecast() { 1096 qDebug("BaseGuiPlus::playOnChromecast"); 1097 1098 qDebug() << "BaseGuiPlus::playOnChromecast: type:" << core->mdat.type; 1099 qDebug() << "BaseGuiPlus::playOnChromecast: filename:" << core->mdat.filename; 1100 qDebug() << "BaseGuiPlus::playOnChromecast: stream_url:" << core->mdat.stream_url; 1101 qDebug() << "BaseGuiPlus::playOnChromecast: stream_title:" << core->mdat.stream_title; 1102 qDebug() << "BaseGuiPlus::playOnChromecast: stream_path:" << core->mdat.stream_path; 1103 1104 QString title = core->mdat.displayName(true); 1105 if (core->mdat.type == TYPE_STREAM) { 1106 QString url = core->mdat.filename; 1107 if (!core->mdat.stream_path.isEmpty()) url = core->mdat.stream_path; 1108 Chromecast::instance()->openStream(url, title); 1109 } 1110 else 1111 if (core->mdat.type == TYPE_FILE) { 1112 Chromecast::instance()->openLocal(core->mdat.filename, title); 1113 } 1114 } 1115 #endif 1116 982 1117 #include "moc_baseguiplus.cpp"
Note:
See TracChangeset
for help on using the changeset viewer.