Skip to content

Commit

Permalink
Merge remote-tracking branch 'sankhesh/screeshot-resolution'
Browse files Browse the repository at this point in the history
* sankhesh/screeshot-resolution:
  Added option to allow/disallow transparency in screenshot
  Added screenshot output resolution support
  Tweak ctkFileDialog to better handle return key
  Cleanup ctkThumbnailListWidget and ctkDICOMThumbnailListWidget
  • Loading branch information
pieper committed Dec 21, 2012
2 parents 770c39c + 566c916 commit c7741ea
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 106 deletions.
Expand Up @@ -44,7 +44,8 @@ int ctkDICOMThumbnailListWidgetTest1( int argc, char * argv [] )

try
{
ctkDICOMDatabase myCTK( argv[1] );
QFileInfo databasePath(QString(argv[1]));
ctkDICOMDatabase myCTK( databasePath.absoluteFilePath() );

if (!myCTK.initializeDatabase(argv[2]))
{
Expand All @@ -56,8 +57,7 @@ int ctkDICOMThumbnailListWidgetTest1( int argc, char * argv [] )
model.setDatabase(myCTK.database());

ctkDICOMThumbnailListWidget widget;
//widget.setDatabaseDirectory(QDir::currentPath());
widget.setDatabaseDirectory("E:\\work\\CTK\\CTK-VTK-64\\CTK-build\\Libs\\DICOM\\Widgets\\Testing\\Cpp");
widget.setDatabaseDirectory(databasePath.absolutePath());
widget.addThumbnails(model.index(0,0));
widget.show();

Expand Down
8 changes: 2 additions & 6 deletions Libs/DICOM/Widgets/ctkDICOMThumbnailListWidget.cpp
Expand Up @@ -94,7 +94,6 @@ ::ctkDICOMThumbnailListWidgetPrivate(ctkDICOMThumbnailListWidget* parent)
void ctkDICOMThumbnailListWidgetPrivate
::addPatientThumbnails(const QModelIndex &index)
{
Q_Q(ctkDICOMThumbnailListWidget);
QModelIndex patientIndex = index;

ctkDICOMModel* model = const_cast<ctkDICOMModel*>(
Expand Down Expand Up @@ -122,7 +121,6 @@ ::addPatientThumbnails(const QModelIndex &index)
void ctkDICOMThumbnailListWidgetPrivate
::addStudyThumbnails(const QModelIndex &index)
{
Q_Q(ctkDICOMThumbnailListWidget);
QModelIndex studyIndex = index;

ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(index.model()));
Expand All @@ -148,7 +146,6 @@ ::addStudyThumbnails(const QModelIndex &index)
void ctkDICOMThumbnailListWidgetPrivate
::addSeriesThumbnails(const QModelIndex &index)
{
Q_Q(ctkDICOMThumbnailListWidget);
QModelIndex studyIndex = index.parent();
QModelIndex seriesIndex = index;

Expand All @@ -175,9 +172,8 @@ void ctkDICOMThumbnailListWidgetPrivate
::addThumbnailWidget(const QModelIndex& imageIndex,
const QModelIndex& sourceIndex, const QString &text)
{
Q_Q(ctkDICOMThumbnailListWidget);

ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(imageIndex.model()));
ctkDICOMModel* model = const_cast<ctkDICOMModel*>(
qobject_cast<const ctkDICOMModel*>(imageIndex.model()));

if(!model)
{
Expand Down
Binary file added Libs/Widgets/Resources/Icons/lock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Libs/Widgets/Resources/Icons/unlock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
232 changes: 154 additions & 78 deletions Libs/Widgets/Resources/UI/ctkScreenshotDialog.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>704</width>
<height>235</height>
<width>579</width>
<height>334</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -19,8 +19,72 @@
<property name="windowTitle">
<string>Screen Capture Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="CountDownLabel">
<property name="text">
<string>0 s</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="ImageFullNameLabel">
<property name="text">
<string>Untitled_0.png</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="OptionGroupBox">
<property name="enabled">
<bool>false</bool>
Expand All @@ -34,7 +98,7 @@
<property name="title">
<string>Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="DirectoryLabel">
<property name="text">
Expand All @@ -43,7 +107,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="ctkDirectoryButton" name="DirectoryButton">
<widget class="ctkPathLineEdit" name="DirectoryPathLineEdit" native="true">
<property name="toolTip">
<string>Select a directory in which screen captures will be saved.</string>
</property>
Expand Down Expand Up @@ -77,10 +141,13 @@
<widget class="QSpinBox" name="ImageVersionNumberSpinBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ScaleFactorLabel">
<widget class="QRadioButton" name="ScaleFactorRadioButton">
<property name="text">
<string>Scale factor:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
Expand All @@ -105,28 +172,99 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="OutputResolutionRadioButton">
<property name="text">
<string>Output resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="WidthSpinBox">
<property name="toolTip">
<string>Width of the screenshot</string>
</property>
<property name="suffix">
<string> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="xLabel">
<property name="text">
<string>x</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="HeightSpinBox">
<property name="toolTip">
<string>Height of the screenshot</string>
</property>
<property name="suffix">
<string> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="LockAspectToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Lock/unlock aspect ratio</string>
</property>
<property name="icon">
<iconset resource="../ctkWidgets.qrc">
<normaloff>:/Icons/unlock.png</normaloff>
<normalon>:/Icons/lock.png</normalon>:/Icons/unlock.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="OverwriteLabel">
<property name="text">
<string>Overwrite:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QCheckBox" name="OverwriteCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="DelayLabel">
<property name="text">
<string>Screenshot delay:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QSpinBox" name="DelaySpinBox">
<property name="suffix">
<string> s</string>
Expand All @@ -139,80 +277,18 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="CountDownLabel">
<property name="text">
<string>0 s</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="ImageFullNameLabel">
<property name="text">
<string>Untitled_0.png</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="ButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ctkDirectoryButton</class>
<class>ctkPathLineEdit</class>
<extends>QWidget</extends>
<header>ctkDirectoryButton.h</header>
<header>ctkPathLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../ctkWidgets.qrc"/>
</resources>
<connections>
<connection>
<sender>ButtonBox</sender>
Expand Down
3 changes: 2 additions & 1 deletion Libs/Widgets/Resources/ctkWidgets.qrc
@@ -1,6 +1,8 @@
<RCC>
<qresource prefix="/">
<file>Icons/edit.png</file>
<file>Icons/lock.png</file>
<file>Icons/unlock.png</file>
<file>Icons/minus.png</file>
<file>Icons/plus.png</file>
<file>Icons/expand-down.png</file>
Expand Down Expand Up @@ -234,7 +236,6 @@
<file>Icons/Languages/ua.png</file>
<file>Icons/Languages/ug.png</file>
<file>Icons/Languages/um.png</file>
<file>Icons/Languages/us.png</file>
<file>Icons/Languages/uy.png</file>
<file>Icons/Languages/uz.png</file>
<file>Icons/Languages/va.png</file>
Expand Down

0 comments on commit c7741ea

Please sign in to comment.