[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Mon Nov 15 21:50:29 CET 2010
SVN commit 1197442 by nienhueser:
Two widgets side by side are still too much for Maemo. Open the right one in a new dialog to avoid too much scrolling/squeezing.
M +35 -3 RoutingProfileSettingsDialog.cpp
M +6 -0 RoutingProfileSettingsDialog.h
M +33 -50 RoutingProfileSettingsDialog.ui
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProfileSettingsDialog.cpp #1197441:1197442
@@ -24,13 +24,14 @@
RoutingProfileSettingsDialog::RoutingProfileSettingsDialog( PluginManager *pluginManager, RoutingProfilesModel *profilesModel, QWidget* parent )
- : QDialog( parent ), m_pluginManager( pluginManager ), m_profilesModel ( profilesModel )
+ : QDialog( parent ), m_pluginManager( pluginManager ),
+ m_profilesModel ( profilesModel ), m_dialog( 0 ), m_dialogLayout( 0 )
{
m_ui = new Ui_RoutingProfileSettingsDialog();
m_ui->setupUi( this );
bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
if ( smallScreen ) {
- setMaximumWidth( 800 );
+ setMinimumHeight( 480 );
}
QList<RunnerPlugin*> allPlugins = pluginManager->runnerPlugins();
@@ -54,6 +55,7 @@
connect ( m_ui->buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect ( m_ui->buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
+ connect( m_ui->configureButton, SIGNAL( clicked() ), this, SLOT( openConfigDialog() ) );
}
RoutingProfileSettingsDialog::~RoutingProfileSettingsDialog()
@@ -73,7 +75,8 @@
RunnerPlugin *plugin = m_plugins.at( current.row() );
QWidget* configWidget = m_configWidgets[plugin];
if ( configWidget ) {
- m_ui->settingsStack->setCurrentWidget( configWidget );
+ bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
+ m_ui->settingsStack->setCurrentWidget( smallScreen ? m_ui->configurePage : configWidget );
QStandardItem *item = m_servicesModel->invisibleRootItem()->child( current.row() );
m_ui->settingsStack->setEnabled( item->checkState() == Qt::Checked );
} else {
@@ -125,7 +128,36 @@
m_profilesModel->setProfilePluginSettings( profileIndex, pluginSettings );
}
+void RoutingProfileSettingsDialog::openConfigDialog()
+{
+ QModelIndex current = m_ui->services->selectionModel()->currentIndex();
+ if ( current.isValid() ) {
+ RunnerPlugin *plugin = m_plugins.at( current.row() );
+ if ( !m_dialog ) {
+ m_dialog = new QDialog( this );
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok );
+ connect( buttonBox, SIGNAL( accepted() ), m_dialog, SLOT( accept() ) );
+
+ m_dialogLayout = new QHBoxLayout();
+ m_dialogLayout->addWidget( m_configWidgets[plugin] );
+ m_dialogLayout->addWidget( buttonBox );
+
+ m_dialog->setLayout( m_dialogLayout );
+ m_dialog->setMinimumHeight( 480 );
+ } else {
+ m_dialogLayout->insertWidget( 0, m_configWidgets[plugin] );
}
+ m_configWidgets[plugin]->show();
+ m_dialog->setWindowTitle( plugin->name() );
+ m_dialog->exec();
+ m_configWidgets[plugin]->hide();
+ m_dialogLayout->removeWidget( m_configWidgets[plugin] );
+ }
+}
+
+}
+
#include "RoutingProfileSettingsDialog.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProfileSettingsDialog.h #1197441:1197442
@@ -18,6 +18,7 @@
class QModelIndex;
class QStandardItemModel;
+class QHBoxLayout;
class Ui_RoutingProfileSettingsDialog;
namespace Marble {
@@ -38,6 +39,8 @@
private slots:
void updateConfigWidget();
+ void openConfigDialog();
+
private:
PluginManager *m_pluginManager;
RoutingProfilesModel *m_profilesModel;
@@ -47,6 +50,9 @@
Ui_RoutingProfileSettingsDialog *m_ui;
QStandardItemModel *m_servicesModel;
+
+ QDialog* m_dialog;
+ QHBoxLayout* m_dialogLayout;
};
}
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProfileSettingsDialog.ui #1197441:1197442
@@ -6,41 +6,34 @@
<rect>
<x>0</x>
<y>0</y>
- <width>500</width>
- <height>330</height>
+ <width>488</width>
+ <height>274</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Routing Profile</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
<item row="0" column="0">
- <widget class="QScrollArea" name="scrollArea">
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Name:</string>
</property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>486</width>
- <height>287</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="1" column="0">
- <widget class="QSplitter" name="splitter">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <widget class="QWidget" name="layoutWidget">
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="name"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_4">
@@ -57,17 +50,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>200</height>
- </size>
+ <property name="resizeMode">
+ <enum>QListView::Adjust</enum>
</property>
</widget>
</item>
</layout>
- </widget>
- <widget class="QWidget" name="layoutWidget">
+ </item>
+ <item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_5">
@@ -115,31 +105,24 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="configurePage">
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="configureButton">
+ <property name="text">
+ <string>Configure</string>
+ </property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
- <item row="0" column="0">
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="name"/>
- </item>
</layout>
</item>
</layout>
- </widget>
- </widget>
</item>
- <item row="1" column="0">
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
More information about the Marble-commits
mailing list