scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

OpenProjectDialog Class Reference

#include <OpenProjectDialog.h>

Inheritance diagram for OpenProjectDialog:
[legend]
Collaboration diagram for OpenProjectDialog:
[legend]

Public Types

enum  OpenMode { NewProject, NewFolder }
 

Public Member Functions

 OpenProjectDialog (QWidget *parent=0, bool extended=true, Qt::WindowFlags flags=0)
 
OpenMode openMode () const
 
void setExtensionWidget (QWidget *extension)
 Set the extension widget to be displayed when the user presses the toggle button. More...
 
bool isExtendable ()
 Tells weather the dialog has a valid extension widget. More...
 
bool isExtended ()
 
void setExtended (bool extended)
 

Protected Slots

void closeEvent (QCloseEvent *)
 
void updateAdvancedOptions (const QString &filter)
 Update which options are visible and enabled based on the output format. More...
 

Protected Attributes

QPushButton * d_extension_toggle
 Button for toggling display of extension on/off. More...
 

Private Slots

void resize (bool extension_on)
 Resize to make/take space for the extension widget. More...
 

Private Attributes

QComboBox * d_open_mode
 
QWidget * d_extension
 The extension widget. More...
 
int d_extension_row
 The layout row (of the assumed QGridLayout) used for extensions. More...
 

Detailed Description

File : OpenProjectDialog.h

Project : SciDAVis

Copyright : (C) 2007 by Knut Franke, Ion Vasilief Email (use @ for *) : knut.franke*gmx.de, ion_vasilief*yahoo.fr Description : Dialog for opening project files.

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
    • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
    • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 36 of file OpenProjectDialog.h.

Member Enumeration Documentation

◆ OpenMode

Enumerator
NewProject 
NewFolder 

Definition at line 40 of file OpenProjectDialog.h.

Constructor & Destructor Documentation

◆ OpenProjectDialog()

OpenProjectDialog::OpenProjectDialog ( QWidget *  parent = 0,
bool  extended = true,
Qt::WindowFlags  flags = 0 
)

File : OpenProjectDialog.cpp

Project : SciDAVis

Copyright : (C) 2007 by Knut Franke, Ion Vasilief Email (use @ for *) : knut.franke*gmx.de, ion_vasilief*yahoo.fr Description : Dialog for opening project files.

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
    • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
    • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 38 of file OpenProjectDialog.cpp.

39  : ExtensibleFileDialog(parent, extended, flags)
40 {
41  setWindowTitle(tr("Open Project"));
42  setFileMode(ExistingFile);
43  QStringList filters;
44  filters << tr("SciDAVis project") + " (*.sciprj)"
45  << tr("Compressed SciDAVis project") + " (*.sciprj.gz)"
46  << tr("QtiPlot project") + " (*.qti)"
47  << tr("Compressed QtiPlot project") + " (*.qti.gz)"
48 #ifdef ORIGIN_IMPORT
49  << tr("Origin project") + " (*.opj *.OPJ)"
50  << tr("Origin matrix") + " (*.ogm *.OGM)"
51  << tr("Origin worksheet") + " (*.ogw *.OGW)"
52  << tr("Origin graph") + " (*.ogg *.OGG)"
53  << tr("Origin 3.5 project") + " (*.org *.ORG)"
54 #endif
55  << tr("Backup files") + " (*.sciprj~)"
56  //<< tr("Python Source") + " (*.py *.PY)"
57  << tr("All files") + " (*)";
58  setNameFilters(filters);
59 
60  QWidget *advanced_options = new QWidget();
61  QHBoxLayout *advanced_layout = new QHBoxLayout();
62  advanced_options->setLayout(advanced_layout);
63  advanced_layout->addWidget(new QLabel(tr("Open As")));
64  d_open_mode = new QComboBox();
65  // Important: Keep this is sync with enum OpenMode.
66  d_open_mode->addItem(tr("New Project Window"));
67  d_open_mode->addItem(tr("New Folder"));
68  advanced_layout->addWidget(d_open_mode);
69  setExtensionWidget(advanced_options);
70 
71 #if QT_VERSION >= 0x040300
72  connect(this, SIGNAL(filterSelected ( const QString & )),
73  this, SLOT(updateAdvancedOptions ( const QString & )));
74 #else
75  QList<QComboBox*> combo_boxes = findChildren<QComboBox*>();
76  if (combo_boxes.size() >= 2)
77  connect(combo_boxes[1], SIGNAL(currentIndexChanged ( const QString & )),
78  this, SLOT(updateAdvancedOptions ( const QString & )));
79 #endif
80  updateAdvancedOptions(selectedNameFilter());
81 }

