#include "main_server.h"
#include <iostream>
using namespace std;
main_server::main_server( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
setMinimumSize( QSize( 600, 480 ) );
setMaximumSize( QSize( 600, 480 ) );
setSizeIncrement( QSize( 600, 480 ) );
(void)statusBar();
i = 0;
createConnections();
// actions
Add_staff = new QAction( this, "Add_staff" );
Del_staff = new QAction( this, "Del_staff" );
Add_dish = new QAction( this, "Add_dish" );
Del_dish = new QAction( this, "Del_dish" );
Add_user = new QAction( this, "Add_user" );
Del_user = new QAction( this, "Del_user" );
Check_table = new QAction( this, "Check_table" );
Change_table = new QAction( this, "Change_table" );
Combine_table = new QAction( this, "Combine_table" );
Set_seat = new QAction(this, "Set_seat");
Help = new QAction( this, "Help" );
About = new QAction( this, "About" );
add_staff_dialog = new add_staff(0,"add_staff");
del_staff_dialog = new del_staff(0,"del_staff");
add_user_dialog = new add_user(0,"add_user");
del_user_dialog = new del_user(0,"del_user");
add_dish_dialog = new add_dish(0,"add_dish");
del_dish_dialog = new del_dish(0,"del_dish");
check_table_dialog = new check_table(0,"check_table");
change_table_dialog = new Change_Table(0,"change_table");
combine_table_dialog = new Combine_Form(0,"combine_table");
set_seat_dialog = new set_seat(0,"set_seat");
// menubar
MenuBarEditor = new QMenuBar( this, "MenuBarEditor" );
S = new QPopupMenu( this );
Add_staff->addTo( S );
Del_staff->addTo( S );
MenuBarEditor->insertItem( QString(""), S, 1 );
D = new QPopupMenu( this );
Add_dish->addTo( D );
Del_dish->addTo( D );
MenuBarEditor->insertItem( QString(""), D, 2 );
L = new QPopupMenu( this );
Add_user->addTo( L );
Del_user->addTo( L );
MenuBarEditor->insertItem( QString(""), L, 3 );
T = new QPopupMenu( this );
Check_table->addTo( T );
Change_table->addTo( T );
Combine_table->addTo( T );
Set_seat->addTo(T);
MenuBarEditor->insertItem( QString(""), T, 4 );
H_2 = new QPopupMenu( this );
Help->addTo( H_2 );
About->addTo( H_2 );
MenuBarEditor->insertItem( QString(""), H_2, 6 );
languageChange();
resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
page_up = new QPushButton(this,"page_up");
page_up -> setText(trUtf8("上一页"));
page_up ->setGeometry(90,430,70,24);
page_down = new QPushButton(this,"page_down");
page_down -> setText(trUtf8("下一页"));
page_down ->setGeometry(420,430,70,24);
iconview = new QIconView(this);
iconview ->setMargin( 5 );
iconview ->setLineWidth ( 1 );
iconview ->setSelectionMode( QIconView::NoSelection );
iconview ->setItemsMovable ( false );
iconview ->setSpacing ( 8 );
iconview ->setGeometry(40,30,520,380);
iconview_show();
//信号与槽连接
connect(Add_staff, SIGNAL(activated()), this, SLOT(add_staff_show()));
connect(Del_staff, SIGNAL(activated()), this, SLOT(del_staff_show()));
connect(Add_user, SIGNAL(activated()), this, SLOT(add_user_show()));
connect(Del_user, SIGNAL(activated()), this, SLOT(del_user_show()));
connect(Add_dish, SIGNAL(activated()), this, SLOT(add_dish_show()));
connect(Del_dish, SIGNAL(activated()), this, SLOT(del_dish_show()));
connect(Check_table, SIGNAL(activated()), this, SLOT(check_table_show()));
connect(Change_table,SIGNAL(activated()), this, SLOT(change_table_show()));
connect(Combine_table,SIGNAL(activated()), this, SLOT(combine_table_show()));
connect(Set_seat,SIGNAL(activated()), this, SLOT(set_seat_show()));
connect(About,SIGNAL(activated()), this, SLOT(about()));//关于
connect(Help,SIGNAL(activated()), this, SLOT(help()));//帮助
connect(iconview,SIGNAL(doubleClicked(QIconViewItem *)), this, SLOT(doubleClicke_slot(QIconViewItem *)));
connect(check_table_dialog, SIGNAL(data_change()), this, SLOT(iconview_show()));
connect(change_table_dialog, SIGNAL(data_change()), this, SLOT(iconview_show()));
connect(combine_table_dialog, SIGNAL(data_change()), this, SLOT(iconview_show()));
connect(set_seat_dialog, SIGNAL(data_change()), this, SLOT(iconview_show()));
connect(page_up , SIGNAL(clicked()), this, SLOT(page_up_slot()));
connect(page_down, SIGNAL(clicked()), this, SLOT(page_down_slot()));
}
void main_server::page_up_slot()
{
QFile f("data/seat_num.conf");
f.open(IO_ReadOnly);
f.readLine(seat_num,5);
f.close();
page_down ->setEnabled(true);
iconview -> clear();
if((i + 1)% 28 != 0)
{
i -= seat_num.toInt()%28 + 28 - 1;
}
else
{
i -= 55;
}
for(;i < seat_num.toInt();i++)
{
char str[5];
QString tem(gcvt(i+1,5,str));
userdb = QSqlDatabase::database( "user" );
QSqlCursor cur_check("client_info",true,userdb);
cur_check.select("seat_num = '"+ tem +"' and remarks = 1");
if( !cur_check.next() )
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/2.png" ) );
}
else
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/1.png" ) );
}
if ((i + 1)% 28 == 0||i == seat_num.toInt() - 1)
break;
}
if (i <= 28)
{
page_up ->setEnabled(false);
}
}
void main_server::page_down_slot()
{
QFile f("data/seat_num.conf");
f.open(IO_ReadOnly);
f.readLine(seat_num,5);
f.close();
page_up ->setEnabled(true);
iconview -> clear();
i++;
for(;i < seat_num.toInt();i++)
{
char str[5];
QString tem(gcvt(i+1,5,str));
QSqlDatabase *userdb = NULL;
userdb = QSqlDatabase::database( "user" );
QSqlCursor cur_check("client_info",true,userdb);
cur_check.select("seat_num = '"+ tem +"' and remarks = 1");
if( !cur_check.next() )
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/2.png" ) );
}
else
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/1.png" ) );
}
if ((i + 1)% 28 == 0||i == seat_num.toInt() -1)
break;
}
if (i == seat_num.toInt() - 1)
{
page_down ->setEnabled(false);
}
}
void main_server::iconview_show()
{
QFile f("data/seat_num.conf");
f.open(IO_ReadOnly);
f.readLine(seat_num,5);
f.close();
iconview -> clear();
if (seat_num.toInt() > 28)
{
page_down ->setEnabled(true);
}
if (i >= 27)
{
if( i%28 == 0)
i -= 27;
else
i -= i%28;
}
else
{
i = 0;
}
for(;i < seat_num.toInt();i++)
{
char str[5];
QString tem(gcvt(i+1,5,str));
userdb = QSqlDatabase::database( "user" );
QSqlCursor cur_check("client_info",true,userdb);
cur_check.select("seat_num = '"+ tem +"' and remarks = 1");
if( !cur_check.next() )
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/2.png" ) );
}
else
{
(void) new QIconViewItem( iconview, tem, QPixmap( "image/1.png" ) );
}
if ((i + 1)% 28 == 0||i == seat_num.toInt() - 1)
break;
}
if (i <= 28)
{
page_up ->setEnabled(false);
}
if (i == seat_num.toInt() - 1)
{
page_down ->setEnabled(false);
}
}
void main_server::doubleClicke_slot(QIconViewItem *item)
{
userdb = QSqlDatabase::database( "user" );
QSqlCursor cur_check("client_info",true,userdb);
cur_check.select("seat_num = '"+ item ->text() +"' and remarks = 1");
if ( cur_check.next())
{
accounts = new Check_table_a(0,"accounts",item ->text());
connect(accounts, SIGNAL(data_change()), this, SLOT(iconview_show()));
accounts -> move(60,90);
accounts -> show();
}
}
void main_server::add_staff_show()
{
add_staff_dialog ->move(150,170);
add_staff_dialog -> show();
}
void main_server::del_staff_show()
{
del_staff_dialog ->move(150,170);
del_staff_dialog -> show();
}
void main_server::add_user_show()
{
add_user_dialog ->move(150,170);
add_user_dialog -> show();
}
void main_server::del_user_show()
{
del_user_dialog ->move(150,170);
del_user_dialog -> show();
}
void main_server::add_dish_show()
{
add
没有合适的资源?快使用搜索试试~ 我知道了~
local_area_network_order.rar_linux qt3_linux点菜_qt3_点菜
共210个文件
o:78个
cpp:78个
h:38个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 156 浏览量
2022-09-20
17:26:07
上传
评论
收藏 707KB RAR 举报
温馨提示
实现局域网点菜功能 分为服务器和客户端 菜单有更新功能 开发环境:linux,QT3 运行环境:linux
资源推荐
资源详情
资源评论
收起资源包目录
local_area_network_order.rar_linux qt3_linux点菜_qt3_点菜 (210个子文件)
client 341KB
server.conf 18B
port.conf 5B
seat_num.conf 2B
main_server.cpp 14KB
server.cpp 13KB
check_dish_already.cpp 11KB
check_dish_menu.cpp 10KB
dish_menu.cpp 9KB
moc_check_dish_already.cpp 9KB
dish_already.cpp 9KB
moc_client.cpp 8KB
moc_check_dish_menu.cpp 8KB
moc_dish_menu.cpp 8KB
mainwidget.cpp 8KB
moc_dish_already.cpp 7KB
client.cpp 7KB
moc_server.cpp 7KB
check_dish_info.cpp 7KB
dish_info.cpp 6KB
check_table.cpp 6KB
moc_mainmenu.cpp 6KB
check_dish_revise.cpp 6KB
dish_revise.cpp 6KB
moc_check_dish_info.cpp 5KB
moc_main_server.cpp 5KB
moc_dish_info.cpp 5KB
check_dish_decline.cpp 5KB
dish_decline.cpp 5KB
combine_form.cpp 5KB
moc_check_dish_decline.cpp 5KB
moc_check_dish_revise.cpp 5KB
check_table_a.cpp 5KB
moc_dish_decline.cpp 5KB
moc_dish_revise.cpp 5KB
change_table.cpp 5KB
mainmenu.cpp 4KB
add_dish.cpp 4KB
moc_check_table.cpp 4KB
moc_create_table.cpp 4KB
add_staff.cpp 4KB
combin_table.cpp 4KB
moc_combine_form.cpp 4KB
moc_check_table.cpp 4KB
moc_change_table.cpp 4KB
moc_logwidget.cpp 4KB
moc_combin_table.cpp 3KB
change_table.cpp 3KB
logwidget.cpp 3KB
check_table.cpp 3KB
set.cpp 3KB
del_dish.cpp 3KB
moc_select.cpp 3KB
moc_check_table_a.cpp 3KB
moc_check_table1.cpp 3KB
del_user.cpp 3KB
moc_set_seat.cpp 3KB
create_table.cpp 3KB
moc_change_table.cpp 3KB
add_user.cpp 3KB
del_staff.cpp 3KB
moc_dish_update.cpp 3KB
loginform.cpp 3KB
dish_update.cpp 3KB
moc_add_staff.cpp 3KB
moc_del_staff.cpp 3KB
moc_loginform.cpp 3KB
moc_add_dish.cpp 3KB
moc_del_dish.cpp 3KB
moc_del_user.cpp 3KB
moc_add_user.cpp 3KB
moc_set_port.cpp 3KB
moc_mainwidget.cpp 3KB
moc_set.cpp 3KB
moc_check.cpp 3KB
select.cpp 2KB
set_seat.cpp 2KB
set_port.cpp 2KB
connection.cpp 844B
main.cpp 376B
main.cpp 373B
connect_db.cpp 252B
server_CONF.dat 14B
user.db 9KB
menu.db 6KB
menu.db 6KB
main_server.h 3KB
check_dish_already.h 2KB
dish_already.h 2KB
check_dish_menu.h 2KB
dish_menu.h 2KB
client.h 2KB
check_dish_info.h 2KB
dish_info.h 2KB
check_dish_revise.h 2KB
dish_revise.h 2KB
check_dish_decline.h 2KB
dish_decline.h 2KB
server.h 2KB
mainmenu.h 1KB
共 210 条
- 1
- 2
- 3
资源评论
alvarocfc
- 粉丝: 108
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功