Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy #1079

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Tidy #1079

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/bookmarkswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ BookmarksModel::BookmarksModel(QObject *parent)

void BookmarksModel::setup()
{
if (m_root)
delete m_root;
delete m_root;
m_root = new BookmarkRootItem();
m_root->addChild(new BookmarkFileGroupItem(m_root, Properties::Instance()->bookmarksFile));
beginResetModel();
Expand All @@ -203,8 +202,8 @@ void BookmarksModel::setup()

BookmarksModel::~BookmarksModel()
{
if (m_root)
delete m_root;
delete m_root;
m_root = nullptr;
}

int BookmarksModel::columnCount(const QModelIndex & /* parent */) const
Expand Down Expand Up @@ -323,10 +322,10 @@ bool BookmarksModel::setData(const QModelIndex &index, const QVariant &value,

BookmarksWidget::BookmarksWidget(QWidget *parent)
: QWidget(parent)
, m_model(new BookmarksModel(this))
{
setupUi(this);

m_model = new BookmarksModel(this);
treeView->setModel(m_model);
treeView->header()->hide();
setFocusProxy(filterEdit);
Expand All @@ -342,9 +341,7 @@ BookmarksWidget::BookmarksWidget(QWidget *parent)
});
}

BookmarksWidget::~BookmarksWidget()
{
}
BookmarksWidget::~BookmarksWidget() = default;

void BookmarksWidget::setup()
{
Expand Down
5 changes: 2 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <unistd.h>
#ifdef HAVE_QDBUS
#include <QtDBus/QtDBus>
#include <unistd.h>
#include "processadaptor.h"
#endif

Expand Down Expand Up @@ -75,7 +74,7 @@ QTerminalApp * QTerminalApp::m_instance = nullptr;

void parse_args(int argc, char* argv[], QString& workdir, QStringList & shell_command, out bool& dropMode)
{
int next_option;
int next_option = 0;
dropMode = false;
do{
next_option = getopt_long(argc, argv, short_options, long_options, nullptr);
Expand Down Expand Up @@ -144,7 +143,7 @@ int main(int argc, char *argv[])

QString workdir;
QStringList shell_command;
bool dropMode;
bool dropMode = false;
parse_args(argc, argv, workdir, shell_command, dropMode);

Properties::Instance()->migrate_settings();
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ bool MainWindow::hasMultipleSubterminals(QAction *)

bool MainWindow::hasIndexedTab(QAction *action)
{
bool ok;
bool ok = false;
const int index = action->property("tab").toInt(&ok);
Q_ASSERT(ok);
static_cast<void>(ok);
Expand Down
5 changes: 1 addition & 4 deletions src/propertiesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
resize(s);
}


PropertiesDialog::~PropertiesDialog()
{
}
PropertiesDialog::~PropertiesDialog() = default;

void PropertiesDialog::accept()
{
Expand Down
2 changes: 1 addition & 1 deletion src/qterminalutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ QStringList parse_command(const QString& str)
QStringList list;
QRegularExpressionMatch match;
int index = 0;
int nextIndex;
int nextIndex = 0;
while((nextIndex = str.indexOf(separator, index, &match)) != -1)
{
if (nextIndex > index)
Expand Down
11 changes: 5 additions & 6 deletions src/tab-switcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,22 @@ class AppItemDelegate: public QStyledItemDelegate

// -----------------------------------------------------------------------------------------------------------

TabSwitcher::TabSwitcher(TabWidget* tabs):
QListView(tabs),
m_tabs(tabs)
TabSwitcher::TabSwitcher(TabWidget *tabs)
: QListView(tabs)
, m_timer(new QTimer(this))
, m_tabs(tabs)
{
setWindowFlags(Qt::Widget | Qt::Popup | Qt::WindowStaysOnTopHint);
setItemDelegate(new AppItemDelegate(frameWidth(), tabs));
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

m_timer = new QTimer(this);
m_timer->setInterval(100);
m_timer->setSingleShot(true);

connect(m_timer, &QTimer::timeout, this, &TabSwitcher::timer);
}

TabSwitcher::~TabSwitcher()
{}
TabSwitcher::~TabSwitcher() = default;

void TabSwitcher::showSwitcher()
{
Expand Down
10 changes: 4 additions & 6 deletions src/terminalconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
#include "properties.h"
#include "termwidget.h"

TerminalConfig::TerminalConfig(const QString & wdir, const QStringList & shell)
TerminalConfig::TerminalConfig(const QString &wdir, const QStringList &shell)
: m_workingDirectory(wdir)
, m_shell(shell)
{
m_workingDirectory = wdir;
m_shell = shell;
}

TerminalConfig::TerminalConfig()
{
}
TerminalConfig::TerminalConfig() = default;

TerminalConfig::TerminalConfig(const TerminalConfig &cfg)
: m_currentDirectory(cfg.m_currentDirectory),
Expand Down
13 changes: 7 additions & 6 deletions src/termwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,20 @@ bool TermWidget::eventFilter(QObject * /*obj*/, QEvent * ev)
return false;
}

TermWidget::TermWidget(TerminalConfig &cfg, QWidget * parent)
: QWidget(parent),
DBusAddressable(QStringLiteral("/terminals"))
TermWidget::TermWidget(TerminalConfig &cfg, QWidget *parent)
: QWidget(parent)
, DBusAddressable(QStringLiteral("/terminals"))
, m_term(new TermWidgetImpl(cfg, this))
, m_layout(new QVBoxLayout)
, m_border(palette().color(QPalette::Window))
{

#ifdef HAVE_QDBUS
registerAdapter<TerminalAdaptor, TermWidget>(this);
#endif
m_border = palette().color(QPalette::Window);
m_term = new TermWidgetImpl(cfg, this);

setFocusProxy(m_term);

m_layout = new QVBoxLayout;
setLayout(m_layout);

m_layout->addWidget(m_term);
Expand Down
6 changes: 2 additions & 4 deletions src/termwidgetholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ TermWidgetHolder::TermWidgetHolder(TerminalConfig &config, QWidget * parent)
setLayout(lay);
}

TermWidgetHolder::~TermWidgetHolder()
{
}
TermWidgetHolder::~TermWidgetHolder() = default;

void TermWidgetHolder::setInitialFocus()
{
Expand All @@ -75,7 +73,7 @@ void TermWidgetHolder::setInitialFocus()

void TermWidgetHolder::loadSession()
{
bool ok;
bool ok = false;
QString name = QInputDialog::getItem(this, tr("Load Session"),
tr("List of saved sessions:"),
Properties::Instance()->sessions.keys(),
Expand Down
Loading