Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSWidget.cpp
Show All 30 Lines | |||||
31 | #include <QDebug> | 31 | #include <QDebug> | ||
32 | #include <QFormLayout> | 32 | #include <QFormLayout> | ||
33 | #include <QGridLayout> | 33 | #include <QGridLayout> | ||
34 | #include <QLabel> | 34 | #include <QLabel> | ||
35 | #include <QPushButton> | 35 | #include <QPushButton> | ||
36 | #include <QShortcut> | 36 | #include <QShortcut> | ||
37 | 37 | | |||
38 | 38 | | |||
39 | KSWidget::KSWidget(QWidget *parent) : | 39 | KSWidget::KSWidget(const QVector<ImageGrabber::GrabMode>& supportedModes, QWidget *parent) : | ||
40 | QWidget(parent) | 40 | QWidget(parent) | ||
41 | { | 41 | { | ||
42 | // get a handle to the configuration manager | 42 | // get a handle to the configuration manager | ||
43 | 43 | | |||
44 | SpectacleConfig *configManager = SpectacleConfig::instance(); | 44 | SpectacleConfig *configManager = SpectacleConfig::instance(); | ||
45 | 45 | | |||
46 | // we'll init the widget that holds the image first | 46 | // we'll init the widget that holds the image first | ||
47 | 47 | | |||
48 | mImageWidget = new KSImageWidget(this); | 48 | mImageWidget = new KSImageWidget(this); | ||
49 | mImageWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 49 | mImageWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
50 | connect(mImageWidget, &KSImageWidget::dragInitiated, this, &KSWidget::dragInitiated); | 50 | connect(mImageWidget, &KSImageWidget::dragInitiated, this, &KSWidget::dragInitiated); | ||
51 | 51 | | |||
52 | // the capture mode options first | 52 | // the capture mode options first | ||
53 | 53 | | |||
54 | mCaptureModeLabel = new QLabel(i18n("<b>Capture Mode</b>"), this); | 54 | mCaptureModeLabel = new QLabel(i18n("<b>Capture Mode</b>"), this); | ||
55 | 55 | | |||
56 | mCaptureArea = new QComboBox(this); | 56 | mCaptureArea = new QComboBox(this); | ||
57 | if (supportedModes.contains(ImageGrabber::FullScreen)) | ||||
57 | mCaptureArea->insertItem(1, i18n("Full Screen (All Monitors)"), ImageGrabber::FullScreen); | 58 | mCaptureArea->insertItem(1, i18n("Full Screen (All Monitors)"), ImageGrabber::FullScreen); | ||
59 | if (supportedModes.contains(ImageGrabber::CurrentScreen)) | ||||
58 | mCaptureArea->insertItem(2, i18n("Current Screen"), ImageGrabber::CurrentScreen); | 60 | mCaptureArea->insertItem(2, i18n("Current Screen"), ImageGrabber::CurrentScreen); | ||
61 | if (supportedModes.contains(ImageGrabber::ActiveWindow)) | ||||
59 | mCaptureArea->insertItem(3, i18n("Active Window"), ImageGrabber::ActiveWindow); | 62 | mCaptureArea->insertItem(3, i18n("Active Window"), ImageGrabber::ActiveWindow); | ||
63 | if (supportedModes.contains(ImageGrabber::WindowUnderCursor)) | ||||
60 | mCaptureArea->insertItem(4, i18n("Window Under Cursor"), ImageGrabber::WindowUnderCursor); | 64 | mCaptureArea->insertItem(4, i18n("Window Under Cursor"), ImageGrabber::WindowUnderCursor); | ||
65 | if (supportedModes.contains(ImageGrabber::RectangularRegion)) | ||||
61 | mCaptureArea->insertItem(5, i18n("Rectangular Region"), ImageGrabber::RectangularRegion); | 66 | mCaptureArea->insertItem(5, i18n("Rectangular Region"), ImageGrabber::RectangularRegion); | ||
62 | mCaptureArea->setMinimumWidth(240); | 67 | mCaptureArea->setMinimumWidth(240); | ||
63 | connect(mCaptureArea, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &KSWidget::captureModeChanged); | 68 | connect(mCaptureArea, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &KSWidget::captureModeChanged); | ||
64 | 69 | | |||
65 | mDelayMsec = new SmartSpinBox(this); | 70 | mDelayMsec = new SmartSpinBox(this); | ||
66 | mDelayMsec->setDecimals(1); | 71 | mDelayMsec->setDecimals(1); | ||
67 | mDelayMsec->setSingleStep(1.0); | 72 | mDelayMsec->setSingleStep(1.0); | ||
68 | mDelayMsec->setMinimum(0.0); | 73 | mDelayMsec->setMinimum(0.0); | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | |||||
151 | 156 | | |||
152 | // and read in the saved checkbox states and capture mode indices | 157 | // and read in the saved checkbox states and capture mode indices | ||
153 | 158 | | |||
154 | mMousePointer->setChecked (configManager->includePointerChecked()); | 159 | mMousePointer->setChecked (configManager->includePointerChecked()); | ||
155 | mWindowDecorations->setChecked (configManager->includeDecorationsChecked()); | 160 | mWindowDecorations->setChecked (configManager->includeDecorationsChecked()); | ||
156 | mCaptureOnClick->setChecked (configManager->onClickChecked()); | 161 | mCaptureOnClick->setChecked (configManager->onClickChecked()); | ||
157 | mCaptureTransientOnly->setChecked (configManager->captureTransientWindowOnlyChecked()); | 162 | mCaptureTransientOnly->setChecked (configManager->captureTransientWindowOnlyChecked()); | ||
158 | mQuitAfterSaveOrCopy->setChecked (configManager->quitAfterSaveOrCopyChecked()); | 163 | mQuitAfterSaveOrCopy->setChecked (configManager->quitAfterSaveOrCopyChecked()); | ||
164 | if (configManager->captureMode()>=0) | ||||
159 | mCaptureArea->setCurrentIndex (configManager->captureMode()); | 165 | mCaptureArea->setCurrentIndex (configManager->captureMode()); | ||
160 | mDelayMsec->setValue (configManager->captureDelay()); | 166 | mDelayMsec->setValue (configManager->captureDelay()); | ||
161 | 167 | | |||
162 | // done | 168 | // done | ||
163 | } | 169 | } | ||
164 | 170 | | |||
165 | int KSWidget::imagePaddingWidth() const | 171 | int KSWidget::imagePaddingWidth() const | ||
166 | { | 172 | { | ||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |