Browse Source

Get rid of remaining init() and destroy() slots/methods, use constructors and destructors directly throughout.

git-svn-id: file:///var/svn/tigccpp/trunk@1122 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 17 years ago
parent
commit
fe8d84adc1
6 changed files with 19 additions and 98 deletions
  1. 8 30
      ktigcc/mainform.cpp
  2. 0 2
      ktigcc/mainform.h
  3. 6 31
      ktigcc/preferencesdlg.cpp
  4. 0 2
      ktigcc/preferencesdlg.h
  5. 5 31
      ktigcc/projectoptions.cpp
  6. 0 2
      ktigcc/projectoptions.h

+ 8 - 30
ktigcc/mainform.cpp

@@ -1012,8 +1012,13 @@ void setTabWidth(KTextEditor::View *view, unsigned tabWidth)
   sendCommand(view,QString("set-tab-width %1").arg(tabWidth));
 }
 
-void MainForm::init()
+MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
+  : QMainWindow(parent, name, fl)
 {
+  setupUi(this);
+
+  (void)statusBar();
+
   QPixmap smallIcon(":/images/ktigcc.png");
   QPixmap largeIcon(":/images/icon.png");
   QIcon windowIcon(smallIcon);
@@ -1312,7 +1317,7 @@ void MainForm::init()
   }
 }
 
-void MainForm::destroy()
+MainForm::~MainForm()
 {
   while (!sourceFiles.isEmpty()) {
     delete sourceFiles.first();
@@ -6412,35 +6417,8 @@ QString MainForm::textForHeader(const QString &fileName)
   return QString::null;
 }
 
-/*
- *  Constructs a MainForm as a child of 'parent', with the
- *  name 'name' and widget flags set to 'f'.
- *
- */
-MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
-    : QMainWindow(parent, name, fl)
-{
-    setupUi(this);
-
-    (void)statusBar();
-    init();
-}
-
-/*
- *  Destroys the object and frees any allocated resources
- */
-MainForm::~MainForm()
-{
-    destroy();
-    // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- *  Sets the strings of the subwidgets using the current
- *  language.
- */
 void MainForm::languageChange()
 {
-    retranslateUi(this);
+  retranslateUi(this);
 }
 

+ 0 - 2
ktigcc/mainform.h

@@ -60,8 +60,6 @@ public:
 public slots:
     virtual void errorListView_clicked( Q3ListViewItem * item );
     virtual bool findSourceFile( bool & inProject, void * & srcFile, const QString & fileName );
-    virtual void init();
-    virtual void destroy();
     virtual void te_popup_aboutToShow();
     virtual void te_popup_activated( int index );
     virtual void shortcut_0_activated();

+ 6 - 31
ktigcc/preferencesdlg.cpp

@@ -102,8 +102,11 @@ class ListBoxTextPair : public Q3ListBoxText {
     QString m_data;
 };
 
-void Preferences::init()
+Preferences::Preferences(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+  : QDialog(parent, name, modal, fl)
 {
+  setupUi(this);
+
   // General
   stopAtFirstError->setChecked(preferences.stopAtFirstError);
   jumpToError->setChecked(preferences.jumpToError);
@@ -219,7 +222,7 @@ void Preferences::init()
   templateListBox->sort();
 }
 
-void Preferences::destroy()
+Preferences::~Preferences()
 {
   if (result()==Accepted) {
     // General
@@ -746,36 +749,8 @@ void Preferences::regenCompletionInfoButton_clicked()
   setCursor(QCursor());
 }
 
-/*
- *  Constructs a Preferences as a child of 'parent', with the
- *  name 'name' and widget flags set to 'f'.
- *
- *  The dialog will by default be modeless, unless you set 'modal' to
- *  true to construct a modal dialog.
- */
-Preferences::Preferences(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
-    : QDialog(parent, name, modal, fl)
-{
-    setupUi(this);
-
-    init();
-}
-
-/*
- *  Destroys the object and frees any allocated resources
- */
-Preferences::~Preferences()
-{
-    destroy();
-    // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- *  Sets the strings of the subwidgets using the current
- *  language.
- */
 void Preferences::languageChange()
 {
-    retranslateUi(this);
+  retranslateUi(this);
 }
 

+ 0 - 2
ktigcc/preferencesdlg.h

@@ -31,8 +31,6 @@ public:
     ~Preferences();
 
 public slots:
-    virtual void init();
-    virtual void destroy();
     virtual void linkTarget_toggled(bool on);
     virtual void bgColorChange_clicked();
     virtual void editorFontChange_clicked();

+ 5 - 31
ktigcc/projectoptions.cpp

@@ -36,8 +36,10 @@
 ProgramOptions *programoptions;
 //the program options subdialog is created at initialization of a ProjectOptions and remains existant until the ProjectOptions is destroyed.
 
-void ProjectOptions::init()
+ProjectOptions::ProjectOptions(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
+  : QDialog(parent, name, modal, fl)
 {
+  setupUi(this);
   if (!have_fargo) FargoProgram->hide();
   if (!have_flashos) FlashOperatingSystem->hide();
   //Create the Program Options dialog
@@ -49,7 +51,7 @@ void ProjectOptions::init()
   UpdateVisibilities();
 }
 
-void ProjectOptions::destroy()
+ProjectOptions::~ProjectOptions()
 {
   //Save settings
   if (result()==QDialog::Accepted)
@@ -264,36 +266,8 @@ void ProjectOptions::browseButton_clicked()
     CallAfterBuilding->setText(KShell::quoteArg(ret)+" \"($TI89File)\" \"($TI92PlusFile)\" \"($V200File)\"");
 }
 
-/*
- *  Constructs a ProjectOptions as a child of 'parent', with the
- *  name 'name' and widget flags set to 'f'.
- *
- *  The dialog will by default be modeless, unless you set 'modal' to
- *  true to construct a modal dialog.
- */
-ProjectOptions::ProjectOptions(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
-    : QDialog(parent, name, modal, fl)
-{
-    setupUi(this);
-
-    init();
-}
-
-/*
- *  Destroys the object and frees any allocated resources
- */
-ProjectOptions::~ProjectOptions()
-{
-    destroy();
-    // no need to delete child widgets, Qt does it all for us
-}
-
-/*
- *  Sets the strings of the subwidgets using the current
- *  language.
- */
 void ProjectOptions::languageChange()
 {
-    retranslateUi(this);
+  retranslateUi(this);
 }
 

+ 0 - 2
ktigcc/projectoptions.h

@@ -43,8 +43,6 @@ protected slots:
     virtual void languageChange();
 
 private:
-    void init();
-    void destroy();
     void ImportSettings( void );
     void ExportSettings( void );