1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 17:55:19 +03:00

Now we are able to have Model windows with different transmitter types!

This commit is contained in:
bsongis 2014-04-18 17:34:41 +02:00
parent a5085cf7e2
commit 5de6f4dc94
3 changed files with 22 additions and 19 deletions

View file

@ -1546,17 +1546,17 @@ void MainWindow::updateMenus()
MdiChild *MainWindow::createMdiChild() MdiChild *MainWindow::createMdiChild()
{ {
MdiChild *child = new MdiChild; MdiChild *child = new MdiChild();
mdiArea->addSubWindow(child); mdiArea->addSubWindow(child);
if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized()) if(!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized())
child->parentWidget()->resize(400, 400); child->parentWidget()->resize(400, 400);
connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool))); connect(child, SIGNAL(copyAvailable(bool)),cutAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool))); connect(child, SIGNAL(copyAvailable(bool)),copyAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool))); connect(child, SIGNAL(copyAvailable(bool)),simulateAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool))); connect(child, SIGNAL(copyAvailable(bool)),printAct, SLOT(setEnabled(bool)));
return child; return child;
} }
QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot, QObject *slotObj) QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot, QObject *slotObj)

View file

@ -66,6 +66,7 @@
MdiChild::MdiChild(): MdiChild::MdiChild():
QWidget(), QWidget(),
ui(new Ui::mdiChild), ui(new Ui::mdiChild),
firmware(GetCurrentFirmware()),
isUntitled(true), isUntitled(true),
fileChanged(false) fileChanged(false)
{ {
@ -103,7 +104,7 @@ void MdiChild::qSleep(int ms)
void MdiChild::eepromInterfaceChanged() void MdiChild::eepromInterfaceChanged()
{ {
ui->modelsList->refreshList(); ui->modelsList->refreshList();
ui->SimulateTxButton->setEnabled(GetCurrentFirmware()->getCapability(Simulation)); ui->SimulateTxButton->setEnabled(firmware->getCapability(Simulation));
updateTitle(); updateTitle();
} }
@ -181,7 +182,7 @@ void MdiChild::modelEdit()
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
checkAndInitModel( row ); checkAndInitModel( row );
ModelData &model = radioData.models[row - 1]; ModelData &model = radioData.models[row - 1];
ModelEdit *t = new ModelEdit(this, radioData, (row - 1), GetCurrentFirmware()); ModelEdit *t = new ModelEdit(this, radioData, (row - 1), firmware);
t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name); t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name);
connect(t, SIGNAL(modified()), this, SLOT(setModified())); connect(t, SIGNAL(modified()), this, SLOT(setModified()));
t->show(); t->show();
@ -666,10 +667,10 @@ void MdiChild::print(int model, QString filename)
PrintDialog * pd = NULL; PrintDialog * pd = NULL;
if (model>=0 && !filename.isEmpty()) { if (model>=0 && !filename.isEmpty()) {
pd = new PrintDialog(this, GetCurrentFirmware(), &radioData.generalSettings, &radioData.models[model], filename); pd = new PrintDialog(this, firmware, &radioData.generalSettings, &radioData.models[model], filename);
} }
else if (ui->modelsList->currentRow() > 0) { else if (ui->modelsList->currentRow() > 0) {
pd = new PrintDialog(this, GetCurrentFirmware(), &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]); pd = new PrintDialog(this, firmware, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
} }
if (pd) { if (pd) {

View file

@ -59,7 +59,7 @@ class MdiChild : public QWidget
Q_OBJECT Q_OBJECT
public: public:
MdiChild(); MdiChild();
~MdiChild(); ~MdiChild();
@ -78,18 +78,18 @@ public:
void eepromInterfaceChanged(); void eepromInterfaceChanged();
void setEEpromAvail(int eavail); void setEEpromAvail(int eavail);
signals: signals:
void copyAvailable(bool val); void copyAvailable(bool val);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
private slots: private slots:
void documentWasModified(); void documentWasModified();
void on_SimulateTxButton_clicked(); void on_SimulateTxButton_clicked();
void qSleep(int ms); void qSleep(int ms);
public slots: public slots:
void checkAndInitModel(int row); void checkAndInitModel(int row);
void generalEdit(); void generalEdit();
void modelEdit(); void modelEdit();
@ -105,7 +105,7 @@ public slots:
void setModified(); void setModified();
void updateTitle(); void updateTitle();
private: private:
bool maybeSave(); bool maybeSave();
void setCurrentFile(const QString &fileName); void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName); QString strippedName(const QString &fullFileName);
@ -115,6 +115,8 @@ private:
Ui::mdiChild *ui; Ui::mdiChild *ui;
QString curFile; QString curFile;
FirmwareInterface * firmware;
RadioData radioData; RadioData radioData;
bool isUntitled; bool isUntitled;