Skip to content

Commit 8e656f8

Browse files
committed
other(UI): add more icons
1 parent 43ffdde commit 8e656f8

20 files changed

+40
-29
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ set(HEADERS QBrowserApp.h
1313
QDbTableView.h
1414
QQueryHighlighter.h)
1515

16+
qt_add_resources(RESOURCES res/icons.qrc)
1617
if(WIN32)
17-
set(RESOURCES res/app_icon.rc)
18-
source_group("Resource files" FILES ${RESOURCES})
18+
source_group("Resource files" FILES res/app_icon.rc res/icons.qrc)
19+
qt_add_executable(qSQLbrowser MANUAL_FINALIZATION ${SOURCE_FILES} ${HEADERS} ${RESOURCES} res/app_icon.rc)
1920
else()
20-
qt_add_resources(RESOURCES res/app_icon.qrc)
21-
endif()
22-
23-
qt_add_executable(qSQLbrowser MANUAL_FINALIZATION ${SOURCE_FILES} ${HEADERS} ${RESOURCES})
21+
qt_add_executable(qSQLbrowser MANUAL_FINALIZATION ${SOURCE_FILES} ${HEADERS} ${RESOURCES})
22+
endif()

src/QBrowserApp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ QBrowserApp::QBrowserApp(QWidget* parent, Qt::WindowFlags flags) : QMainWindow(p
3131
vSplitter->setStretchFactor(1, 0);
3232

3333
QMenu* mainMenu = menuBar()->addMenu(QObject::tr("&General"));
34-
mainMenu->addAction(QObject::tr("Add &Connection..."), [&]() { QMetaObject::invokeMethod(findChild<QConnectionCtrl*>("connectionCtrl"), "showConnectionDialog", Qt::QueuedConnection); });
34+
mainMenu->addAction(QIcon(":/icons/dbConnect.png"), QObject::tr("Add &Connection..."), [&]() { QMetaObject::invokeMethod(findChild<QConnectionCtrl*>("connectionCtrl"), "showConnectionDialog", Qt::QueuedConnection); });
3535
mainMenu->addSeparator();
36-
mainMenu->addAction(QObject::tr("&Quit"), []() { qApp->quit(); });
36+
mainMenu->addAction(QIcon(":/icons/quit.png"), QObject::tr("&Quit"), []() { qApp->quit(); });
3737

3838
QMenu* helpMenu = menuBar()->addMenu(QObject::tr("&Help"));
39-
helpMenu->addAction(QObject::tr("About"), [&]() { about(); });
40-
helpMenu->addAction(QObject::tr("About Qt"), []() { qApp->aboutQt(); });
39+
helpMenu->addAction(QIcon(":/icons/app_icon.png"), QObject::tr("About"), [&]() { about(); });
40+
helpMenu->addAction(QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton), QObject::tr("About Qt"), []() { qApp->aboutQt(); });
4141

4242
QVBoxLayout* mainLayout = new QVBoxLayout;
4343
mainLayout->addWidget(vSplitter);

src/QConnectionCtrl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
QConnectionCtrl::QConnectionCtrl(QWidget* parent) {
77
QTreeWidgetItem* rootItem = new QTreeWidgetItem();
8-
rootItem->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_ComputerIcon));
8+
rootItem->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon));
99
rootItem->setText(0, tr("Databases"));
1010
setHeaderItem(rootItem);
1111

