Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmTakeaway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shangshang.dai
FmTakeaway
Commits
09dfb92a
Commit
09dfb92a
authored
Aug 04, 2016
by
ss.dai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成数据库连接界面和功能
parent
51b0d191
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
525 additions
and
90 deletions
+525
-90
.gitignore
+3
-2
fmPlugin/fmPlugin.cpp
+38
-0
fmPlugin/fmPlugin.h
+49
-2
fmPlugin/fmPlugin.pro
+2
-0
fmTakeaway/DTools/configManger.cpp
+42
-0
fmTakeaway/DTools/configManger.h
+42
-0
fmTakeaway/dbsetForm.cpp
+97
-3
fmTakeaway/dbsetForm.h
+24
-5
fmTakeaway/dbsetForm.ui
+165
-74
fmTakeaway/fmTakeaway.pro
+6
-2
fmTakeaway/main.cpp
+11
-0
fmTakeaway/mainForm.cpp
+31
-0
fmTakeaway/mainForm.h
+3
-0
fmTakeaway/mainForm.ui
+0
-0
fmTakeaway/preDefine.h
+12
-2
No files found.
.gitignore
View file @
09dfb92a
*.user
*.user
\ No newline at end of file
*.autosave
\ No newline at end of file
fmPlugin/fmPlugin.cpp
View file @
09dfb92a
#include "fmPlugin.h"
#include "fmPlugin.h"
#include <QtSql/QSqlError>
FmPlugin
&
FmPlugin
::
GetInstance
()
{
static
FmPlugin
fmPlugin
;
return
fmPlugin
;
}
void
FmPlugin
::
ConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
dbname
)
{
emit
doConnectDb
(
host
,
username
,
password
,
dbname
);
}
FmPlugin
::
FmPlugin
()
FmPlugin
::
FmPlugin
()
{
{
m_thread
=
new
QThread
;
m_worker
=
new
PluginWorker
;
m_worker
->
moveToThread
(
m_thread
);
m_thread
->
start
();
connect
(
this
,
&
FmPlugin
::
doConnectDb
,
m_worker
,
&
PluginWorker
::
onDoConnectDb
);
connect
(
m_worker
,
&
PluginWorker
::
connectDbFinsh
,
this
,
&
FmPlugin
::
connectDbFinsh
);
}
void
PluginWorker
::
onDoConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
dbname
)
{
// 清除之前的连接
QSqlDatabase
::
removeDatabase
(
m_db
.
connectionName
());
m_db
=
QSqlDatabase
::
addDatabase
(
"QODBC"
);
m_db
.
setConnectOptions
(
QString
(
"SQL_ATTR_LOGIN_TIMEOUT=5;SQL_ATTR_CONNECTION_TIMEOUT=5"
));
m_db
.
setDatabaseName
(
QString
(
"Driver={sql server}; server=%1; database=%2; uid=%3; pwd=%4"
)
.
arg
(
host
).
arg
(
dbname
).
arg
(
username
).
arg
(
password
));
if
(
m_db
.
open
())
{
emit
connectDbFinsh
(
true
);
}
else
{
emit
connectDbFinsh
(
false
,
m_db
.
lastError
().
text
());
}
}
}
fmPlugin/fmPlugin.h
View file @
09dfb92a
...
@@ -2,12 +2,59 @@
...
@@ -2,12 +2,59 @@
#define FMPLUGIN_H
#define FMPLUGIN_H
#include "fmplugin_global.h"
#include "fmplugin_global.h"
#include <QThread>
#include <QtSql/QSqlDatabase>
class
FMPLUGINSHARED_EXPORT
FmPlugin
class
PluginWorker
;
{
class
FMPLUGINSHARED_EXPORT
FmPlugin
:
public
QObject
{
Q_OBJECT
public
:
public
:
static
FmPlugin
&
GetInstance
();
/* 功能:连接数据库
* 参数:NULL
* 返回:NULL
* */
void
ConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
dbname
);
private
:
FmPlugin
();
FmPlugin
();
FmPlugin
(
FmPlugin
const
&
);
FmPlugin
&
operator
=
(
FmPlugin
const
&
);
private
:
QThread
*
m_thread
;
PluginWorker
*
m_worker
;
// 发送到工作线程
signals:
void
doConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
database
);
// 发送到UI线程
signals:
void
connectDbFinsh
(
bool
bSuccess
,
const
QString
&
error
=
""
);
};
class
PluginWorker
:
public
QObject
{
Q_OBJECT
public
:
PluginWorker
(){}
private
:
QSqlDatabase
m_db
;
public
slots
:
void
onDoConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
dbname
);
signals
:
void
connectDbFinsh
(
bool
bSuccess
,
const
QString
&
error
=
""
);
};
};
#endif // FMPLUGIN_H
#endif // FMPLUGIN_H
fmPlugin/fmPlugin.pro
View file @
09dfb92a
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
QT
-=
gui
QT
-=
gui
QT
+=
sql
TARGET
=
fmPlugin
TARGET
=
fmPlugin
TEMPLATE
=
lib
TEMPLATE
=
lib
...
...
fmTakeaway/DTools/configManger.cpp
0 → 100644
View file @
09dfb92a
#include "configManger.h"
#include <QApplication>
#include "preDefine.h"
ConfigManger
&
ConfigManger
::
GetInstance
()
{
static
ConfigManger
cm
;
return
cm
;
}
ConfigManger
::
ConfigManger
()
{
QString
appDir
=
QApplication
::
applicationDirPath
();
QString
config
=
QString
(
"%1/%2"
).
arg
(
appDir
).
arg
(
CONFIG_NAME
);
QString
userConfig
=
QString
(
"%1/%2"
).
arg
(
appDir
).
arg
(
USERCONFIG_NAME
);
m_config
=
new
QSettings
(
config
,
QSettings
::
IniFormat
);
m_userConfig
=
new
QSettings
(
userConfig
,
QSettings
::
IniFormat
);
}
ConfigManger
::
SqlConnectInfo
ConfigManger
::
GetSqlConnectInfo
()
{
SqlConnectInfo
info
;
info
.
host
=
m_userConfig
->
value
(
INI_HOST
).
toString
();
info
.
username
=
m_userConfig
->
value
(
INI_USERNAME
).
toString
();
info
.
password
=
m_userConfig
->
value
(
INI_PASSWORD
).
toString
();
info
.
database
=
m_userConfig
->
value
(
INI_DATABASE
).
toString
();
return
info
;
}
void
ConfigManger
::
SetSqlConnectInfo
(
const
ConfigManger
::
SqlConnectInfo
&
info
)
{
m_userConfig
->
setValue
(
INI_HOST
,
info
.
host
);
m_userConfig
->
setValue
(
INI_USERNAME
,
info
.
username
);
m_userConfig
->
setValue
(
INI_PASSWORD
,
info
.
password
);
m_userConfig
->
setValue
(
INI_DATABASE
,
info
.
database
);
return
;
}
fmTakeaway/DTools/configManger.h
0 → 100644
View file @
09dfb92a
#ifndef CONFIGMANGER_H
#define CONFIGMANGER_H
#include <QSettings>
class
ConfigManger
{
public
:
// 数据库连接信息
typedef
struct
{
QString
host
;
QString
username
;
QString
password
;
QString
database
;
}
SqlConnectInfo
;
public
:
static
ConfigManger
&
GetInstance
();
/* 功能:获取数据库连接信息
* 参数:NULL
* 返回:连接信息
* */
SqlConnectInfo
GetSqlConnectInfo
();
/* 功能:设置数据库连接信息
* 参数:连接信息
* 返回:NULL
* */
void
SetSqlConnectInfo
(
const
SqlConnectInfo
&
);
private
:
ConfigManger
();
ConfigManger
(
ConfigManger
const
&
);
ConfigManger
&
operator
=
(
ConfigManger
const
&
);
private
:
QSettings
*
m_config
;
QSettings
*
m_userConfig
;
};
#endif // CONFIGMANGER_H
fmTakeaway/dbsetForm.cpp
View file @
09dfb92a
#include "dbsetForm.h"
#include "dbsetForm.h"
#include "ui_dbsetForm.h"
#include "ui_dbsetForm.h"
#include "QsLog.h"
#include "DTools/configManger.h"
#include "../fmPlugin/fmPlugin.h"
dbsetForm
::
d
bsetForm
(
QWidget
*
parent
)
:
DbsetForm
::
D
bsetForm
(
QWidget
*
parent
)
:
QDialog
(
parent
),
QDialog
(
parent
),
ui
(
new
Ui
::
d
bsetForm
)
ui
(
new
Ui
::
D
bsetForm
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
_Init
();
connect
(
&
FmPlugin
::
GetInstance
(),
&
FmPlugin
::
connectDbFinsh
,
this
,
&
DbsetForm
::
onConnectDbFinsh
);
on_dbsetBtnOk_clicked
();
}
}
dbsetForm
::~
d
bsetForm
()
DbsetForm
::~
D
bsetForm
()
{
{
delete
ui
;
delete
ui
;
}
}
void
DbsetForm
::
_Init
()
{
this
->
setWindowFlags
(
this
->
windowFlags
()
|
Qt
::
FramelessWindowHint
);
ConfigManger
::
SqlConnectInfo
info
;
info
=
ConfigManger
::
GetInstance
().
GetSqlConnectInfo
();
ui
->
dbsetLab0
->
setText
(
tr
(
"数据库IP:"
));
ui
->
dbsetEdt0
->
setText
(
info
.
host
);
ui
->
dbsetLab1
->
setText
(
tr
(
"用户名:"
));
ui
->
dbsetEdt1
->
setText
(
info
.
username
);
ui
->
dbsetLab2
->
setText
(
tr
(
"密码:"
));
ui
->
dbsetEdt2
->
setText
(
info
.
password
);
ui
->
dbsetLab3
->
setText
(
tr
(
"数据库名:"
));
ui
->
dbsetEdt3
->
setText
(
info
.
database
);
ui
->
dbsetLabError
->
setText
(
tr
(
"请输入正确信息!"
));
ui
->
dbsetBtnOk
->
setText
(
tr
(
"连接"
));
ui
->
dbsetBtnCancle
->
setText
(
tr
(
"退出"
));
ui
->
dbsetLabError
->
hide
();
ui
->
dbsetPgb0
->
hide
();
}
void
DbsetForm
::
_SetSubElementEnable
(
bool
bEnable
)
{
ui
->
dbsetEdt0
->
setEnabled
(
bEnable
);
ui
->
dbsetEdt1
->
setEnabled
(
bEnable
);
ui
->
dbsetEdt2
->
setEnabled
(
bEnable
);
ui
->
dbsetEdt3
->
setEnabled
(
bEnable
);
ui
->
dbsetBtnOk
->
setEnabled
(
bEnable
);
ui
->
dbsetBtnCancle
->
setEnabled
(
bEnable
);
}
void
DbsetForm
::
onConnectDbFinsh
(
bool
bSuccess
,
const
QString
&
error
)
{
QLOG_INFO
()
<<
QString
(
"Connect to database. result[%1] msg[%2]"
).
arg
(
bSuccess
).
arg
(
error
);
if
(
bSuccess
)
{
ConfigManger
::
SqlConnectInfo
info
;
info
.
host
=
ui
->
dbsetEdt0
->
text
();
info
.
username
=
ui
->
dbsetEdt1
->
text
();
info
.
password
=
ui
->
dbsetEdt2
->
text
();
info
.
database
=
ui
->
dbsetEdt3
->
text
();
ConfigManger
::
GetInstance
().
SetSqlConnectInfo
(
info
);
this
->
accept
();
}
ui
->
dbsetPgb0
->
hide
();
ui
->
dbsetLabError
->
setText
(
tr
(
"连接数据库失败!"
));
ui
->
dbsetLabError
->
show
();
_SetSubElementEnable
(
true
);
}
void
DbsetForm
::
on_dbsetBtnOk_clicked
()
{
QLOG_TRACE
()
<<
__FUNCTION__
;
ui
->
dbsetLabError
->
hide
();
if
(
ui
->
dbsetEdt0
->
text
().
isEmpty
()
||
ui
->
dbsetEdt1
->
text
().
isEmpty
()
||
ui
->
dbsetEdt3
->
text
().
isEmpty
())
{
ui
->
dbsetLabError
->
setText
(
tr
(
"请输入正确信息!"
));
ui
->
dbsetLabError
->
show
();
return
;
}
ui
->
dbsetPgb0
->
show
();
_SetSubElementEnable
(
false
);
QString
host
,
username
,
password
,
dbname
;
host
=
ui
->
dbsetEdt0
->
text
();
username
=
ui
->
dbsetEdt1
->
text
();
password
=
ui
->
dbsetEdt2
->
text
();
dbname
=
ui
->
dbsetEdt3
->
text
();
QLOG_INFO
()
<<
QString
(
"Connect to database.[host:%1 username:%2 password:%3 dbname:%4]"
)
.
arg
(
host
).
arg
(
username
).
arg
(
password
).
arg
(
dbname
);
FmPlugin
::
GetInstance
().
ConnectDb
(
host
,
username
,
password
,
dbname
);
}
void
DbsetForm
::
on_dbsetBtnCancle_clicked
()
{
QLOG_TRACE
()
<<
__FUNCTION__
;
this
->
reject
();
}
fmTakeaway/dbsetForm.h
View file @
09dfb92a
...
@@ -4,19 +4,38 @@
...
@@ -4,19 +4,38 @@
#include <QDialog>
#include <QDialog>
namespace
Ui
{
namespace
Ui
{
class
d
bsetForm
;
class
D
bsetForm
;
}
}
class
d
bsetForm
:
public
QDialog
class
D
bsetForm
:
public
QDialog
{
{
Q_OBJECT
Q_OBJECT
public
:
public
:
explicit
d
bsetForm
(
QWidget
*
parent
=
0
);
explicit
D
bsetForm
(
QWidget
*
parent
=
0
);
~
d
bsetForm
();
~
D
bsetForm
();
private
:
private
:
Ui
::
dbsetForm
*
ui
;
Ui
::
DbsetForm
*
ui
;
/* 功能:初始化界面
* 参数:NULL
* 返回:NULL
* */
void
_Init
();
/* 功能:设置子控件启用状态
* 参数:[bEnable]是否启用
* 返回:NULL
* */
void
_SetSubElementEnable
(
bool
bEnable
);
public
slots
:
void
onConnectDbFinsh
(
bool
bSuccess
,
const
QString
&
error
);
private
slots
:
void
on_dbsetBtnOk_clicked
();
void
on_dbsetBtnCancle_clicked
();
};
};
#endif // DBSETFORM_H
#endif // DBSETFORM_H
fmTakeaway/dbsetForm.ui
View file @
09dfb92a
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<ui
version=
"4.0"
>
<class>
d
bsetForm
</class>
<class>
D
bsetForm
</class>
<widget
class=
"QDialog"
name=
"
d
bsetForm"
>
<widget
class=
"QDialog"
name=
"
D
bsetForm"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
301
</width>
<width>
275
</width>
<height>
3
94
</height>
<height>
3
23
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
<string>
Dialog
</string>
</property>
</property>
<widget
class=
"QLabel"
name=
"dbsetLab0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"geometry"
>
<property
name=
"leftMargin"
>
<rect>
<number>
0
</number>
<x>
30
</x>
<y>
40
</y>
<width>
54
</width>
<height>
12
</height>
</rect>
</property>
</property>
<property
name=
"t
ext
"
>
<property
name=
"t
opMargin
"
>
<
string>
地址:
</string
>
<
number>
0
</number
>
</property>
</property>
</widget>
<property
name=
"rightMargin"
>
<widget
class=
"QLabel"
name=
"dbsetLab1"
>
<number>
0
</number>
<property
name=
"geometry"
>
<rect>
<x>
30
</x>
<y>
90
</y>
<width>
54
</width>
<height>
12
</height>
</rect>
</property>
</property>
<property
name=
"
text
"
>
<property
name=
"
bottomMargin
"
>
<
string>
用户名:
</string
>
<
number>
0
</number
>
</property>
</property>
</widget>
<property
name=
"spacing"
>
<widget
class=
"QLabel"
name=
"dbsetLab2"
>
<number>
0
</number>
<property
name=
"geometry"
>
<rect>
<x>
30
</x>
<y>
140
</y>
<width>
54
</width>
<height>
12
</height>
</rect>
</property>
</property>
<property
name=
"text"
>
<item
row=
"0"
column=
"0"
>
<string>
密码:
</string>
<widget
class=
"QWidget"
name=
"dbsetWdg"
native=
"true"
>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
</widget>
<item>
<widget
class=
"QLabel"
name=
"dbsetLab3"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"0,1"
>
<property
name=
"geometry"
>
<item>
<rect>
<widget
class=
"QLabel"
name=
"dbsetLab0"
>
<x>
30
</x>
<property
name=
"text"
>
<y>
180
</y>
<string/>
<width>
54
</width>
</property>
<height>
12
</height>
<property
name=
"alignment"
>
</rect>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</property>
<property
name=
"text"
>
</widget>
<string>
库名:
</string>
</item>
</property>
<item>
</widget>
<widget
class=
"QLineEdit"
name=
"dbsetEdt0"
/>
<widget
class=
"QLabel"
name=
"dbsetLabError"
>
</item>
<property
name=
"geometry"
>
</layout>
<rect>
</item>
<x>
30
</x>
<item>
<y>
230
</y>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
stretch=
"0,1"
>
<width>
161
</width>
<item>
<height>
51
</height>
<widget
class=
"QLabel"
name=
"dbsetLab1"
>
</rect>
<property
name=
"text"
>
</property>
<string/>
<property
name=
"text"
>
</property>
<string/>
<property
name=
"alignment"
>
</property>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</widget>
</property>
<widget
class=
"QWidget"
name=
"widget"
native=
"true"
>
</widget>
<property
name=
"geometry"
>
</item>
<rect>
<item>
<x>
120
</x>
<widget
class=
"QLineEdit"
name=
"dbsetEdt1"
/>
<y>
70
</y>
</item>
<width>
120
</width>
</layout>
<height>
80
</height>
</item>
</rect>
<item>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
</widget>
<item>
<widget
class=
"QLabel"
name=
"dbsetLab2"
>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"dbsetEdt2"
/>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
<item>
<widget
class=
"QLabel"
name=
"dbsetLab3"
>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"dbsetEdt3"
/>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_6"
>
<item>
<widget
class=
"QLabel"
name=
"dbsetLabError"
>
<property
name=
"focusPolicy"
>
<enum>
Qt::WheelFocus
</enum>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
<property
name=
"wordWrap"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QProgressBar"
name=
"dbsetPgb0"
>
<property
name=
"maximum"
>
<number>
0
</number>
</property>
<property
name=
"value"
>
<number>
0
</number>
</property>
<property
name=
"textVisible"
>
<bool>
false
</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_5"
>
<item>
<widget
class=
"QPushButton"
name=
"dbsetBtnOk"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Minimum"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"dbsetBtnCancle"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Minimum"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"focusPolicy"
>
<enum>
Qt::NoFocus
</enum>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<resources/>
<connections/>
<connections/>
...
...
fmTakeaway/fmTakeaway.pro
View file @
09dfb92a
...
@@ -16,16 +16,20 @@ TEMPLATE = app
...
@@ -16,16 +16,20 @@ TEMPLATE = app
SOURCES
+=
main
.
cpp
\
SOURCES
+=
main
.
cpp
\
mainForm
.
cpp
\
mainForm
.
cpp
\
alertForm
.
cpp
\
alertForm
.
cpp
\
dbsetForm
.
cpp
dbsetForm
.
cpp
\
DTools
/
configManger
.
cpp
HEADERS
+=
\
HEADERS
+=
\
mainForm
.
h
\
mainForm
.
h
\
preDefine
.
h
\
preDefine
.
h
\
alertForm
.
h
\
alertForm
.
h
\
dbsetForm
.
h
dbsetForm
.
h
\
DTools
/
configManger
.
h
FORMS
+=
mainForm
.
ui
\
FORMS
+=
mainForm
.
ui
\
alertForm
.
ui
\
alertForm
.
ui
\
dbsetForm
.
ui
dbsetForm
.
ui
RC_FILE
+=
fmTakeaway
.
rc
RC_FILE
+=
fmTakeaway
.
rc
LIBS
+=
-
L
..
/
fmPlugin
/
debug
-
lfmPlugin
fmTakeaway/main.cpp
View file @
09dfb92a
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include <QResource>
#include <QResource>
#include "QsLog.h"
#include "QsLog.h"
#include "preDefine.h"
#include "preDefine.h"
#include "dbsetForm.h"
using
namespace
QsLogging
;
using
namespace
QsLogging
;
...
@@ -45,12 +46,22 @@ int main(int argc, char *argv[])
...
@@ -45,12 +46,22 @@ int main(int argc, char *argv[])
{
{
QApplication
a
(
argc
,
argv
);
QApplication
a
(
argc
,
argv
);
g_appDir
=
a
.
applicationDirPath
();
g_appDir
=
a
.
applicationDirPath
();
// 初始化日志
// 初始化日志
InitLogger
();
InitLogger
();
// 加载主题
// 加载主题
LoadTheme
(
APP_THEME
);
LoadTheme
(
APP_THEME
);
QLOG_INFO
()
<<
QString
(
"-------- fmTakeaway[%1] Start --------"
).
arg
(
APP_VERSION
);
QLOG_INFO
()
<<
QString
(
"-------- fmTakeaway[%1] Start --------"
).
arg
(
APP_VERSION
);
DbsetForm
d
;
if
(
QDialog
::
Rejected
==
d
.
exec
())
{
QLOG_INFO
()
<<
QString
(
"-------- fmTakeaway exit --------"
);
return
-
1
;
}
MainForm
w
;
MainForm
w
;
w
.
show
();
w
.
show
();
...
...
fmTakeaway/mainForm.cpp
View file @
09dfb92a
#include "mainForm.h"
#include "mainForm.h"
#include "ui_mainForm.h"
#include "ui_mainForm.h"
#include "preDefine.h"
MainForm
::
MainForm
(
QWidget
*
parent
)
:
MainForm
::
MainForm
(
QWidget
*
parent
)
:
QDialog
(
parent
),
QDialog
(
parent
),
ui
(
new
Ui
::
MainForm
)
ui
(
new
Ui
::
MainForm
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
_Init
();
}
}
MainForm
::~
MainForm
()
MainForm
::~
MainForm
()
{
{
delete
ui
;
delete
ui
;
}
}
void
MainForm
::
_Init
()
{
this
->
setWindowFlags
(
this
->
windowFlags
()
|
Qt
::
FramelessWindowHint
);
ui
->
mainBtnNew
->
setText
(
tr
(
"新订单"
));
ui
->
mainBtnNew
->
setProperty
(
"table"
,
ui
->
mainTableNew
->
objectName
());
ui
->
mainBtnMake
->
setText
(
tr
(
"制作中"
));
ui
->
mainBtnMake
->
setProperty
(
"table"
,
ui
->
mainTableMake
->
objectName
());
ui
->
mainBtnSend
->
setText
(
tr
(
"配送中"
));
ui
->
mainBtnSend
->
setProperty
(
"table"
,
ui
->
mainTableSend
->
objectName
());
ui
->
mainBtnFinsh
->
setText
(
tr
(
"已完成"
));
ui
->
mainBtnFinsh
->
setProperty
(
"table"
,
ui
->
mainTableFinsh
->
objectName
());
ui
->
mainBtnRefund
->
setText
(
tr
(
"需退款"
));
ui
->
mainBtnRefund
->
setProperty
(
"table"
,
ui
->
mainTableRefund
->
objectName
());
ui
->
mainBtnOther
->
setText
(
tr
(
"其他"
));
ui
->
mainBtnOther
->
setProperty
(
"table"
,
ui
->
mainTableOther
->
objectName
());
ui
->
mainBtnHide
->
setText
(
tr
(
"隐藏"
));
ui
->
mainBtnSet
->
setText
(
tr
(
"设置"
));
ui
->
mainSlabStoreid
->
setText
(
tr
(
"门店号:"
));
ui
->
mainSlabStatus
->
setText
(
tr
(
"门店状态:"
));
ui
->
mainSlabVersion
->
setText
(
tr
(
"版本号:"
));
ui
->
mainLabVersion
->
setText
(
APP_VERSION
);
ui
->
mainSlabCashier
->
setText
(
tr
(
"收银员:"
));
ui
->
mainLabCashier
->
setText
(
UI_CASHIER
);
ui
->
mainBtnCashier
->
setText
(
tr
(
"选择收银员"
));
ui
->
mainEdtSerach
->
setPlaceholderText
(
tr
(
"输入订单号"
));
}
fmTakeaway/mainForm.h
View file @
09dfb92a
...
@@ -17,6 +17,9 @@ public:
...
@@ -17,6 +17,9 @@ public:
private
:
private
:
Ui
::
MainForm
*
ui
;
Ui
::
MainForm
*
ui
;
private
:
void
_Init
();
};
};
#endif // MAINFORM_H
#endif // MAINFORM_H
fmTakeaway/mainForm.ui
View file @
09dfb92a
This diff is collapsed.
Click to expand it.
fmTakeaway/preDefine.h
View file @
09dfb92a
#ifndef PREDEFINE_H
#ifndef PREDEFINE_H
#define PREDEFINE_H
#define PREDEFINE_H
#define APP_THEME "lxj"
#define APP_THEME "lxj"
#define APP_VERSION "1.160727.01"
#define APP_VERSION "1.160727.01"
#define CONFIG_NAME "config.ini"
#define USERCONFIG_NAME "userConfig.ini"
#define UI_CASHIER "未选择"
#define INI_HOST "SqlServer/host"
#define INI_USERNAME "SqlServer/username"
#define INI_PASSWORD "SqlServer/password"
#define INI_DATABASE "SqlServer/database"
#endif // PREDEFINE_H
#endif // PREDEFINE_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment