Skip to content

Commit

Permalink
api: added focus instrument call
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Suciu <[email protected]>
  • Loading branch information
adisuciu committed Jan 14, 2022
1 parent 669d664 commit 50015ab
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tool_launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,10 @@ void ToolLauncher::toolDetached(bool detached)
tool->setMinimumSize(910, 490);
}

enum tool ToolLauncher::getSelectedToolId() const {
return selectedToolId;
}



void ToolLauncher::closeEvent(QCloseEvent *event)
Expand Down
2 changes: 2 additions & 0 deletions src/tool_launcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class ToolLauncher : public QMainWindow
void setNativeDialogs(bool nativeDialogs);

PhoneHome *getPhoneHome() const;
enum tool getSelectedToolId() const;

Q_SIGNALS:
void connectionDone(bool success);
Expand Down Expand Up @@ -291,6 +292,7 @@ private Q_SLOTS:
PhoneHome* m_phoneHome;

SessionInfo m_sessionInfo;
enum tool selectedToolId;

};
}
Expand Down
11 changes: 11 additions & 0 deletions src/tool_launcher_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ bool ToolLauncher_API::calibration_skipped()
return tl->skip_calibration;
}

int ToolLauncher_API::focused_instrument() {
return static_cast<int>(tl->getSelectedToolId());
}

void ToolLauncher_API::focus_instrument(int inst) {
if(inst >= 0 ) {
tl->_toolSelected(static_cast<enum tool>(inst));
}

}

QList<QString> ToolLauncher_API::usb_uri_list()
{
QList<QString> uri_list;
Expand Down
5 changes: 5 additions & 0 deletions src/tool_launcher_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ToolLauncher_API: public ApiObject
Q_PROPERTY(bool menu_opened READ menu_opened WRITE open_menu
STORED false);

Q_PROPERTY(int focused_instrument READ focused_instrument WRITE focus_instrument );

Q_PROPERTY(bool hidden READ hidden WRITE hide STORED false);

Q_PROPERTY(QString previous_ip READ getPreviousIp WRITE addIp
Expand Down Expand Up @@ -64,6 +66,9 @@ class ToolLauncher_API: public ApiObject
bool calibration_skipped();
void skip_calibration(bool);

int focused_instrument();
void focus_instrument(int);

bool debugger_enabled();
void enable_debugger(bool);

Expand Down

0 comments on commit 50015ab

Please sign in to comment.