Skip to content

Commit

Permalink
improve macos bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
bas524 committed Aug 29, 2023
1 parent 06da61f commit a9ea943
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ if(APPLE)
COMMAND plutil -replace NSHighResolutionCapable -bool true Qldd.app/Contents/Info.plist
)
endif()
add_custom_command(TARGET krb5-ticket-watcher
POST_BUILD
COMMAND macdeployqt Qldd.app
)
else()

# Components:
Expand Down
25 changes: 15 additions & 10 deletions demanglerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
#include <QList>
#include <QDebug>

template <typename T>
static T enum_cast(demanglerules::Fields field) {
return static_cast<T>(field);
};

demanglerules::demanglerules(QWidget *parent) : QDialog(parent), ui(new Ui::demanglerules) {
ui->setupUi(this);
auto *m = dynamic_cast<MainWindow *>(parent);
ui->tableWidget->setColumnCount((int)Fields::COUNT);
ui->tableWidget->setColumnCount(enum_cast<int>(Fields::COUNT));
const auto &rulesRef = m->demangleRules();
QStringList tableHeader;
tableHeader << "#"
Expand Down Expand Up @@ -45,23 +50,23 @@ void demanglerules::insertNewRow(int row, const QString &src, const QString &dst

checkBox->setProperty("row", row);
connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(selectRow(bool)));
ui->tableWidget->setCellWidget(row, (int)Fields::Selection, checkBoxWidget);
ui->tableWidget->setCellWidget(row, enum_cast<int>(Fields::Selection), checkBoxWidget);

auto *itemSrc = new QTableWidgetItem(src);
itemSrc->setToolTip(src);
itemSrc->setFont(m->getFixedFont());
ui->tableWidget->setItem(row, (int)Fields::Source, itemSrc);
ui->tableWidget->setItem(row, enum_cast<int>(Fields::Source), itemSrc);
auto *itemDst = new QTableWidgetItem(dst);
itemDst->setToolTip(dst);
itemDst->setFont(m->getFixedFont());
ui->tableWidget->setItem(row, (int)Fields::Destination, itemDst);
ui->tableWidget->setItem(row, enum_cast<int>(Fields::Destination), itemDst);
}

void demanglerules::selectRow(bool flag) {
int row = sender()->property("row").toInt();
QModelIndex index0 = ui->tableWidget->model()->index(row, (int)Fields::Selection);
QModelIndex index1 = ui->tableWidget->model()->index(row, (int)Fields::Source);
QModelIndex index2 = ui->tableWidget->model()->index(row, (int)Fields::Destination);
QModelIndex index0 = ui->tableWidget->model()->index(row, enum_cast<int>(Fields::Selection));
QModelIndex index1 = ui->tableWidget->model()->index(row, enum_cast<int>(Fields::Source));
QModelIndex index2 = ui->tableWidget->model()->index(row, enum_cast<int>(Fields::Destination));
if (flag == true) {
ui->tableWidget->selectionModel()->select(index0, QItemSelectionModel::Select);
ui->tableWidget->selectionModel()->select(index1, QItemSelectionModel::Select);
Expand All @@ -76,7 +81,7 @@ void demanglerules::selectRow(bool flag) {
void demanglerules::on_pBAddRule_clicked() {
auto row = ui->tableWidget->rowCount();
insertNewRow(row, "", "");
ui->tableWidget->setCurrentCell(row, (int)Fields::Source);
ui->tableWidget->setCurrentCell(row, enum_cast<int>(Fields::Source));
ui->tableWidget->editItem(ui->tableWidget->currentItem());
}

Expand All @@ -93,8 +98,8 @@ void demanglerules::on_buttonBox_accepted() {
auto *m = dynamic_cast<MainWindow *>(parent());
RulesMap rules;
for (int i = 0; i < ui->tableWidget->rowCount(); ++i) {
auto *itemSrc = ui->tableWidget->item(i, (int)Fields::Source);
auto *itemDst = ui->tableWidget->item(i, (int)Fields::Destination);
auto *itemSrc = ui->tableWidget->item(i, enum_cast<int>(Fields::Source));
auto *itemDst = ui->tableWidget->item(i, enum_cast<int>(Fields::Destination));
rules.push_back({itemSrc->text(), itemDst->text()});
qDebug() << itemSrc->text() << "->" << itemDst->text();
}
Expand Down

0 comments on commit a9ea943

Please sign in to comment.