7
7
#include < QShortcut>
8
8
#include < QMessageBox>
9
9
10
+ #ifdef __APPLE__
11
+ #define FIXED_FONT " Menlo"
12
+ #else
13
+ #define FIXED_FONT " Monospace"
14
+ #endif
15
+
10
16
MainWindow::MainWindow (const QString &fileName, QWidget *parent)
11
17
: QMainWindow(parent),
12
18
ui(new Ui::MainWindow),
13
- qldd(NULL ),
14
- shortcutClose(NULL ),
15
- fileMenu(NULL ),
16
- helpMenu(NULL ),
17
- openAct(NULL ),
18
- aboutAct(NULL ),
19
- aboutQtAct(NULL ),
20
- exitAct(NULL ) {
19
+ qldd(nullptr ),
20
+ shortcutClose(nullptr ),
21
+ fileMenu(nullptr ),
22
+ helpMenu(nullptr ),
23
+ openAct(nullptr ),
24
+ aboutAct(nullptr ),
25
+ aboutQtAct(nullptr ),
26
+ exitAct(nullptr ) {
21
27
ui->setupUi (this );
22
28
29
+ QFont fixedFont (FIXED_FONT);
30
+ fixedFont.setPixelSize (ui->lineEditFileName ->font ().pixelSize ());
31
+ fixedFont.setStyleHint (QFont::Monospace);
32
+
33
+ ui->listWidgetExportTable ->setFont (fixedFont);
34
+ ui->treeWidget ->setFont (fixedFont);
35
+
23
36
shortcutClose = new QShortcut (QKeySequence (Qt::Key_Escape), this );
24
37
connect (shortcutClose, SIGNAL (activated ()), this , SLOT (close ()));
25
38
@@ -33,90 +46,27 @@ MainWindow::MainWindow(const QString &fileName, QWidget *parent)
33
46
34
47
MainWindow::~MainWindow () {
35
48
delete ui;
36
- if (qldd) {
37
- delete qldd;
38
- }
39
49
delete fileMenu;
40
50
delete helpMenu;
41
- delete openAct;
42
- delete aboutAct;
43
- delete aboutQtAct;
44
- delete exitAct;
45
51
}
46
52
47
53
void MainWindow::reset (const QString &fileName) {
48
- if (qldd) {
49
- delete qldd;
50
- qldd = NULL ;
51
- }
52
- qldd = new QLdd (fileName, qApp->applicationDirPath ());
54
+ qldd.reset (new QLdd (fileName, qApp->applicationDirPath ()));
53
55
QTreeWidgetItem *header = ui->treeWidget ->headerItem ();
54
56
header->setText (0 , " Dependency" );
55
57
qldd->fillDependency (*ui->treeWidget );
56
58
qldd->fillExportTable (*ui->listWidgetExportTable );
57
- #ifdef __APPLE__
58
- QFont sansFont (" Helvetica [Cronyx]" , 12 );
59
- QFont monoFont (" Menlo" , 12 );
60
- ui->treeWidget ->setFont (sansFont);
61
- ui->listWidgetExportTable ->setFont (monoFont);
62
- #endif
63
59
64
- ui->labelName ->setText (" File Name " );
65
- #ifdef __APPLE__
66
- ui->labelName ->setFont (sansFont);
67
- #endif
68
60
ui->lineEditFileName ->setText (qldd->getBinaryName ());
69
- #ifdef __APPLE__
70
- ui->lineEditFileName ->setFont (sansFont);
71
- #endif
72
- ui->labelSize ->setText (" File Size " );
73
- #ifdef __APPLE__
74
- ui->labelSize ->setFont (sansFont);
75
- #endif
76
61
ui->lineEditFileSize ->setText (qldd->getStringFileSize () + " ( " + QString::number (qldd->getFileSize ()) + " bytes )" );
77
- #ifdef __APPLE__
78
- ui->lineEditFileSize ->setFont (sansFont);
79
- #endif
80
- ui->labelTimeAccess ->setText (" Access Time " );
81
- #ifdef __APPLE__
82
- ui->labelTimeAccess ->setFont (sansFont);
83
- #endif
84
62
ui->lineEditTimeAccess ->setText (qldd->getAccessTime ());
85
- #ifdef __APPLE__
86
- ui->lineEditTimeAccess ->setFont (sansFont);
87
- #endif
88
- ui->labelTimeStatus ->setText (" Status Time " );
89
- #ifdef __APPLE__
90
- ui->labelTimeStatus ->setFont (sansFont);
91
- #endif
92
63
ui->lineEditTimeStatus ->setText (qldd->getStatusTime ());
93
- #ifdef __APPLE__
94
- ui->lineEditTimeStatus ->setFont (sansFont);
95
- #endif
96
- ui->labelTimeModify ->setText (" Modify Time " );
97
- #ifdef __APPLE__
98
- ui->labelTimeModify ->setFont (sansFont);
99
- #endif
100
64
ui->lineEditTimeModify ->setText (qldd->getModifyTime ());
101
- #ifdef __APPLE__
102
- ui->lineEditTimeModify ->setFont (sansFont);
103
- #endif
104
65
105
66
ui->lineEditOwner ->setText (qldd->getOwnerName ());
106
- #ifdef __APPLE__
107
- ui->labelOwner ->setFont (sansFont);
108
- ui->lineEditOwner ->setFont (sansFont);
109
- #endif
110
67
ui->lineEditGroup ->setText (qldd->getGroupName ());
111
- #ifdef __APPLE__
112
- ui->labelGroup ->setFont (sansFont);
113
- ui->lineEditGroup ->setFont (sansFont);
114
- #endif
115
68
116
69
ui->textEditInformation ->setText (qldd->getInfo ());
117
- #ifdef __APPLE__
118
- ui->textEditInformation ->setFont (sansFont);
119
- #endif
120
70
121
71
QMOD owner = qldd->getOwnerMod ();
122
72
QMOD group = qldd->getGroupMod ();
@@ -145,11 +95,7 @@ void MainWindow::open() {
145
95
void MainWindow::about () {
146
96
QMessageBox::about (this ,
147
97
tr (" About Application" ),
148
- #ifdef __APPLE__
149
- tr (" UnixDependency shows all dependent libraries of a "
150
- #else
151
- tr (" LinuxDependency shows all dependent libraries of a "
152
- #endif
98
+ tr (" DependencyViewer shows all dependent libraries of a "
153
99
" given executable or dynamic library on Linux. It is a GUI replacement for the ldd, file and nm command." ));
154
100
}
155
101
@@ -183,3 +129,21 @@ void MainWindow::createMenus() {
183
129
helpMenu->addAction (aboutAct);
184
130
helpMenu->addAction (aboutQtAct);
185
131
}
132
+
133
+ void MainWindow::on_checkBoxOwnerRead_clicked (bool checked) { ui->checkBoxOwnerRead ->setChecked (!checked); }
134
+
135
+ void MainWindow::on_checkBoxOwnerWrite_clicked (bool checked) { ui->checkBoxOwnerWrite ->setChecked (!checked); }
136
+
137
+ void MainWindow::on_checkBoxOwnerExec_clicked (bool checked) { ui->checkBoxOwnerExec ->setChecked (!checked); }
138
+
139
+ void MainWindow::on_checkBoxGroupRead_clicked (bool checked) { ui->checkBoxGroupRead ->setChecked (!checked); }
140
+
141
+ void MainWindow::on_checkBoxGroupWrite_clicked (bool checked) { ui->checkBoxGroupWrite ->setChecked (!checked); }
142
+
143
+ void MainWindow::on_checkBoxGroupExec_clicked (bool checked) { ui->checkBoxGroupExec ->setChecked (!checked); }
144
+
145
+ void MainWindow::on_checkBoxOtherRead_clicked (bool checked) { ui->checkBoxOtherRead ->setChecked (!checked); }
146
+
147
+ void MainWindow::on_checkBoxOtherWrite_clicked (bool checked) { ui->checkBoxOtherWrite ->setChecked (!checked); }
148
+
149
+ void MainWindow::on_checkBoxOtherExec_clicked (bool checked) { ui->checkBoxOtherExec ->setChecked (!checked); }
0 commit comments