Changeset 186 for smplayer/vendor/current/src/baseguiplus.cpp
- Timestamp:
- Jan 24, 2017, 12:24:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/baseguiplus.cpp
r179 r186 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 … … 231 256 #ifdef SCREENS_SUPPORT 232 257 videoMenu->insertMenu(videosize_menu->menuAction(), sendToScreen_menu); 233 //optionsMenu->addMenu(sendToScreen_menu);234 258 235 259 if (!pref->tablet_mode) { … … 239 263 240 264 access_menu->insertMenu(tabletModeAct, sendToScreen_menu); 265 #endif 266 267 #ifdef SEND_AUDIO_OPTION 268 audioMenu->insertMenu(audiofilter_menu->menuAction(), sendAudio_menu); 269 #endif 270 271 #ifdef CHROMECAST_SUPPORT 272 playMenu->addSeparator(); 273 playMenu->addAction(playOnChromecastAct); 241 274 #endif 242 275 } … … 259 292 } 260 293 294 void BaseGuiPlus::updateWidgets() { 295 qDebug("BaseGuiPlus::updateWidgets"); 296 297 BaseGui::updateWidgets(); 298 299 #ifdef CHROMECAST_SUPPORT 300 playOnChromecastAct->setEnabled(!core->mdat.filename.isEmpty()); 301 #endif 302 } 303 261 304 void BaseGuiPlus::closeWindow() { 262 305 qDebug("BaseGuiPlus::closeWindow"); … … 298 341 299 342 #if DOCK_PLAYLIST 300 343 // playlistdock->setWindowTitle( tr("Playlist") ); 301 344 #endif 302 345 303 346 #ifdef DETACH_VIDEO_OPTION 304 347 detachVideoAct->change("Detach video"); 348 #endif 349 350 #ifdef CHROMECAST_SUPPORT 351 playOnChromecastAct->change(Images::icon("chromecast"), tr("Play on &Chromecast")); 305 352 #endif 306 353 … … 312 359 detached_label->setText("<img src=\"" + Images::file("send_to_screen") + "\">" + 313 360 "<p style=\"color: white;\">" + tr("Video is sent to an external screen") +"</p"); 361 #endif 362 363 #ifdef SEND_AUDIO_OPTION 364 sendAudio_menu->menuAction()->setText( tr("Send &audio to") ); 365 sendAudio_menu->menuAction()->setIcon(Images::icon("send_audio")); 314 366 #endif 315 367 } … … 471 523 472 524 void BaseGuiPlus::updateMediaInfo() { 473 525 qDebug("BaseGuiPlus::updateMediaInfo"); 474 526 BaseGui::updateMediaInfo(); 475 527 … … 962 1014 #endif 963 1015 1016 #ifdef SEND_AUDIO_OPTION 1017 void BaseGuiPlus::updateSendAudioMenu() { 1018 qDebug("BaseGuiPlus::updateSendAudioMenu"); 1019 1020 sendAudio_menu->clear(); 1021 QAction * a = new QAction(sendAudio_menu); 1022 a->setText(tr("&Default audio device")); 1023 a->setData(""); 1024 connect(a, SIGNAL(triggered()), this, SLOT(sendAudioClicked())); 1025 sendAudio_menu->addAction(a); 1026 1027 #if USE_PULSEAUDIO_DEVICES 1028 addListToSendAudioMenu( DeviceInfo::paDevices(), "pulse"); 1029 #endif 1030 1031 #if USE_ALSA_DEVICES 1032 addListToSendAudioMenu( DeviceInfo::alsaDevices(), "alsa"); 1033 #endif 1034 1035 #if USE_DSOUND_DEVICES 1036 if (PlayerID::player(pref->mplayer_bin) == PlayerID::MPLAYER) { 1037 addListToSendAudioMenu( DeviceInfo::dsoundDevices(), "dsound"); 1038 } 1039 #endif 1040 1041 #if MPV_AUDIO_DEVICES 1042 if (PlayerID::player(pref->mplayer_bin) == PlayerID::MPV) { 1043 DeviceInfo::setMpvBin(pref->mplayer_bin); 1044 1045 #if USE_MPV_ALSA_DEVICES 1046 addListToSendAudioMenu( DeviceInfo::mpvAlsaDevices(), "alsa"); 1047 #endif 1048 1049 #if USE_MPV_WASAPI_DEVICES 1050 addListToSendAudioMenu( DeviceInfo::mpvWasapiDevices(), "wasapi"); 1051 #endif 1052 } 1053 #endif 1054 } 1055 1056 void BaseGuiPlus::addListToSendAudioMenu(const DeviceList & audio_devices, const QString & device_name) { 1057 for (int n = 0; n < audio_devices.count(); n++) { 1058 QAction * a = new QAction(sendAudio_menu); 1059 a->setText( DeviceInfo::printableName(device_name, audio_devices[n]) ); 1060 a->setData( DeviceInfo::internalName(device_name, audio_devices[n]) ); 1061 connect(a, SIGNAL(triggered()), this, SLOT(sendAudioClicked())); 1062 sendAudio_menu->addAction(a); 1063 } 1064 } 1065 1066 void BaseGuiPlus::sendAudioClicked() { 1067 QAction * a = qobject_cast<QAction *> (sender()); 1068 if (a) { 1069 QString device = a->data().toString(); 1070 qDebug() << "BaseGuiPlus::sendAudioClicked: device:" << device; 1071 core->changeAO(device); 1072 } 1073 } 1074 #endif 1075 1076 #ifdef CHROMECAST_SUPPORT 1077 void BaseGuiPlus::playOnChromecast() { 1078 qDebug("BaseGuiPlus::playOnChromecast"); 1079 1080 qDebug() << "BaseGuiPlus::playOnChromecast: type:" << core->mdat.type; 1081 qDebug() << "BaseGuiPlus::playOnChromecast: filename:" << core->mdat.filename; 1082 qDebug() << "BaseGuiPlus::playOnChromecast: stream_url:" << core->mdat.stream_url; 1083 qDebug() << "BaseGuiPlus::playOnChromecast: stream_title:" << core->mdat.stream_title; 1084 qDebug() << "BaseGuiPlus::playOnChromecast: stream_path:" << core->mdat.stream_path; 1085 1086 QString title = core->mdat.displayName(true); 1087 if (core->mdat.type == TYPE_STREAM) { 1088 QString url = core->mdat.filename; 1089 if (!core->mdat.stream_path.isEmpty()) url = core->mdat.stream_path; 1090 Chromecast::instance()->openStream(url, title); 1091 } 1092 else 1093 if (core->mdat.type == TYPE_FILE) { 1094 Chromecast::instance()->openLocal(core->mdat.filename, title); 1095 } 1096 } 1097 #endif 1098 964 1099 #include "moc_baseguiplus.cpp"
Note:
See TracChangeset
for help on using the changeset viewer.