Skip to content

Commit

Permalink
src:persistent storage of session information
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Oct 19, 2023
1 parent 4f6d55d commit 4928db4
Show file tree
Hide file tree
Showing 42 changed files with 7,714 additions and 7,305 deletions.
407 changes: 206 additions & 201 deletions lang/quardCRT_en_US.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lang/quardCRT_ja_JP.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lang/quardCRT_zh_CN.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_arn.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_ast.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_bg.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_ca.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_cs.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_cy.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_da.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_de.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_el.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_es.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_et.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_fr.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_gl.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_he.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_hr.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_hu.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_it.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_ja.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_ko.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_lt.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_nb_NO.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_nl.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_pl.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_pt.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_pt_BR.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_ru.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_si.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_sk.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_tr.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_uk.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_zh_CN.ts

Large diffs are not rendered by default.

407 changes: 206 additions & 201 deletions lib/qtermwidget/translations/qtermwidget_zh_TW.ts

Large diffs are not rendered by default.

310 changes: 255 additions & 55 deletions src/mainwindow.cpp

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,28 @@ class MainWindow : public QMainWindow
void menuAndToolBarInit(void);
void menuAndToolBarRetranslateUi(void);
void menuAndToolBarConnectSignals(void);
SessionsWindow *startTelnetSession(MainWidgetGroup *group, QString hostname, quint16 port, QTelnet::SocketType type);
SessionsWindow *startTelnetSession(MainWidgetGroup *group, QString hostname, quint16 port, QTelnet::SocketType type, bool addTab = false, QString name = QString());
SessionsWindow *startSerialSession(MainWidgetGroup *group, QString portName, uint32_t baudRate,
int dataBits, int parity, int stopBits, bool flowControl, bool xEnable);
SessionsWindow *startLocalShellSession(MainWidgetGroup *group, const QString &command = QString(), const QString &workingDirectory = QDir::homePath());
SessionsWindow *startRawSocketSession(MainWidgetGroup *group, QString hostname, quint16 port);
int dataBits, int parity, int stopBits, bool flowControl, bool xEnable, bool addTab = false, QString name = QString());
SessionsWindow *startLocalShellSession(MainWidgetGroup *group, const QString &command = QString(), const QString &workingDirectory = QDir::homePath(), bool addTab = false, QString name = QString());
SessionsWindow *startRawSocketSession(MainWidgetGroup *group, QString hostname, quint16 port, bool addTab = false, QString name = QString());
SessionsWindow *startSSH2Session(MainWidgetGroup *group,
QString hostname, quint16 port, QString username, QString password);
QString hostname, quint16 port, QString username, QString password, bool addTab = false, QString name = QString());
int stopSession(MainWidgetGroup *group, int index);
int stopAllSession(void);
int cloneCurrentSession(MainWidgetGroup *group);
int cloneCurrentSession(MainWidgetGroup *group, bool addTab = false, QString name = QString());
MainWidgetGroup *findCurrentFocusGroup(void);
QTermWidget *findCurrentFocusTermWidget(void);
QMenu *createPopupMenu(void) override;
void setSessionClassActionEnable(bool enable);
void setGlobalOptions(SessionsWindow *window);
QString getDirAndcheckeSysName(const QString &title);
void addBookmark(const QString &path);
bool checkSessionName(QString &name);
int addSessionToSessionManager(SessionsWindow *sessionsWindow, QString &name);
void removeSessionFromSessionManager(QString name);
void connectSessionFromSessionManager(QString name);
void restoreSessionToSessionManager(void);

private:
Ui::MainWindow *ui;
Expand Down
3 changes: 3 additions & 0 deletions src/sessionmanagerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ SessionManagerWidget::SessionManagerWidget(QWidget *parent) :
tree = new SessionTreeView(this);
ui->verticalLayout->addWidget(tree);

connect(tree, &SessionTreeView::sessionConnect, this, &SessionManagerWidget::sessionConnect);
connect(tree, &SessionTreeView::sessionRemove, this, &SessionManagerWidget::sessionRemove);

retranslateUi();
}

Expand Down
6 changes: 5 additions & 1 deletion src/sessionmanagerwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class SessionManagerWidget : public QWidget
void addSession(QString str, int type);
void removeSession(QString str);
bool checkSession(QString str);


signals:
void sessionConnect(QString str);
void sessionRemove(QString str);

private:
Ui::SessionManagerWidget *ui;
QToolBar *toolBar;
Expand Down
27 changes: 20 additions & 7 deletions src/sessiontreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,27 @@ void SessionTreeView::retranslateUi() {
void SessionTreeView::contextMenuEvent(QContextMenuEvent *event) {
QModelIndex tIndex = indexAt(viewport()->mapFromGlobal(event->globalPos()));
if (tIndex.isValid()) {
int type; QString name;
mode->info(tIndex, type, name);
QMenu *contextMenu = new QMenu(this);
QAction *connectTerminalAction = new QAction(tr("Connect Terminal"), contextMenu);
contextMenu->addAction(connectTerminalAction);
QAction *connectInNewWindowAction = new QAction(tr("Connect in New Window"), contextMenu);
contextMenu->addAction(connectInNewWindowAction);
QAction *connectInNewTabGroupAction = new QAction(tr("Connect in New Tab Group"), contextMenu);
contextMenu->addAction(connectInNewTabGroupAction);
contextMenu->addSeparator();
if(type != -1) {
QAction *connectTerminalAction = new QAction(tr("Connect Terminal"), contextMenu);
contextMenu->addAction(connectTerminalAction);
connect(connectTerminalAction, &QAction::triggered, this, [=](){
emit sessionConnect(name);
});
QAction *connectInNewWindowAction = new QAction(tr("Connect in New Window"), contextMenu);
contextMenu->addAction(connectInNewWindowAction);
QAction *connectInNewTabGroupAction = new QAction(tr("Connect in New Tab Group"), contextMenu);
contextMenu->addAction(connectInNewTabGroupAction);
contextMenu->addSeparator();
QAction *deleteAction = new QAction(tr("Delete"), contextMenu);
contextMenu->addAction(deleteAction);
connect(deleteAction, &QAction::triggered, this, [=](){
emit sessionRemove(name);
});
contextMenu->addSeparator();
}
QAction *propertiesAction = new QAction(tr("Properties"), contextMenu);
contextMenu->addAction(propertiesAction);
if(!contextMenu->isEmpty()) {
Expand Down
4 changes: 4 additions & 0 deletions src/sessiontreeview.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class SessionTreeView : public QTreeView
bool checkSession(QString str);
void retranslateUi();

signals:
void sessionConnect(QString str);
void sessionRemove(QString str);

protected:
void contextMenuEvent(QContextMenuEvent *event) override;

Expand Down

0 comments on commit 4928db4

Please sign in to comment.