References d_open_mode, ExtensibleFileDialog::setExtensionWidget(), and updateAdvancedOptions().

Here is the call graph for this function:

Member Function Documentation

◆ closeEvent

void OpenProjectDialog::closeEvent ( QCloseEvent *  e)
protectedslot

Definition at line 93 of file OpenProjectDialog.cpp.

94 {
95  if (isExtendable()){
96  ApplicationWindow *app = (ApplicationWindow *)this->parent();
97  if (app)
98  app->d_extended_open_dialog = this->isExtended();
99  }
100 
101  e->accept();
102 }

References ApplicationWindow::d_extended_open_dialog, ExtensibleFileDialog::isExtendable(), and ExtensibleFileDialog::isExtended().

Here is the call graph for this function:

◆ isExtendable()

bool ExtensibleFileDialog::isExtendable ( )
inlineinherited

Tells weather the dialog has a valid extension widget.

Definition at line 60 of file ExtensibleFileDialog.h.

60 {return d_extension != NULL;};

References ExtensibleFileDialog::d_extension.

Referenced by closeEvent().

Here is the caller graph for this function:

◆ isExtended()

bool ExtensibleFileDialog::isExtended ( )
inlineinherited

Definition at line 61 of file ExtensibleFileDialog.h.

61 {return d_extension_toggle->isChecked();};

References ExtensibleFileDialog::d_extension_toggle.

Referenced by ImageExportDialog::closeEvent(), ImportASCIIDialog::closeEvent(), and closeEvent().

Here is the caller graph for this function:

◆ openMode()

OpenMode OpenProjectDialog::openMode ( ) const
inline

Definition at line 42 of file OpenProjectDialog.h.

42 { return (OpenMode) d_open_mode->currentIndex(); }

References d_open_mode.

Referenced by ApplicationWindow::open().

Here is the caller graph for this function:

◆ resize

void ExtensibleFileDialog::resize ( bool  extension_on)
privateslotinherited

Resize to make/take space for the extension widget.

Definition at line 91 of file ExtensibleFileDialog.cpp.

92 {
93  QSize geo = size();
94  geo.setHeight(geo.height() + (extension_on ? 1 : -1) * (d_extension->sizeHint().height()-44));
95  setGeometry(QRect(geometry().topLeft(), geo));
96 }

References ExtensibleFileDialog::d_extension.

Referenced by ExtensibleFileDialog::ExtensibleFileDialog().

Here is the caller graph for this function:

◆ setExtended()

void ExtensibleFileDialog::setExtended ( bool  extended)
inlineinherited

Definition at line 62 of file ExtensibleFileDialog.h.

62 { d_extension_toggle->setChecked(extended);};

References ExtensibleFileDialog::d_extension_toggle.

◆ setExtensionWidget()

void ExtensibleFileDialog::setExtensionWidget ( QWidget *  extension)
inherited

Set the extension widget to be displayed when the user presses the toggle button.

Definition at line 66 of file ExtensibleFileDialog.cpp.

67 {
68  if (d_extension == extension)
69  return;
70  if (d_extension) {
71  d_extension->hide();
72  disconnect(d_extension_toggle, SIGNAL(toggled(bool)));
73  }
74  d_extension = extension;
75  if (!d_extension) {
76  d_extension_toggle->hide();
77  return;
78  }
79  d_extension_toggle->show();
80 
81  QGridLayout *main_layout = qobject_cast<QGridLayout*>(layout());
82  if (main_layout)
83  main_layout->addWidget(d_extension, d_extension_row, 0, 2, main_layout->columnCount()-1);
84  else
85  layout()->addWidget(d_extension);
86 
87  d_extension->setVisible(d_extension_toggle->isChecked());
88  connect(d_extension_toggle, SIGNAL(toggled(bool)), d_extension, SLOT(setVisible(bool)));
89 }

