mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Removed Qt3 support stuff from grass tool box
git-svn-id: http://svn.osgeo.org/qgis/trunk@6773 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
66b47408da
commit
9c79f068f5
@ -15,43 +15,38 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <QApplication>
|
||||||
#include <qdir.h>
|
#include <QDir>
|
||||||
#include <qfile.h>
|
#include <QFile>
|
||||||
#include <qsettings.h>
|
#include <QSettings>
|
||||||
#include <qpixmap.h>
|
#include <QPixmap>
|
||||||
#include <q3listbox.h>
|
#include <QStringList>
|
||||||
#include <qstringlist.h>
|
#include <QLabel>
|
||||||
#include <qlabel.h>
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <qspinbox.h>
|
#include <QSpinBox>
|
||||||
#include <qmessagebox.h>
|
#include <QMessageBox>
|
||||||
#include <qinputdialog.h>
|
#include <QInputDialog>
|
||||||
#include <qsettings.h>
|
#include <QSettings>
|
||||||
#include <qpainter.h>
|
#include <QPainter>
|
||||||
#include <qpen.h>
|
#include <QPen>
|
||||||
#include <q3pointarray.h>
|
#include <QCursor>
|
||||||
#include <qcursor.h>
|
//#include <qnamespace.h>
|
||||||
#include <qnamespace.h>
|
#include <QColorDialog>
|
||||||
#include <q3listview.h>
|
#include <QStatusBar>
|
||||||
#include <qcolordialog.h>
|
#include <QEvent>
|
||||||
#include <q3table.h>
|
#include <QPoint>
|
||||||
#include <qstatusbar.h>
|
#include <QSize>
|
||||||
#include <qevent.h>
|
#include <QDomDocument>
|
||||||
#include <qpoint.h>
|
#include <QTabWidget>
|
||||||
#include <qsize.h>
|
#include <QLayout>
|
||||||
#include <qdom.h>
|
#include <QCheckBox>
|
||||||
#include <qtabwidget.h>
|
#include <QIcon>
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qcheckbox.h>
|
|
||||||
#include <q3process.h>
|
|
||||||
#include <qicon.h>
|
|
||||||
//Added by qt3to4:
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
#include <QListView>
|
#include <QTreeWidget>
|
||||||
#include <QProcess>
|
#include <QTreeWidgetItem>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include "qgis.h"
|
#include "qgis.h"
|
||||||
#include "qgisinterface.h"
|
#include "qgisinterface.h"
|
||||||
@ -116,20 +111,21 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
|
|||||||
layout1->addWidget(mTabWidget);
|
layout1->addWidget(mTabWidget);
|
||||||
|
|
||||||
|
|
||||||
mModulesListView = new Q3ListView();
|
mModulesListView = new QTreeWidget();
|
||||||
mTabWidget->addTab( mModulesListView, tr("Modules") );
|
mTabWidget->addTab( mModulesListView, tr("Modules") );
|
||||||
mModulesListView->addColumn("col1",0);
|
mModulesListView->setColumnCount(1);
|
||||||
|
QStringList headers;
|
||||||
|
headers << tr("Modules");
|
||||||
|
mModulesListView->setHeaderLabels(headers);
|
||||||
// Set list view
|
// Set list view
|
||||||
mModulesListView->setColumnText(0,tr("Modules"));
|
|
||||||
mModulesListView->clear();
|
mModulesListView->clear();
|
||||||
mModulesListView->setSorting(-1);
|
mModulesListView->setSortingEnabled(false);
|
||||||
mModulesListView->setRootIsDecorated(true);
|
mModulesListView->setRootIsDecorated(true);
|
||||||
mModulesListView->setResizeMode(Q3ListView::AllColumns);
|
// mModulesListView->setResizeMode(QTreeWidget::AllColumns);
|
||||||
mModulesListView->header()->hide();
|
mModulesListView->header()->hide();
|
||||||
|
|
||||||
connect( mModulesListView, SIGNAL(clicked(Q3ListViewItem *)),
|
connect( mModulesListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
|
||||||
this, SLOT(moduleClicked( Q3ListViewItem *)) );
|
this, SLOT(moduleClicked( QTreeWidgetItem *, int)) );
|
||||||
|
|
||||||
QString title = "GRASS Tools: " + QgsGrass::getDefaultLocation()
|
QString title = "GRASS Tools: " + QgsGrass::getDefaultLocation()
|
||||||
+ "/" + QgsGrass::getDefaultMapset();
|
+ "/" + QgsGrass::getDefaultMapset();
|
||||||
@ -157,15 +153,15 @@ QgsGrassTools::QgsGrassTools ( QgisInterface *iface,
|
|||||||
this, SLOT(emitRegionChanged()) );
|
this, SLOT(emitRegionChanged()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGrassTools::moduleClicked( Q3ListViewItem * item )
|
void QgsGrassTools::moduleClicked( QTreeWidgetItem * item, int column )
|
||||||
{
|
{
|
||||||
#ifdef QGISDEBUG
|
// #ifdef QGISDEBUG
|
||||||
std::cerr << "QgsGrassTools::moduleClicked()" << std::endl;
|
std::cerr << "QgsGrassTools::moduleClicked()" << std::endl;
|
||||||
#endif
|
// #endif
|
||||||
if ( !item ) return;
|
if ( !item ) return;
|
||||||
|
|
||||||
QString name = item->text(1);
|
QString name = item->text(1);
|
||||||
//std::cerr << "name = " << name << std::endl;
|
std::cerr << "name = " << name.ascii() << std::endl;
|
||||||
|
|
||||||
if ( name.length() == 0 ) return; // Section
|
if ( name.length() == 0 ) return; // Section
|
||||||
|
|
||||||
@ -221,7 +217,7 @@ void QgsGrassTools::moduleClicked( Q3ListViewItem * item )
|
|||||||
proc->start(msysPath + " " + myArguments);
|
proc->start(msysPath + " " + myArguments);
|
||||||
proc->waitForStarted();
|
proc->waitForStarted();
|
||||||
if ( proc->state() != QProcess::Running )
|
if ( proc->state() != QProcess::Running )
|
||||||
{
|
{
|
||||||
QMessageBox::warning( 0, "Warning",
|
QMessageBox::warning( 0, "Warning",
|
||||||
"Cannot start MSYS (" + msysPath + ")" );
|
"Cannot start MSYS (" + msysPath + ")" );
|
||||||
}
|
}
|
||||||
@ -278,6 +274,7 @@ bool QgsGrassTools::loadConfig(QString filePath)
|
|||||||
std::cerr << "QgsGrassTools::loadConfig(): " << filePath.toLocal8Bit().data() << std::endl;
|
std::cerr << "QgsGrassTools::loadConfig(): " << filePath.toLocal8Bit().data() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mModulesListView->clear();
|
mModulesListView->clear();
|
||||||
|
mModulesListView->setIconSize(QSize(80,22));
|
||||||
|
|
||||||
QFile file ( filePath );
|
QFile file ( filePath );
|
||||||
|
|
||||||
@ -320,12 +317,12 @@ bool QgsGrassTools::loadConfig(QString filePath)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGrassTools::addModules ( Q3ListViewItem *parent, QDomElement &element )
|
void QgsGrassTools::addModules ( QTreeWidgetItem *parent, QDomElement &element )
|
||||||
{
|
{
|
||||||
QDomNode n = element.firstChild();
|
QDomNode n = element.firstChild();
|
||||||
|
|
||||||
Q3ListViewItem *item;
|
QTreeWidgetItem *item;
|
||||||
Q3ListViewItem *lastItem = 0;
|
QTreeWidgetItem *lastItem = 0;
|
||||||
while( !n.isNull() ) {
|
while( !n.isNull() ) {
|
||||||
QDomElement e = n.toElement();
|
QDomElement e = n.toElement();
|
||||||
if( !e.isNull() ) {
|
if( !e.isNull() ) {
|
||||||
@ -337,16 +334,16 @@ void QgsGrassTools::addModules ( Q3ListViewItem *parent, QDomElement &element )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
item = new Q3ListViewItem( parent, lastItem );
|
item = new QTreeWidgetItem( parent, lastItem );
|
||||||
} else {
|
} else {
|
||||||
item = new Q3ListViewItem( mModulesListView, lastItem );
|
item = new QTreeWidgetItem( mModulesListView, lastItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e.tagName() == "section" ) {
|
if ( e.tagName() == "section" ) {
|
||||||
QString label = e.attribute("label");
|
QString label = e.attribute("label");
|
||||||
std::cout << "label = " << label.toLocal8Bit().data() << std::endl;
|
std::cout << "label = " << label.toLocal8Bit().data() << std::endl;
|
||||||
item->setText( 0, label );
|
item->setText( 0, label );
|
||||||
item->setOpen(true); // for debuging to spare one click
|
item->setExpanded(true); // for debuging to spare one click
|
||||||
|
|
||||||
addModules ( item, e );
|
addModules ( item, e );
|
||||||
|
|
||||||
@ -360,7 +357,7 @@ void QgsGrassTools::addModules ( Q3ListViewItem *parent, QDomElement &element )
|
|||||||
QPixmap pixmap = QgsGrassModule::pixmap ( path, 25 );
|
QPixmap pixmap = QgsGrassModule::pixmap ( path, 25 );
|
||||||
|
|
||||||
item->setText( 0, label );
|
item->setText( 0, label );
|
||||||
item->setPixmap( 0, pixmap );
|
item->setIcon( 0, QIcon(pixmap) );
|
||||||
item->setText( 1, name );
|
item->setText( 1, name );
|
||||||
lastItem = item;
|
lastItem = item;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QString;
|
class QString;
|
||||||
class Q3ListView;
|
class QTreeWidget;
|
||||||
class Q3ListViewItem;
|
class QTreeWidgetItem;
|
||||||
class QDomNode;
|
class QDomNode;
|
||||||
class QDomElement;
|
class QDomElement;
|
||||||
class QSize;
|
class QSize;
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
//! Recursively add sections and modules to the list view
|
//! Recursively add sections and modules to the list view
|
||||||
// If parent is 0, the modules are added to mModulesListView root
|
// If parent is 0, the modules are added to mModulesListView root
|
||||||
void addModules ( Q3ListViewItem *parent, QDomElement &element );
|
void addModules ( QTreeWidgetItem *parent, QDomElement &element );
|
||||||
|
|
||||||
//! Returns application directory
|
//! Returns application directory
|
||||||
QString appDir();
|
QString appDir();
|
||||||
@ -88,7 +88,7 @@ public slots:
|
|||||||
void saveWindowLocation();
|
void saveWindowLocation();
|
||||||
|
|
||||||
//! Module in list clicked
|
//! Module in list clicked
|
||||||
void moduleClicked ( Q3ListViewItem * item );
|
void moduleClicked ( QTreeWidgetItem * item, int column );
|
||||||
|
|
||||||
//! Current mapset changed
|
//! Current mapset changed
|
||||||
void mapsetChanged();
|
void mapsetChanged();
|
||||||
@ -113,7 +113,7 @@ private:
|
|||||||
QgsGrassBrowser *mBrowser;
|
QgsGrassBrowser *mBrowser;
|
||||||
|
|
||||||
QgsGrassToolsTabWidget *mTabWidget;
|
QgsGrassToolsTabWidget *mTabWidget;
|
||||||
Q3ListView *mModulesListView;
|
QTreeWidget *mModulesListView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSGRASSTOOLS_H
|
#endif // QGSGRASSTOOLS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user