|
19 | 19 |
|
20 | 20 | DomePanel::DomePanel(QWidget *parent): QFrame(parent) {
|
21 | 21 |
|
22 |
| -// setContentsMargins(10, 10, 10, 10); |
| 22 | + // setContentsMargins(10, 10, 10, 10); |
23 | 23 | QHBoxLayout *content = new QHBoxLayout(this);
|
24 | 24 | //content->setHorizontalSpacing(20);
|
25 | 25 |
|
@@ -92,18 +92,36 @@ void DomePanel::loadDomeFile(QString path) {
|
92 | 92 | loadLP(path);
|
93 | 93 | if(path.endsWith(".dome"))
|
94 | 94 | loadDome(path);
|
95 |
| -// dome_list->clearSelection(); |
| 95 | + // dome_list->clearSelection(); |
96 | 96 | }
|
97 | 97 |
|
98 | 98 | void DomePanel::exportDome() {
|
99 |
| - QString filename = QFileDialog::getSaveFileName(this, "Select a dome file", qRelightApp->lastProjectDir(), "*.dome"); |
| 99 | + QString filename = QFileDialog::getSaveFileName(this, "Select a dome file", qRelightApp->lastProjectDir(), "*.dome *.lp"); |
100 | 100 | if(filename.isNull())
|
101 | 101 | return;
|
102 |
| - if(!filename.endsWith(".dome")) |
103 |
| - filename += ".dome"; |
104 |
| - //TODO Basic checks, label is a problem (use filename! |
| 102 | + |
105 | 103 | Dome &dome = qRelightApp->project().dome;
|
106 |
| - dome.save(filename); |
| 104 | + |
| 105 | + if(filename.endsWith(".lp")) { |
| 106 | + try { |
| 107 | + qRelightApp->project().saveLP(filename, dome.directions); |
| 108 | + } catch(QString error) { |
| 109 | + QMessageBox::critical(this, "Failed to save the .lp file", error); |
| 110 | + return; |
| 111 | + } |
| 112 | + |
| 113 | + } else { |
| 114 | + |
| 115 | + if(!filename.endsWith(".dome")) |
| 116 | + filename += ".dome"; |
| 117 | + |
| 118 | + try { |
| 119 | + dome.save(filename); |
| 120 | + } catch(QString error) { |
| 121 | + QMessageBox::critical(this, "Failed to save the .dome file", error); |
| 122 | + return; |
| 123 | + } |
| 124 | + } |
107 | 125 | qRelightApp->addDome(filename);
|
108 | 126 | }
|
109 | 127 |
|
|
0 commit comments