Skip to content

Commit

Permalink
Add system beep support
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 Aug 28, 2024
1 parent 78e963d commit 8fa011e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ en-US:

- Automatically use the default configuration if the Profile does not exist on Windows
- Add ToolTip to the connection bar
- Add system beep support

zh-CN:

- Windows下Profile如果不存在则自动使用默认配置
- 增加连接条ToolTip显示
- 增加系统响铃支持

## [[V0.5.0](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.5.0)] - 2024-08-26

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Automatically use the default configuration if the Profile does not exist on Windows
- Add ToolTip to the connection bar
- Add system beep support

## [[V0.5.0](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.5.0)] - 2024-08-26

Expand Down
3 changes: 1 addition & 2 deletions lib/qtermwidget/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

FilterChain::~FilterChain()
{
while (!isEmpty())
delete takeFirst();

}

void FilterChain::addFilter(Filter* filter)
Expand Down
17 changes: 9 additions & 8 deletions lib/qtermwidget/qtermwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ QTermWidget::QTermWidget(QWidget *messageParentWidget, QWidget *parent)

m_terminalDisplay = new TerminalDisplay(this);
m_emulation = new Vt102Emulation();
m_terminalDisplay->setBellMode(TerminalDisplay::NotifyBell);
m_terminalDisplay->setBellMode(TerminalDisplay::SystemBeepBell);
m_terminalDisplay->setTerminalSizeHint(true);
m_terminalDisplay->setTripleClickMode(TerminalDisplay::SelectWholeLine);
m_terminalDisplay->setTerminalSizeStartup(true);
Expand Down Expand Up @@ -110,9 +110,9 @@ QTermWidget::QTermWidget(QWidget *messageParentWidget, QWidget *parent)
connect( m_emulation, &Emulation::cursorChanged, this, &QTermWidget::cursorChanged);

// That's OK, FilterChain's dtor takes care of UrlFilter.
urlFilter = new UrlFilter();
connect(urlFilter, &UrlFilter::activated, this, &QTermWidget::urlActivated);
m_terminalDisplay->filterChain()->addFilter(urlFilter);
m_urlFilter = new UrlFilter();
connect(m_urlFilter, &UrlFilter::activated, this, &QTermWidget::urlActivated);
m_terminalDisplay->filterChain()->addFilter(m_urlFilter);
m_UrlFilterEnable = true;

m_searchBar = new SearchBar(this);
Expand Down Expand Up @@ -165,8 +165,9 @@ QTermWidget::QTermWidget(QWidget *messageParentWidget, QWidget *parent)

QTermWidget::~QTermWidget()
{
setUrlFilterEnabled(true);
setUrlFilterEnabled(false);
clearHighLightTexts();
delete m_urlFilter;
delete m_searchBar;
emit destroyed();
delete m_emulation;
Expand Down Expand Up @@ -466,7 +467,7 @@ void QTermWidget::monitorTimerDone()
void QTermWidget::activityStateSet(int state)
{
if (state==NOTIFYBELL) {
m_terminalDisplay->bell(tr("Bell in session"));
m_terminalDisplay->bell("Bell in QTermWidget!");
} else if (state==NOTIFYACTIVITY) {
if (m_monitorSilence) {
m_monitorTimer->start(m_silenceSeconds*1000);
Expand Down Expand Up @@ -954,9 +955,9 @@ void QTermWidget::setUrlFilterEnabled(bool enable) {
return;
}
if(enable) {
m_terminalDisplay->filterChain()->addFilter(urlFilter);
m_terminalDisplay->filterChain()->addFilter(m_urlFilter);
} else {
m_terminalDisplay->filterChain()->removeFilter(urlFilter);
m_terminalDisplay->filterChain()->removeFilter(m_urlFilter);
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/qtermwidget/qtermwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,19 +374,19 @@ private slots:
QWidget *messageParentWidget = nullptr;
TerminalDisplay *m_terminalDisplay = nullptr;
Emulation *m_emulation = nullptr;
SearchBar* m_searchBar;
QVBoxLayout *m_layout;
SearchBar* m_searchBar = nullptr;
QVBoxLayout *m_layout = nullptr;
QList<HighLightText*> m_highLightTexts;
bool m_echo = false;
UrlFilter *urlFilter = nullptr;
UrlFilter *m_urlFilter = nullptr;
bool m_UrlFilterEnable = true;
bool m_flowControl = true;
// Color/Font Changes by ESC Sequences
bool m_hasDarkBackground = true;
bool m_monitorActivity = false;
bool m_monitorSilence = false;
bool m_notifiedActivity = false;
QTimer* m_monitorTimer;
QTimer* m_monitorTimer = nullptr;
int m_silenceSeconds = 10;
};

Expand Down

0 comments on commit 8fa011e

Please sign in to comment.