Skip to content
Permalink
Browse files

More GRASS joy: close button for GRASS shell.

Fixes #144.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7426 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 16, 2007
1 parent d1fb582 commit 7506c33216a8b16ace602f905330834cf97a5877
Showing with 54 additions and 33 deletions.
  1. +15 −1 src/plugins/grass/qgsgrassshell.cpp
  2. +17 −11 src/plugins/grass/qgsgrassshell.h
  3. +22 −21 src/plugins/grass/qgsgrassshellbase.ui
@@ -81,11 +81,12 @@ extern "C" {
}

QgsGrassShell::QgsGrassShell ( QgsGrassTools *tools,
QWidget * parent, const char * name ):
QTabWidget * parent, const char * name ):
QDialog(parent), QgsGrassShellBase(), mTools(tools)
{
mValid = false;
mSkipLines = 2;
mTabWidget = parent;

#ifdef WIN32
QMessageBox::warning( 0, "Warning",
@@ -99,6 +100,8 @@ QDialog(parent), QgsGrassShellBase(), mTools(tools)
mText = new QgsGrassShellText( this, mTextFrame);
layout->addWidget ( mText, 0 , 0 );
mText->show();

connect(mCloseButton, SIGNAL(clicked()), this, SLOT(closeShell()));

mFont = QFont ( "Courier", 10 );

@@ -939,6 +942,17 @@ void QgsGrassShell::readStderr()
{
}

void QgsGrassShell::closeShell()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassShell::closeShell()" << std::endl;
#endif

mTabWidget->removePage (this );
delete this;
}


QgsGrassShellText::QgsGrassShellText ( QgsGrassShell *gs,
QWidget * parent, const char *name )
: Q3TextEdit (parent,name),
@@ -12,20 +12,22 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include <qstring.h>
#include <q3textedit.h>
#include <q3process.h>
#include <qmessagebox.h>
#include <qsocketnotifier.h>
#include <q3cstring.h>

#include "qgsgrasstools.h"
#include "ui_qgsgrassshellbase.h"
#include <Q3CString>
#include <Q3Process>
#include <Q3TextEdit>
#include <QDialog>
//Added by qt3to4:
#include <QMouseEvent>
#include <QKeyEvent>
#include <QMessageBox>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QSocketNotifier>
#include <QString>

#include "qgsgrasstools.h"
#include "ui_qgsgrassshellbase.h"

class QTabWidget;

class QgsGrassShellText;

@@ -74,7 +76,7 @@ class QgsGrassShell: public QDialog, private Ui::QgsGrassShellBase

public:
QgsGrassShell ( QgsGrassTools *tools,
QWidget * parent = 0, const char * name = 0 );
QTabWidget * parent = 0, const char * name = 0 );
~QgsGrassShell();

// Modes
@@ -146,6 +148,7 @@ public slots:
void keyPressEvent ( QKeyEvent * e );
void keyReleaseEvent ( QKeyEvent * e );
void mousePressEvent(QMouseEvent* e);
void closeShell();

signals:

@@ -212,6 +215,9 @@ public slots:

// How many lines to skip, used to skip output of first commands sent to shell
int mSkipLines;

// pointer to tab widget in which is the shell
QTabWidget* mTabWidget;
};

class QgsGrassShellText : public Q3TextEdit
@@ -1,7 +1,4 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>QgsGrassShellBase</class>
<widget class="QWidget" name="QgsGrassShellBase" >
<property name="geometry" >
@@ -22,18 +19,10 @@
<string>GRASS Shell</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>10</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="Q3Frame" name="mTextFrame" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -47,26 +36,38 @@
</widget>
</item>
<item>
<widget class="Q3ProgressBar" name="mProgressBar" />
<layout class="QHBoxLayout" >
<item>
<widget class="Q3ProgressBar" name="mProgressBar" />
</item>
<item>
<widget class="QPushButton" name="mCloseButton" >
<property name="focusPolicy" >
<enum>Qt::ClickFocus</enum>
</property>
<property name="text" >
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3ProgressBar</class>
<extends>QWidget</extends>
<header>q3progressbar.h</header>
<class>Q3Frame</class>
<extends>QFrame</extends>
<header>Qt3Support/Q3Frame</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3Frame</class>
<extends></extends>
<header>Qt3Support/Q3Frame</header>
<class>Q3ProgressBar</class>
<extends>QFrame</extends>
<header>Qt3Support/Q3ProgressBar</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<resources/>

0 comments on commit 7506c33

Please sign in to comment.
You can’t perform that action at this time.