[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevelop/plugins/appwizard
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2008-12-09 21:10:50
Message-ID: 1228857050.537307.11943.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 895033 by apaku:
Also show preview and description when selecting an item in the tree.
M +1 -0 appwizardplugin.cpp
M +17 -1 projectselectionpage.cpp
M +2 -0 projectselectionpage.h
M +36 -11 projectselectionpage.ui
M +2 -0 projecttemplatesmodel.cpp
M +2 -0 projecttemplatesmodel.h
--- trunk/KDE/kdevelop/plugins/appwizard/appwizardplugin.cpp #895032:895033
@@ -65,6 +65,7 @@
KStandardDirs *dirs = compData.dirs();
dirs->addResourceType("apptemplates", "data", "kdevappwizard/templates/");
dirs->addResourceType("apptemplate_descriptions","data", \
"kdevappwizard/template_descriptions/"); + \
dirs->addResourceType("apptemplate_previews","data", \
"kdevappwizard/template_previews/");
dirs->addResourceType("appimports", "data", "kdevappwizard/imports/");
dirs->addResourceType("appimportfiles", "data", "kdevappwizard/importfiles/");
setComponentData(compData);
--- trunk/KDE/kdevelop/plugins/appwizard/projectselectionpage.cpp #895032:895033
@@ -12,9 +12,12 @@
#include <QDir>
#include <klineedit.h>
+#include <kcomponentdata.h>
+#include <kstandarddirs.h>
#include "ui_projectselectionpage.h"
#include "projecttemplatesmodel.h"
+#include "appwizardplugin.h"
ProjectSelectionPage::ProjectSelectionPage(ProjectTemplatesModel *templatesModel, \
QWidget *parent)
:QWidget(parent), m_templatesModel(templatesModel), m_urlEditedByUser( false )
@@ -29,7 +32,7 @@
connect( ui->locationUrl, SIGNAL(urlSelected(const KUrl&)),
this, SLOT(urlEdited() ));
connect( ui->templateView->selectionModel(), SIGNAL( currentChanged( const \
QModelIndex&, const QModelIndex& ) ),
- this, SLOT( validateData() ) );
+ this, SLOT( itemChanged( const QModelIndex&, const QModelIndex& ) ) );
connect( ui->appNameEdit, SIGNAL(textEdited(const QString&)),
this, SLOT( validateData() ) );
ui->locationUrl->setPath(QDir::homePath());
@@ -40,6 +43,19 @@
delete ui;
}
+void ProjectSelectionPage::itemChanged( const QModelIndex& current, const \
QModelIndex& ) +{
+ KStandardDirs* dirs = m_templatesModel->plugin()->componentData().dirs();
+ QString picPath = dirs->findResource("apptemplate_previews", \
m_templatesModel->data( current, Qt::UserRole+2 ).toString() ); + if( \
picPath.isEmpty() ) + {
+ picPath = dirs->findResource("apptemplate_previews", \
"default-kdevelop.png"); + }
+ ui->preview->setPixmap( QPixmap( picPath ) );
+ ui->description->setText( m_templatesModel->data( current ).toString() );
+ validateData();
+}
+
QString ProjectSelectionPage::selectedTemplate()
{
QStandardItem *item = \
m_templatesModel->itemFromIndex(ui->templateView->currentIndex());
--- trunk/KDE/kdevelop/plugins/appwizard/projectselectionpage.h #895032:895033
@@ -17,6 +17,7 @@
}
class ProjectTemplatesModel;
+class QModelIndex;
class KUrl;
class ProjectSelectionPage: public QWidget {
@@ -33,6 +34,7 @@
void valid();
void invalid();
private slots:
+ void itemChanged( const QModelIndex&, const QModelIndex& );
void urlEdited();
void validateData();
private:
--- trunk/KDE/kdevelop/plugins/appwizard/projectselectionpage.ui #895032:895033
@@ -5,21 +5,41 @@
<rect>
<x>0</x>
<y>0</y>
- <width>516</width>
+ <width>637</width>
<height>475</height>
</rect>
</property>
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="margin" >
- <number>9</number>
- </property>
- <item>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item rowspan="2" row="0" column="0" >
<widget class="QTreeView" name="templateView" />
</item>
- <item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="preview" >
+ <property name="minimumSize" >
+ <size>
+ <width>250</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="description" >
+ <property name="minimumSize" >
+ <size>
+ <width>250</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
<widget class="QGroupBox" name="propertiesBox" >
<property name="title" >
<string>Properties</string>
@@ -51,7 +71,7 @@
<item row="2" column="1" >
<widget class="KSqueezedTextLabel" name="locationValidLabel" >
<property name="text" >
- <string>(invalid)</string>
+ <string>KSqueezedTextLabel</string>
</property>
</widget>
</item>
@@ -65,6 +85,11 @@
</widget>
<customwidgets>
<customwidget>
+ <class>KSqueezedTextLabel</class>
+ <extends>QLabel</extends>
+ <header>ksqueezedtextlabel.h</header>
+ </customwidget>
+ <customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
--- trunk/KDE/kdevelop/plugins/appwizard/projecttemplatesmodel.cpp #895032:895033
@@ -46,9 +46,11 @@
KConfigGroup general(&templateConfig, "General");
QString name = general.readEntry("Name");
QString category = general.readEntry("Category");
+ QString icon = general.readEntry("Icon");
ProjectTemplateItem *templateItem = createItem(name, category);
templateItem->setData(templateDescription);
+ templateItem->setData(icon, Qt::UserRole+2);
}
setHorizontalHeaderLabels(QStringList() << i18n("Project Templates"));
}
--- trunk/KDE/kdevelop/plugins/appwizard/projecttemplatesmodel.h #895032:895033
@@ -22,6 +22,8 @@
void refresh();
+ AppWizardPlugin* plugin() { return m_plugin; }
+
private:
void extractTemplateDescriptions();
ProjectTemplateItem *createItem(const QString &name, const QString &category);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic