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

List:       kde-edu-devel
Subject:    Bug #152182: A Little Progress
From:       Rahul Sharma <rahulveera2009 () gmail ! com>
Date:       2012-03-22 9:28:51
Message-ID: CAC3EFMicoVhPYMUGNuomyOuJy2fkyP-VMw=nG=L9LFbk6wQsRw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Anne,
Find attached five .diff files.
Here is the description how the patches work:
Initially, when you open kmplot, the View->Show Slider menu is disabled
(grayed).
Now, when you enter a function with parameter, and check the Slider
checkbox ( I have
not yet implemented the part that, only when you enter a parameter in the
function, the
checkbox is enabled to be checked, I am working on it), the Slider window
pops-up
and View->Show Slider menu is enabled now, to be clicked. Now, to close the
Slider
window, you can check the Slider checkbox again, or you can click the
View->Show Slider
menu.The View->Show Slider menu closes and opens the Slider window, as you
click it
(like toggling), but there isn't any tick mark there.

Now, the problem is that, I don't know, from which part of the code, is the
View->Show
Slider menu is being activated. I tried various methods of View.cpp.
Initially, I thought
that View->updateSliders() function is responsible for that ( but I was
wrong ). And, this
is causing trouble, since I wanted that when you delete all the functions,
the View->Show
Slider menu should be disabled again ( as obvious it is ). But this is not
happening. I wanted
to encounter this problem first. And later, I could do the Slider checkbox
part so that it is
ready to be checked only when user enters parameter.

You may find some things which you may not like, such as, I have not
removed the
View::sliderWindowClosed() and View::slidersWindowClosed functions. Yes,
the code is
not clean. I would make it clean as soon as the problem is resolved ( in
the final patch).

-Regards
 Rahul Sharma
 (NUM_1 on irc.freenode.net)

[Attachment #5 (text/html)]

Hi Anne,<br>Find attached five .diff files.<br>Here is the description how the \
patches work:<br>Initially, when you open kmplot, the View-&gt;Show Slider menu is \
disabled (grayed).<br>Now, when you enter a function with parameter, and check the \
Slider checkbox ( I have<br>

not yet implemented the part that, only when you enter a parameter in the function, \
the <br>checkbox is enabled to be checked, I am working on it), the Slider window \
pops-up<br>and View-&gt;Show Slider menu is enabled now, to be clicked. Now, to close \
the Slider<br>

window, you can check the Slider checkbox again, or you can click the View-&gt;Show \
Slider<br>menu.The View-&gt;Show Slider menu closes and opens the Slider window, as \
you click it<br>(like toggling), but there isn&#39;t any tick mark there.<br>

<br>Now, the problem is that, I don&#39;t know, from which part of the code, is the \
View-&gt;Show<br>Slider menu is being activated. I tried various methods of View.cpp. \
Initially, I thought <br>that View-&gt;updateSliders() function is responsible for \
that ( but I was wrong ). And, this <br>

is causing trouble, since I wanted that when you delete all the functions, the \
View-&gt;Show<br>Slider menu should be disabled again ( as obvious it is ). But this \
is not happening. I wanted<br>to encounter this problem first. And later, I could do \
the Slider checkbox part so that it is <br>

ready to be checked only when user enters parameter.<br><br>You may find some things \
which you may not like, such as, I have not removed the \
<br>View::sliderWindowClosed() and View::slidersWindowClosed functions. Yes, the code \
is <br>

not clean. I would make it clean as soon as the problem is resolved ( in the final \
patch).<br><br>-Regards<br> Rahul Sharma<br> (NUM_1 on <a \
href="http://irc.freenode.net">irc.freenode.net</a>)<br>

--000e0cd47f9685159e04bbd15fd5--


["parameterswidget_cpp.diff" (text/x-patch)]

diff --git a/home/rahul/kmplot/kmplot/parameterswidget.cpp \
b/home/rahul/kmplot_/src/kmplot/parameterswidget.cpp index 09294fa..636e7ba 100644
--- a/home/rahul/kmplot/kmplot/parameterswidget.cpp
+++ b/home/rahul/kmplot_/src/kmplot/parameterswidget.cpp
@@ -26,6 +26,8 @@
 #include "function.h"
 #include "kparametereditor.h"
 #include "xparser.h"
+#include "view.h"
+#include "ksliderwindow.h"
 
 #include <klocale.h>
 
@@ -40,6 +42,7 @@ ParametersWidget::ParametersWidget( QWidget * parent )
 	
 	connect( editParameterListButton, SIGNAL(clicked()), this, \
SLOT(editParameterList()) );  connect( useSlider,	SIGNAL(toggled(bool)), this, \
SLOT(updateEquationEdits()) ); +	//connect( useSlider,     SIGNAL(toggled(bool)), \
this, SLOT(updateSliderWindow()) );  connect( useList,	SIGNAL(toggled(bool)), this, \
SLOT(updateEquationEdits()) );  }
 
@@ -78,6 +81,23 @@ void ParametersWidget::editParameterList()
 
 void ParametersWidget::updateEquationEdits( )
 {
+	if ( !View::self()->m_sliderWindow )
+	{
+		View::self()->m_sliderWindow = new KSliderWindow( View::self() );
+		connect( View::self()->m_sliderWindow, SIGNAL( valueChanged() ), View::self(), \
SLOT( drawPlot() ) ); +		connect( View::self()->m_sliderWindow, SIGNAL( \
windowClosed() ), View::self(), SLOT( slidersWindowClosed() ) ); +	}
+	if ( !View::self()->m_sliderWindow->isVisible() )
+	{
+		View::self()->m_sliderWindow->show();
+		View::self()->m_menuSliderAction->setEnabled( true );
+	}
+	else
+	{
+		View::self()->m_sliderWindow->hide();
+		View::self()->m_menuSliderAction->setEnabled( false );
+	}
+	
 	if ( !useSlider->isChecked() && !useList->isChecked() )
 	{
 		// Don't need to add any parameter variables
@@ -99,6 +119,10 @@ void ParametersWidget::updateEquationEdits( )
 	}
 }
 
+/*void ParametersWidget::updateSliderWindow()
+{
+	View::self()->updateSliders();
+}*/
 
 void ParametersWidget::associateEquationEdit( EquationEdit * edit )
 {


["parameterswidget_h.diff" (text/x-patch)]

diff --git a/home/rahul/kmplot/kmplot/parameterswidget.h \
b/home/rahul/kmplot_/src/kmplot/parameterswidget.h index 58fcec8..78dac27 100644
--- a/home/rahul/kmplot/kmplot/parameterswidget.h
+++ b/home/rahul/kmplot_/src/kmplot/parameterswidget.h
@@ -71,6 +71,7 @@ class ParametersWidget : public QGroupBox, public \
                Ui_ParametersWidget
 		 * Called when one of the checkboxes is checked.
 		 */
 		void updateEquationEdits();
+		//void updateSliderWindow();
 		
 	protected:
 		/**


["view_cpp.diff" (text/x-patch)]

diff --git a/home/rahul/kmplot/kmplot/view.cpp b/home/rahul/kmplot_/src/kmplot/view.cpp
index b3abfcc..258fba7 100644
--- a/home/rahul/kmplot/kmplot/view.cpp
+++ b/home/rahul/kmplot_/src/kmplot/view.cpp
@@ -151,7 +151,7 @@ View::View( bool readOnly, KMenu * functionPopup, QWidget* parent )
 	m_textEdit->setWordWrapMode( QTextOption::NoWrap );
 	m_textEdit->setLineWrapMode( QTextEdit::NoWrap );
 	m_textDocument = m_textEdit->document();
-
+	//m_menuSliderAction->setEnabled( false );
 	m_mousePressTimer = new QTime();
 
     new ViewAdaptor(this);
@@ -3934,19 +3934,20 @@ void View::updateSliders()
 		if ( it->m_parameters.useSlider && !it->allPlotsAreHidden() )
 		{
 			needSliderWindow = true;
-			break;;
+			break;
 		}
 	}
 	
-	m_menuSliderAction->setChecked( needSliderWindow );
+	m_menuSliderAction->setEnabled( needSliderWindow );
 	
 	if ( !needSliderWindow )
 	{
 		if ( m_sliderWindow )
 			m_sliderWindow->hide();
+		m_menuSliderAction->setEnabled( false );
 		return;
 	}
-	
+		
 	if ( !m_sliderWindow )
 	{
 		m_sliderWindow = new KSliderWindow( this );
@@ -3957,7 +3958,7 @@ void View::updateSliders()
 
 void View::sliderWindowClosed()
 {
-	m_menuSliderAction->setChecked( false );  //set the slider-item in the menu
+	//m_menuSliderAction->setChecked( false );  //set the slider-item in the menu
 }
 
 void View::hideCurrentFunction()
@@ -4052,6 +4053,20 @@ void View::zoomToTrigonometric()
 	animateZoom( QRectF( -2*M_PI/rpau, -4.0, 4*M_PI/rpau, 8.0 ) );
 }
 
+/*void View::updateSliderWindow()
+{
+	bool needSliderWindow = false;
+	foreach ( Function * it, XParser::self()->m_ufkt )
+	{
+		if ( it->m_parameters.useSlider && !it->allPlotsAreHidden() )
+		{
+			needSliderWindow = true;
+			break;
+		}
+	}
+	
+	m_menuSliderAction->setEnabled( needSliderWindow );
+}*/
 
 void View::updateCursor()
 {
@@ -4196,7 +4211,7 @@ void View::setStatusBar( const QString & t, StatusBarSection section )
 void View::slidersWindowClosed()
 {
 	kDebug() ;
-	m_menuSliderAction->setChecked(false);
+	//m_menuSliderAction->setChecked(false);
 }
 
 

["view_h.diff" (text/x-patch)]

diff --git a/home/rahul/kmplot/kmplot/view.h b/home/rahul/kmplot_/src/kmplot/view.h
index e2ddd56..92eb8ef 100644
--- a/home/rahul/kmplot/kmplot/view.h
+++ b/home/rahul/kmplot_/src/kmplot/view.h
@@ -35,7 +35,8 @@
 #include <QResizeEvent>
 #include <QKeyEvent>
 #include <QEvent>
-#include <ktoggleaction.h>
+#include <kaction.h>
+//#include <ktoggleaction.h>
 
 // KDE includes
 #include <kdebug.h>
@@ -140,7 +141,7 @@ class View : public QWidget
 		/// Slider controlling parameter values
 		QPointer<KSliderWindow> m_sliderWindow;
 		/// Menu actions for the sliders
-		KToggleAction * m_menuSliderAction;
+		KAction * m_menuSliderAction;
 		void updateSliders(); /// show only needed sliders
 		
 		/**
@@ -193,6 +194,7 @@ class View : public QWidget
 		void setPrintBackground( bool status );
 		void setPrintWidth( double width );
 		void setPrintHeight( double height );
+		//void updateSliderAction();
 
 	public slots:
 		/// Called when the user want to cancel the drawing

["maindlg_cpp.diff" (text/x-patch)]

diff --git a/home/rahul/kmplot/kmplot/maindlg.cpp \
b/home/rahul/kmplot_/src/kmplot/maindlg.cpp index 7a160fa..84049f0 100644
--- a/home/rahul/kmplot/kmplot/maindlg.cpp
+++ b/home/rahul/kmplot_/src/kmplot/maindlg.cpp
@@ -361,8 +361,9 @@ void MainDlg::setupActions()
 
 	kDebug() << "KStandardDirs::resourceDirs( icon )="<<KGlobal::dirs()->resourceDirs( \
"icon" );  
-	View::self()->m_menuSliderAction = actionCollection()->add<KToggleAction>( \
"options_configure_show_sliders" ); +	View::self()->m_menuSliderAction = \
                actionCollection()->addAction( "options_configure_show_sliders" );
         View::self()->m_menuSliderAction->setText( i18n( "Show Sliders" ) );
+	View::self()->m_menuSliderAction->setEnabled( false );
 	connect( View::self()->m_menuSliderAction, SIGNAL(triggered(bool)), this, SLOT( \
toggleShowSliders() ) );  
 



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


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

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