[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    [PATCH] ui/kis_dlg_adjustment_layer.{cc, h}: set adjustment layer name
From:       Melchior FRANZ <mfranz () aon ! at>
Date:       2006-02-22 15:12:59
Message-ID: 200602221612.59645 () rk-nord ! at
[Download RAW message or body]

This patch makes the label name editfield empty first. That way one
can quickly insert one's choice. If it is left empty, then selecting
a filter will insert the respective filter name. Selecting a different
filter will update to this filter name. If the user edits the field,
further updating will be omitted and the field contents are taken as is.

What is a bit ugly, is how the menuEntry() has to be edited to make
it acceptable as layer name: strip the accelerator underline marker
(all '&') and trailing (well, actually every) ellipsis ("...").

Please review.

m.




["adjlayername.diff" (text/x-diff)]

Index: kis_dlg_adjustment_layer.h
===================================================================
--- kis_dlg_adjustment_layer.h	(revision 512433)
+++ kis_dlg_adjustment_layer.h	(working copy)
@@ -76,6 +76,7 @@
     KisFilter* m_currentFilter;
     KLineEdit * m_layerName;
     QLabel* m_labelNoConfigWidget;
+    bool m_customName;
 };
 
 #endif
Index: kis_dlg_adjustment_layer.cc
===================================================================
--- kis_dlg_adjustment_layer.cc	(revision 512433)
+++ kis_dlg_adjustment_layer.cc	(working copy)
@@ -41,13 +41,14 @@
 #include "kis_filter_configuration.h"
 
 KisDlgAdjustmentLayer::KisDlgAdjustmentLayer(KisImage * img,
-                                             const QString & layerName,
+                                             const QString & /*layerName*/,
                                              const QString & caption,
                                              QWidget *parent,
                                              const char *name)
     : KDialogBase(parent, name, true, "", Ok | Cancel)
     , m_image(img)
     , m_currentFilter(0)
+    , m_customName(false)
 {
     Q_ASSERT(img);
 
@@ -80,7 +81,7 @@
     grid->addWidget(lblName, 0, 0);
 
     m_layerName = new KLineEdit(page, "m_layerName");
-    m_layerName->setText(layerName);
+    m_layerName->setText("");
     grid->addWidget(m_layerName, 0, 1);
     connect( m_layerName, SIGNAL( textChanged ( const QString & ) ), this, SLOT( \
slotNameChanged( const QString & ) ) );  
@@ -112,7 +113,8 @@
 
 void KisDlgAdjustmentLayer::slotNameChanged( const QString & text )
 {
-    enableButtonOK( m_currentFilter && !text.isEmpty() );
+    m_customName = !text.isEmpty();
+    enableButtonOK( m_currentFilter && m_customName );
 }
 
 KisFilterConfiguration * KisDlgAdjustmentLayer::filterConfiguration() const
@@ -182,6 +184,12 @@
         m_labelNoConfigWidget->show();
     }
 
+    if (!m_customName) {
+        QString name(m_currentFilter->menuEntry());
+        name.remove('&').remove("...");
+        m_layerName->setText(name);
+    }
+
     enableButtonOK( !m_layerName->text().isEmpty() );
     refreshPreview();
 }



_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic