Refactored, cosmetic

develop
tastytea 2018-10-23 08:29:07 +02:00
parent 6692ab8e0c
commit e9be4a1e90
No known key found for this signature in database
GPG Key ID: CFC39497F1B26E07
4 changed files with 14 additions and 7 deletions

View File

@ -57,7 +57,8 @@ void MainWindow::populate_tableview()
statusBar()->showMessage(tr("Database loaded."));
}
void MainWindow::add_row(const QString &user, const int &blocked, const QString &reason)
void MainWindow::add_row(const QString &user, const int &blocked,
const QString &reason)
{
QList<QStandardItem*> items;
items.append(new QStandardItem(user));
@ -150,7 +151,8 @@ void MainWindow::about()
void MainWindow::show_details(QModelIndex index)
{
const string user = index.sibling(index.row(), 0).data().toString().toStdString();
const string user = index.sibling(index.row(), 0).data()
.toString().toStdString();
result_details result;
string text = "";
@ -207,7 +209,8 @@ const void DialogAdd::set_data(const Dialogdata &data)
text_reason->setText(QString::fromStdString(data.reason));
for (const string &receipt : data.receipts)
{
QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(receipt));
QListWidgetItem *item =
new QListWidgetItem(QString::fromStdString(receipt));
item->setFlags(item->flags() | Qt::ItemIsEditable);
list_receipts->insertItem(list_receipts->count(), item);
}

View File

@ -40,7 +40,8 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
public:
explicit MainWindow(QMainWindow *parent = nullptr);
void add_row(const QString &user, const int &blocked, const QString &reason);
void add_row(const QString &user, const int &blocked,
const QString &reason);
public slots:
void remove();

View File

@ -48,7 +48,8 @@ const bool Text::askblocked()
{
while (true)
{
const string blocked = get_answer(tr("Blocked or silenced?") + " [b/s]");
const string blocked = get_answer(tr("Blocked or silenced?") +
" [b/s]");
if (blocked[0] == 'b' || blocked[0] == 'B')
{
return true;

View File

@ -142,10 +142,12 @@ const bool database::details(const string &user, result_details &result)
try
{
sqlite::connection con(get_filepath());
sqlite::query q_blocks(con, "SELECT * FROM blocks WHERE user = \'" + user + "\';");
sqlite::query q_blocks(con,
"SELECT * FROM blocks WHERE user = \'" + user + "\';");
sqlite::result_type res_blocks = q_blocks.get_result();
sqlite::query q_urls(con, "SELECT * FROM urls WHERE user = \'" + user + "\';");
sqlite::query q_urls(con,
"SELECT * FROM urls WHERE user = \'" + user + "\';");
sqlite::result_type res_urls = q_urls.get_result();
if (!res_blocks->next_row())