References ExtensibleFileDialog::d_extension, ExtensibleFileDialog::d_extension_row, and ExtensibleFileDialog::d_extension_toggle.

Referenced by ApplicationWindow::appendProject(), ImageExportDialog::ImageExportDialog(), ImportASCIIDialog::ImportASCIIDialog(), OpenProjectDialog(), and TeXTableExportDialog::TeXTableExportDialog().

Here is the caller graph for this function:

◆ updateAdvancedOptions

void OpenProjectDialog::updateAdvancedOptions ( const QString &  filter)
protectedslot

Update which options are visible and enabled based on the output format.

Definition at line 83 of file OpenProjectDialog.cpp.

84 {
85  if (filter.contains("*.ogm") || filter.contains("*.ogw")) {
86  d_extension_toggle->setChecked(false);
87  d_extension_toggle->setEnabled(false);
88  return;
89  }
90  d_extension_toggle->setEnabled(true);
91 }

References ExtensibleFileDialog::d_extension_toggle.

Referenced by OpenProjectDialog().

Here is the caller graph for this function:

Member Data Documentation

◆ d_extension

QWidget* ExtensibleFileDialog::d_extension
privateinherited

◆ d_extension_row

int ExtensibleFileDialog::d_extension_row
privateinherited

The layout row (of the assumed QGridLayout) used for extensions.

Definition at line 76 of file ExtensibleFileDialog.h.

Referenced by ExtensibleFileDialog::ExtensibleFileDialog(), and ExtensibleFileDialog::setExtensionWidget().

◆ d_extension_toggle

QPushButton* ExtensibleFileDialog::d_extension_toggle
protectedinherited

◆ d_open_mode

QComboBox* OpenProjectDialog::d_open_mode
private

Definition at line 45 of file OpenProjectDialog.h.

Referenced by openMode(), and OpenProjectDialog().


The documentation for this class was generated from the following files:
ExtensibleFileDialog::d_extension_row
int d_extension_row
The layout row (of the assumed QGridLayout) used for extensions.
Definition: ExtensibleFileDialog.h:76
OpenProjectDialog::updateAdvancedOptions
void updateAdvancedOptions(const QString &filter)
Update which options are visible and enabled based on the output format.
Definition: OpenProjectDialog.cpp:83
ExtensibleFileDialog::isExtendable
bool isExtendable()
Tells weather the dialog has a valid extension widget.
Definition: ExtensibleFileDialog.h:60
OpenProjectDialog::NewFolder
@ NewFolder
Definition: OpenProjectDialog.h:40
ExtensibleFileDialog::setExtensionWidget
void setExtensionWidget(QWidget *extension)
Set the extension widget to be displayed when the user presses the toggle button.
Definition: ExtensibleFileDialog.cpp:66
ExtensibleFileDialog::d_extension
QWidget * d_extension
The extension widget.
Definition: ExtensibleFileDialog.h:74
ExtensibleFileDialog::ExtensibleFileDialog
ExtensibleFileDialog(QWidget *parent=0, bool extended=true, Qt::WindowFlags flags=0)
Constructor.
Definition: ExtensibleFileDialog.cpp:33
ExtensibleFileDialog::d_extension_toggle
QPushButton * d_extension_toggle
Button for toggling display of extension on/off.
Definition: ExtensibleFileDialog.h:62
ApplicationWindow::d_extended_open_dialog
bool d_extended_open_dialog
Definition: ApplicationWindow.h:931
python-sipcmd.flags
list flags
Definition: python-sipcmd.py:61
ApplicationWindow
SciDAVis's main window.
Definition: ApplicationWindow.h:122
OpenProjectDialog::OpenMode
OpenMode
Definition: OpenProjectDialog.h:40
ExtensibleFileDialog::isExtended
bool isExtended()
Definition: ExtensibleFileDialog.h:61
OpenProjectDialog::d_open_mode
QComboBox * d_open_mode
Definition: OpenProjectDialog.h:45
OpenProjectDialog::NewProject
@ NewProject
Definition: OpenProjectDialog.h:40