[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/groupphoto
From: Stephan Binner <binner () kde ! org>
Date: 2007-07-05 8:46:09
Message-ID: 1183625169.877900.9290.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 683745 by binner:
add graphical configuration to choose aKademy year
M +175 -150 config.ui
M +18 -2 groupphoto.cpp
--- trunk/playground/base/plasma/applets/groupphoto/config.ui #683744:683745
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>287</width>
- <height>396</height>
+ <width>382</width>
+ <height>300</height>
</rect>
</property>
<property name="windowTitle" >
@@ -15,176 +15,206 @@
<property name="styleSheet" >
<string/>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <layout class="QHBoxLayout" >
<item>
- <layout class="QHBoxLayout" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>&Choose aKademy year to display:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>yearComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="yearComboBox" >
<item>
- <widget class="QCheckBox" name="shadowCheckBox" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Shadow</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
+ <property name="text" >
+ <string>2006</string>
+ </property>
</item>
<item>
- <widget class="QCheckBox" name="frameCheckBox" >
- <property name="text" >
- <string>Set a frame around the picture</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
+ <property name="text" >
+ <string>2007</string>
+ </property>
</item>
- </layout>
+ </widget>
</item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
<item>
- <widget class="QFrame" name="frame" >
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
+ <widget class="QCheckBox" name="shadowCheckBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="frameShadow" >
- <enum>QFrame::Raised</enum>
+ <property name="text" >
+ <string>S&hadow</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Change frame color</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="KColorButton" name="changeFrameColor" >
- <property name="color" stdset="0" >
- <color>
- <red>70</red>
- <green>90</green>
- <blue>130</blue>
- </color>
- </property>
- <property name="defaultColor" stdset="0" >
- <color>
- <red>70</red>
- <green>90</green>
- <blue>130</blue>
- </color>
- </property>
- </widget>
- </item>
- </layout>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="labelSize" >
- <property name="text" >
- <string>Size of the picture</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinSize" >
- <property name="toolTip" >
- <string><html><head><meta name="qrichtext" content="1" \
/><style type="text/css"> + <widget class="QCheckBox" name="frameCheckBox" >
+ <property name="text" >
+ <string>Set a &frame around the picture</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QFrame" name="frame" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Change frame color</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="KColorButton" name="changeFrameColor" >
+ <property name="color" stdset="0" >
+ <color>
+ <red>70</red>
+ <green>90</green>
+ <blue>130</blue>
+ </color>
+ </property>
+ <property name="defaultColor" stdset="0" >
+ <color>
+ <red>70</red>
+ <green>90</green>
+ <blue>130</blue>
+ </color>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="labelSize" >
+ <property name="text" >
+ <string>&Size of the picture:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>spinSize</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinSize" >
+ <property name="toolTip" >
+ <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;">Change clock \
size</p></body></html></string>
- </property>
- <property name="whatsThis" >
- <string><html><head><meta name="qrichtext" content="1" \
/><style type="text/css"> + </property>
+ <property name="whatsThis" >
+ <string><html><head><meta name="qrichtext" content="1" /><style \
type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Serif'; font-size:9pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;">Set a new size for the clock between 0 and 500. The size is the \
square side that contains the \
clock.</p></body></html></string>
- </property>
- <property name="minimum" >
- <number>30</number>
- </property>
- <property name="maximum" >
- <number>5000</number>
- </property>
- </widget>
- </item>
- </layout>
+ </property>
+ <property name="minimum" >
+ <number>30</number>
+ </property>
+ <property name="maximum" >
+ <number>5000</number>
+ </property>
+ </widget>
</item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
<item>
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="labelRotation" >
- <property name="text" >
- <string>Rotation</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSlider" name="sliderRotation" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum" >
- <number>-9</number>
- </property>
- <property name="maximum" >
- <number>9</number>
- </property>
- <property name="singleStep" >
- <number>1</number>
- </property>
- <property name="pageStep" >
- <number>2</number>
- </property>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition" >
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval" >
- <number>9</number>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QLabel" name="labelRotation" >
+ <property name="text" >
+ <string>&Rotation:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>sliderRotation</cstring>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>Look</string>
+ <widget class="QSlider" name="sliderRotation" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QRadioButton" name="squareButton" >
- <property name="text" >
- <string>Squared Corners</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QRadioButton" name="roundButton" >
- <property name="text" >
- <string>Round Corners</string>
- </property>
- </widget>
- </item>
- </layout>
+ <property name="minimum" >
+ <number>-9</number>
+ </property>
+ <property name="maximum" >
+ <number>9</number>
+ </property>
+ <property name="singleStep" >
+ <number>1</number>
+ </property>
+ <property name="pageStep" >
+ <number>2</number>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition" >
+ <enum>QSlider::TicksBelow</enum>
+ </property>
+ <property name="tickInterval" >
+ <number>9</number>
+ </property>
</widget>
</item>
</layout>
</item>
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Look</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QRadioButton" name="squareButton" >
+ <property name="text" >
+ <string>S&quared Corners</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QRadioButton" name="roundButton" >
+ <property name="text" >
+ <string>&Round Corners</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
@@ -193,11 +223,6 @@
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
- <customwidget>
- <class>KUrlComboRequester</class>
- <extends>QWidget</extends>
- <header>kurlrequester.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections>
--- trunk/playground/base/plasma/applets/groupphoto/groupphoto.cpp #683744:683745
@@ -100,7 +100,6 @@
m_pixelSize = cg.readEntry("size", 1000);
m_rotation = cg.readEntry("rotation",0);
m_year = cg.readEntry("year", 2007);
- m_currentUrl = KGlobal::dirs()->findAllResources("data", (m_year==2007) ? \
"groupphoto/group-photo.jp*" : "groupphoto/group-photo-2006.jp*" )[0]; m_layout = \
new Plasma::VBoxLayout(0); m_layout->setGeometry(QRectF(0, 0, 400, 800));
m_layout->setMargin(12);
@@ -131,6 +130,10 @@
void Groupphoto::readNames()
{
+ foreach (_person* person, m_personList)
+ delete person;
+ m_personList.clear();
+
QFile file(KGlobal::dirs()->findAllResources("data", (m_year==2007) ? \
"groupphoto/group-photo.html" : "groupphoto/group-photo-2006.html")[0]);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
@@ -221,8 +224,10 @@
void Groupphoto::choosePicture()
{
+ QString currentUrl = KGlobal::dirs()->findAllResources("data", (m_year==2007) ? \
"groupphoto/group-photo.jp*" : "groupphoto/group-photo-2006.jp*" )[0]; +
QString tmpFile;
- if ( !KIO::NetAccess::download( m_currentUrl, tmpFile, 0L ) ) {
+ if ( !KIO::NetAccess::download( currentUrl, tmpFile, 0L ) ) {
return;
}
myPicture.load(tmpFile);
@@ -246,6 +251,7 @@
ui.roundButton->setChecked(m_roundCorners);
ui.spinSize->setValue(m_pixelSize);
ui.sliderRotation->setValue(m_rotation/5);
+ ui.yearComboBox->setCurrentIndex( (m_year==2007) ? 1 : 0);
}
m_dialog->show();
@@ -269,8 +275,18 @@
cg.writeEntry("squareCorners", m_squareCorners);
m_roundCorners = ui.roundButton->isChecked();
cg.writeEntry("roundCorners", m_roundCorners);
+ m_year = (ui.yearComboBox->currentIndex() ==0) ? 2006 : 2007;
+ cg.writeEntry("year", m_year);
+
+ foreach (HitBox* hitbox, m_hitboxList)
+ delete hitbox;
+ m_hitboxList.clear();
+
choosePicture();
composePicture();
+
+ readNames();
+
cg.config()->sync();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic