| 1065 | } |
| 1066 | |
| 1067 | void TOPPASBase::updateMenu() |
| 1068 | { |
| 1069 | TOPPASWidget* tw = activeSubWindow_(); |
| 1070 | TOPPASScene* ts = nullptr; |
| 1071 | if (tw) |
| 1072 | { |
| 1073 | ts = tw->getScene(); |
| 1074 | } |
| 1075 | |
| 1076 | QList<QAction*> actions = this->findChildren<QAction*>(""); |
| 1077 | for (int i = 0; i < actions.count(); ++i) |
| 1078 | { |
| 1079 | QString text = actions[i]->text(); |
| 1080 | |
| 1081 | if (text == "&Run (F5)") |
| 1082 | { |
| 1083 | bool show = false; |
| 1084 | if (ts && !(ts->isPipelineRunning())) |
| 1085 | { |
| 1086 | show = true; |
| 1087 | } |
| 1088 | actions[i]->setEnabled(show); |
| 1089 | } |
| 1090 | else if (text == "&Abort") |
| 1091 | { |
| 1092 | bool show = false; |
| 1093 | if (ts && ts->isPipelineRunning()) |
| 1094 | { |
| 1095 | show = true; |
| 1096 | } |
| 1097 | actions[i]->setEnabled(show); |
| 1098 | } |
| 1099 | else if (text == "&Include") |
| 1100 | { |
| 1101 | bool show = ts; |
| 1102 | actions[i]->setEnabled(show); |
| 1103 | } |
| 1104 | else if (text == "&Load resource file") |
| 1105 | { |
| 1106 | bool show = ts; |
| 1107 | actions[i]->setEnabled(show); |
| 1108 | } |
| 1109 | else if (text == "Save &resource file") |
| 1110 | { |
| 1111 | bool show = ts; |
| 1112 | actions[i]->setEnabled(show); |
| 1113 | } |
| 1114 | else if (text == "&Save") |
| 1115 | { |
| 1116 | bool show = ts && ts->wasChanged(); |
| 1117 | actions[i]->setEnabled(show); |
| 1118 | } |
| 1119 | else if (text == "Refresh ¶meters") |
| 1120 | { |
| 1121 | bool show = ts && !(ts->isPipelineRunning()); |
| 1122 | actions[i]->setEnabled(show); |
| 1123 | } |
| 1124 | } |