Skip to content

Commit

Permalink
More GRASS joy: close button for GRASS shell.
Browse files Browse the repository at this point in the history
Fixes #144.


git-svn-id: http://svn.osgeo.org/qgis/trunk@7426 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 16, 2007
1 parent 21b8c97 commit c51e0e1
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 33 deletions.
16 changes: 15 additions & 1 deletion src/plugins/grass/qgsgrassshell.cpp
Expand Up @@ -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",
Expand All @@ -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 );

Expand Down Expand Up @@ -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),
Expand Down
28 changes: 17 additions & 11 deletions src/plugins/grass/qgsgrassshell.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -146,6 +148,7 @@ public slots:
void keyPressEvent ( QKeyEvent * e );
void keyReleaseEvent ( QKeyEvent * e );
void mousePressEvent(QMouseEvent* e);
void closeShell();

signals:

Expand Down Expand Up @@ -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
Expand Down
43 changes: 22 additions & 21 deletions src/plugins/grass/qgsgrassshellbase.ui
@@ -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" >
Expand All @@ -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>
Expand All @@ -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/>
Expand Down

0 comments on commit c51e0e1

Please sign in to comment.