[Kstars-devel] branches/kstars/summer/kstars/kstars/tools
Prakash Mohan
prak902000 at gmail.com
Sat May 30 19:30:17 CEST 2009
SVN commit 975683 by prakash:
Instead of creating new instances of WUTDialog, FindDialog, LocationDialog, creating a QPointer version of it and deleting the memory allocated on the close of the corresponding dialogs.
CCMAIL: kstars-devel at kde.org
M +13 -13 observinglist.cpp
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #975682:975683
@@ -304,7 +304,6 @@
}
} else { // name is not "star"
//Find object in table by name
- // TODO: Is there no already existing method to do this? - Akarsh
for ( int irow = 0; irow < m_Model->rowCount(); ++irow ) {
QString name = m_Model->item(irow, 0)->text();
if ( o->translatedName() == name ) {
@@ -705,7 +704,7 @@
if ( currentObject() ) {
QPointer<DetailDialog> dd = new DetailDialog( currentObject(), ks->data()->lt(), geo, ks );
dd->exec();
- delete dd;
+ delete dd;
}
}
@@ -713,8 +712,9 @@
bool session = false;
if( ui->tabWidget->currentIndex() )
session = true;
- WUTDialog w( ks, session );
- w.exec();
+ QPointer<WUTDialog> w = new WUTDialog( ks, session );
+ w->exec();
+ delete w;
}
void ObservingList::slotAddToSession() {
@@ -730,9 +730,9 @@
}
void ObservingList::slotFind() {
- FindDialog fd( ks );
- if ( fd.exec() == QDialog::Accepted ) {
- SkyObject *o = fd.selectedObject();
+ QPointer<FindDialog> fd = new FindDialog( ks );
+ if ( fd->exec() == QDialog::Accepted ) {
+ SkyObject *o = fd->selectedObject();
if( o!= 0 ) {
if( ui->tabWidget->currentIndex() )
slotAddObject( o, true );
@@ -740,7 +740,7 @@
slotAddObject( o );
}
}
-
+ delete fd;
}
void ObservingList::slotAVT() {
@@ -754,9 +754,8 @@
avt->processObject( o );
}
}
-
avt->exec();
- delete avt;
+ delete avt;
}
}
@@ -1139,12 +1138,13 @@
ui->View->removeAllPlotObjects();
}
void ObservingList::slotLocation() {
- LocationDialog ld( (KStars*) topLevelWidget()->parent() );
+ QPointer<LocationDialog> ld = new LocationDialog( (KStars*) topLevelWidget()->parent() );
- if ( ld.exec() == QDialog::Accepted ) {
- geo = ld.selectedCity();
+ if ( ld->exec() == QDialog::Accepted ) {
+ geo = ld->selectedCity();
ui->SetLocation -> setText( geo -> fullName() );
}
+ delete ld;
}
void ObservingList::slotUpdate() {
More information about the Kstars-devel
mailing list