void PageInput::OnUpdateVideoAreaFields() { switch(GetVideoArea()) { case VIDEO_AREA_SCREEN: { m_combobox_screens->setEnabled(true); m_pushbutton_video_select_rectangle->setEnabled(false); m_pushbutton_video_select_window->setEnabled(false); m_pushbutton_video_opengl_settings->setEnabled(false); GroupEnabled({m_label_video_x, m_spinbox_video_x, m_label_video_y, m_spinbox_video_y, m_label_video_w, m_spinbox_video_w, m_label_video_h, m_spinbox_video_h}, false); int sc = m_combobox_screens->currentIndex(); QRect rect; if(sc == 0) { rect = QApplication::desktop()->screenGeometry(0); for(int i = 1; i < QApplication::desktop()->screenCount(); ++i) { rect |= QApplication::desktop()->screenGeometry(i); } } else { rect = QApplication::desktop()->screenGeometry(sc - 1); } SetVideoX(rect.left()); SetVideoY(rect.top()); SetVideoW(rect.width()); SetVideoH(rect.height()); break; } case VIDEO_AREA_FIXED: { m_combobox_screens->setEnabled(false); m_pushbutton_video_select_rectangle->setEnabled(true); m_pushbutton_video_select_window->setEnabled(true); m_pushbutton_video_opengl_settings->setEnabled(false); GroupEnabled({m_label_video_x, m_spinbox_video_x, m_label_video_y, m_spinbox_video_y, m_label_video_w, m_spinbox_video_w, m_label_video_h, m_spinbox_video_h}, true); break; } case VIDEO_AREA_CURSOR: { m_combobox_screens->setEnabled(false); m_pushbutton_video_select_rectangle->setEnabled(true); m_pushbutton_video_select_window->setEnabled(true); m_pushbutton_video_opengl_settings->setEnabled(false); GroupEnabled({m_label_video_x, m_spinbox_video_x, m_label_video_y, m_spinbox_video_y}, false); GroupEnabled({m_label_video_w, m_spinbox_video_w, m_label_video_h, m_spinbox_video_h}, true); SetVideoX(0); SetVideoY(0); break; } case VIDEO_AREA_GLINJECT: { m_combobox_screens->setEnabled(false); m_pushbutton_video_select_rectangle->setEnabled(false); m_pushbutton_video_select_window->setEnabled(false); m_pushbutton_video_opengl_settings->setEnabled(true); GroupEnabled({m_label_video_x, m_spinbox_video_x, m_label_video_y, m_spinbox_video_y, m_label_video_w, m_spinbox_video_w, m_label_video_h, m_spinbox_video_h}, false); break; } default: break; } }
void PageInput::SetVideoAreaFromRubberBand() { QRect r = m_rubber_band_rect.normalized(); if(GetVideoArea() == VIDEO_AREA_CURSOR) { SetVideoX(0); SetVideoY(0); } else { SetVideoX(r.x()); SetVideoY(r.y()); } SetVideoW(r.width()); SetVideoH(r.height()); }
void PageInput::LoadSettings(QSettings* settings) { SetVideoArea((enum_video_area) settings->value("input/video_area", VIDEO_AREA_SCREEN).toUInt()); SetVideoAreaScreen(settings->value("input/video_area_screen", 0).toUInt()); SetVideoX(settings->value("input/video_x", 0).toUInt()); SetVideoY(settings->value("input/video_y", 0).toUInt()); SetVideoW(settings->value("input/video_w", 800).toUInt()); SetVideoH(settings->value("input/video_h", 600).toUInt()); SetVideoFrameRate(settings->value("input/video_frame_rate", 30).toUInt()); SetVideoScalingEnabled(settings->value("input_video/scale", false).toBool()); SetVideoScaledW(settings->value("input/video_scaled_w", 854).toUInt()); SetVideoScaledH(settings->value("input/video_scaled_h", 480).toUInt()); SetVideoRecordCursor(settings->value("input/video_record_cursor", true).toBool()); SetAudioEnabled(settings->value("input/audio_enabled", true).toBool()); SetAudioBackend((enum_audio_backend) settings->value("input/audio_backend", (m_pulseaudio_available)? AUDIO_BACKEND_PULSEAUDIO : AUDIO_BACKEND_ALSA).toUInt()); SetALSADevice(settings->value("input/audio_alsa_device", "default").toString()); SetPulseAudioSource(FindPulseAudioSource(settings->value("input/audio_pulseaudio_source", QString()).toString())); SetGLInjectCommand(settings->value("input/glinject_command", "").toString()); SetGLInjectRunCommand(settings->value("input/glinject_run_command", true).toBool()); SetGLInjectRelaxPermissions(settings->value("input/glinject_relax_permissions", false).toBool()); SetGLInjectMaxMegaPixels(settings->value("input/glinject_max_megapixels", 2).toUInt()); SetGLInjectCaptureFront(settings->value("input/glinject_capture_front", false).toBool()); SetGLInjectLimitFPS(settings->value("input/glinject_limit_fps", false).toBool()); OnUpdateVideoAreaFields(); OnUpdateVideoScaleFields(); OnUpdateAudioFields(); }
void PageInput::LoadProfileSettings(QSettings* settings) { // choose default audio backend #if SSR_USE_PULSEAUDIO enum_audio_backend default_audio_backend = (m_pulseaudio_available)? AUDIO_BACKEND_PULSEAUDIO : AUDIO_BACKEND_ALSA; #else enum_audio_backend default_audio_backend = AUDIO_BACKEND_ALSA; #endif // load settings SetVideoArea(StringToEnum(settings->value("input/video_area", QString()).toString(), VIDEO_AREA_SCREEN)); SetVideoAreaScreen(settings->value("input/video_area_screen", 0).toUInt()); SetVideoX(settings->value("input/video_x", 0).toUInt()); SetVideoY(settings->value("input/video_y", 0).toUInt()); SetVideoW(settings->value("input/video_w", 800).toUInt()); SetVideoH(settings->value("input/video_h", 600).toUInt()); SetVideoFrameRate(settings->value("input/video_frame_rate", 30).toUInt()); SetVideoScalingEnabled(settings->value("input/video_scale", false).toBool()); SetVideoScaledW(settings->value("input/video_scaled_w", 854).toUInt()); SetVideoScaledH(settings->value("input/video_scaled_h", 480).toUInt()); SetVideoRecordCursor(settings->value("input/video_record_cursor", true).toBool()); SetAudioEnabled(settings->value("input/audio_enabled", true).toBool()); SetAudioBackend(StringToEnum(settings->value("input/audio_backend", QString()).toString(), default_audio_backend)); SetALSASource(FindALSASource(settings->value("input/audio_alsa_source", QString()).toString())); #if SSR_USE_PULSEAUDIO SetPulseAudioSource(FindPulseAudioSource(settings->value("input/audio_pulseaudio_source", QString()).toString())); #endif #if SSR_USE_JACK SetJackConnectSystemCapture(settings->value("input/audio_jack_connect_system_capture", true).toBool()); SetJackConnectSystemPlayback(settings->value("input/audio_jack_connect_system_playback", false).toBool()); #endif SetGLInjectChannel(settings->value("input/glinject_channel", "channel-" + QString::fromStdString(GetUserName())).toString()); SetGLInjectRelaxPermissions(settings->value("input/glinject_relax_permissions", false).toBool()); SetGLInjectCommand(settings->value("input/glinject_command", "").toString()); SetGLInjectWorkingDirectory(settings->value("input/glinject_working_directory", "").toString()); SetGLInjectAutoLaunch(settings->value("input/glinject_auto_launch", false).toBool()); SetGLInjectLimitFPS(settings->value("input/glinject_limit_fps", false).toBool()); // update things OnUpdateRecordingFrame(); OnUpdateVideoAreaFields(); OnUpdateVideoScaleFields(); OnUpdateAudioFields(); }