@@ -14,13 +14,13 @@ QConnectionCtrl::QConnectionCtrl(QWidget* parent) {
1414
setFrameStyle(QFrame::Panel | QFrame::Sunken);
1515
setLineWidth(2);
1616

17-
QAction* refreshAction = new QAction(tr("Refresh"), this);
18-
QAction* shemaAction = new QAction(tr("Show shema"), this);
17+
QAction* refreshAction = new QAction(QIcon(":/icons/refresh.png"), tr("Refresh"), this);
18+
QAction* shemaAction = new QAction(QIcon(":/icons/metadata.png"), tr("Show shema"), this);
1919
shemaAction->setEnabled(false);
2020
shemaAction->setObjectName("shemaAction");
2121
QAction* separator = new QAction;
2222
separator->setSeparator(true);
23-
QAction* addConnectionAction = new QAction(tr("Add Connection..."), this);
23+
QAction* addConnectionAction = new QAction(QIcon(":/icons/dbConnect.png"), tr("Add Connection..."), this);
2424

2525
connect(refreshAction, &QAction::triggered, this, [=]() { refresh(); });
2626
connect(shemaAction, &QAction::triggered, this, &QConnectionCtrl::showMetaData);
@@ -150,7 +150,7 @@ void QConnectionCtrl::refresh() {
150150
dbCaption.append(db.databaseName());
151151

152152
rootItem->setText(0, dbCaption);
153-
rootItem->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon));
153+
rootItem->setIcon(0, QIcon(":/icons/db.png"));
154154
if (connectionNames.at(i) == QSqlDatabase::database(m_activeDb).connectionName()) {
155155
gotActiveDb = true;
156156
setActiveDb(rootItem);
@@ -160,7 +160,7 @@ void QConnectionCtrl::refresh() {
160160
for (int t = 0; t < tableList.count(); ++t) {
161161
QTreeWidgetItem* table = new QTreeWidgetItem(rootItem);
162162
table->setText(0, tableList.at(t));
163-
table->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
163+
table->setIcon(0, QIcon(":/icons/table.png"));
164164
}
165165
}
166166
}

src/QConnectionDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ QConnectionDialog::QConnectionDialog(QWidget* parent, Qt::WindowFlags f) {
5959
setLayout(dialogLayout);
6060

6161
#ifdef Q_OS_WINDOWS
62-
setWindowIcon(QApplication::style()->standardIcon(QStyle::SP_CommandLink));
62+
setWindowIcon(QIcon(":/icons/dbConnect.png"));
6363
#endif
6464
}
6565

src/QDbTableView.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#include "QDbTableView.h"
55

66
QDbTableView::QDbTableView(QWidget* parent) {
7-
m_selectAction = new QAction(tr("Select"), this);
8-
m_insertRowAction = new QAction(tr("Insert Row"), this);
9-
m_deleteRowAction = new QAction(tr("Delete Row"), this);
7+
m_selectAction = new QAction(QIcon(":/icons/selection-tool.png"), tr("Select"), this);
8+
m_insertRowAction = new QAction(QIcon(":/icons/insert-row.png"), tr("Insert Row"), this);
9+
m_deleteRowAction = new QAction(QIcon(":/icons/delete-row.png"), tr("Delete Row"), this);
1010
m_fieldStrategyAction = new QAction(tr("Submit on Field Change"), this);
1111
m_rowStrategyAction = new QAction(tr("Submit on Row Change"), this);
1212
m_manualStrategyAction = new QAction(tr("Submit Manually"), this);
13-
m_submitAction = new QAction(tr("Submit All"), this);
14-
m_revertAction = new QAction(tr("Revert All"), this);
13+
m_submitAction = new QAction(QIcon(":/icons/submit-all.png"), tr("Submit All"), this);
14+
m_revertAction = new QAction(QIcon(":/icons/revert-all.png"), tr("Revert All"), this);
1515

1616
m_fieldStrategyAction->setCheckable(true);
1717
m_rowStrategyAction->setCheckable(true);

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
1818
}
1919

2020
#ifndef Q_OS_WINDOWS
21-
QApplication::setWindowIcon(QIcon(":/app_icon/app_icon.xpm"));
21+
QApplication::setWindowIcon(QIcon(":/icons/app_icon.xpm"));
2222
#endif
2323

2424
QBrowserApp browser;

src/res/app_icon.png

64.4 KB
Loading

src/res/app_icon.qrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/res/db.png

64.4 KB
Loading

src/res/dbConnect.png

64.4 KB
Loading

0 commit comments

Comments
 (0)