├── 17-18 下 程序设计基础实验 └── 项目一 网店购物管理系统 │ ├── Taobao v1.0 │ ├── Taobao │ │ ├── clover.txt │ │ ├── admin.txt │ │ ├── user.txt │ │ ├── item.txt │ │ ├── list.txt │ │ ├── setting.h │ │ ├── main.cpp │ │ ├── const.h │ │ ├── Model │ │ │ ├── user.h │ │ │ ├── user.cpp │ │ │ ├── file.cpp │ │ │ ├── file.h │ │ │ ├── item.h │ │ │ └── item.cpp │ │ ├── Controller │ │ │ ├── cartctrl.h │ │ │ ├── cartctrl.cpp │ │ │ ├── userctrl.h │ │ │ ├── filectrl.h │ │ │ ├── itemctrl.h │ │ │ ├── userctrl.cpp │ │ │ ├── filectrl.cpp │ │ │ └── itemctrl.cpp │ │ ├── View │ │ │ ├── menu.h │ │ │ └── menu.cpp │ │ ├── Taobao.vcxproj.filters │ │ └── Taobao.vcxproj │ └── Taobao.sln │ ├── Taobao v2.0 │ ├── build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug │ │ ├── a.txt │ │ ├── clover.txt │ │ ├── admin.txt │ │ ├── user.txt │ │ ├── item.txt │ │ ├── list.txt │ │ ├── .qmake.stash │ │ ├── ui_showlistview.h │ │ ├── ui_mainwindow.h │ │ ├── ui_showcart.h │ │ ├── ui_addtocartview.h │ │ ├── ui_usermainwindow.h │ │ ├── ui_adminmainwindow.h │ │ ├── ui_logindlg.h │ │ ├── ui_additemview.h │ │ └── Makefile │ └── TaoBao │ │ ├── setting.h │ │ ├── mainwindow.cpp │ │ ├── const.h │ │ ├── Model │ │ ├── user.h │ │ ├── user.cpp │ │ ├── item.h │ │ └── item.cpp │ │ ├── mainwindow.h │ │ ├── Controller │ │ ├── cartctrl.h │ │ ├── userctrl.h │ │ ├── cartctrl.cpp │ │ ├── filectrl.h │ │ ├── itemctrl.h │ │ ├── userctrl.cpp │ │ ├── filectrl.cpp │ │ └── itemctrl.cpp │ │ ├── View │ │ ├── addtocartview.cpp │ │ ├── addtocartview.h │ │ ├── additemview.cpp │ │ ├── additemview.h │ │ ├── showlistview.h │ │ ├── logindlg.h │ │ ├── showcart.h │ │ ├── adminmainwindow.h │ │ ├── usermainwindow.h │ │ ├── showlistview.cpp │ │ ├── showlistview.ui │ │ ├── usermainwindow.ui │ │ ├── showcart.ui │ │ ├── addtocartview.ui │ │ ├── adminmainwindow.ui │ │ ├── showcart.cpp │ │ ├── logindlg.cpp │ │ ├── adminmainwindow.cpp │ │ ├── additemview.ui │ │ ├── logindlg.ui │ │ └── usermainwindow.cpp │ │ ├── main.cpp │ │ ├── mainwindow.ui │ │ └── TaoBao.pro │ ├── Pics │ ├── cart.png │ ├── list.png │ ├── addtocart.png │ ├── suretobuy.png │ ├── additemnum.png │ ├── logindialog.png │ ├── userhasbenused.png │ ├── usermainwindow.png │ ├── adminmainwindow.png │ └── cantregisteradmin.png │ └── README.md └── .gitignore /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/clover.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/admin.txt: -------------------------------------------------------------------------------- 1 | 0 clover clover 1 -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/user.txt: -------------------------------------------------------------------------------- 1 | 0 clover clover 1 2 | 3 | 1 asdf asdf 1 -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/a.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/clover.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/admin.txt: -------------------------------------------------------------------------------- 1 | 0 clover clover 1 -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/user.txt: -------------------------------------------------------------------------------- 1 | 2 | 1 a a 1 3 | 2 clover clover 1 -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/cart.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/list.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/addtocart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/addtocart.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/suretobuy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/suretobuy.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/additemnum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/additemnum.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/logindialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/logindialog.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/userhasbenused.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/userhasbenused.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/usermainwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/usermainwindow.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/adminmainwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/adminmainwindow.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/cantregisteradmin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Pics/cantregisteradmin.png -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/item.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/item.txt -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/list.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/NJU-Homework/master/17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/list.txt -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/item.txt: -------------------------------------------------------------------------------- 1 | F0000 芒果干 三只松鼠 11.9 118 2 | F0001 酸奶 光明 51.5 11 3 | F0004 可乐 可口可乐 18.8 -1 4 | F0005 adzf asdf 12.3 2 5 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/setting.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTING 2 | #define SETTING 3 | 4 | 5 | #define ISALLOWANOMY false 6 | #define ITEMFILENAME "item.txt" 7 | 8 | #define USERFILENAME "user.txt" 9 | #define ADMINFILENAME "admin.txt" 10 | #define LISTFILENAME "list.txt" 11 | 12 | #define MAXSHOWITEM 10 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/setting.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTING 2 | #define SETTING 3 | 4 | 5 | #define ISALLOWANOMY false 6 | #define ITEMFILENAME "item.txt" 7 | 8 | #define USERFILENAME "user.txt" 9 | #define ADMINFILENAME "admin.txt" 10 | #define LISTFILENAME "list.txt" 11 | 12 | #define MAXSHOWITEM 10 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/main.cpp: -------------------------------------------------------------------------------- 1 | #include"View/menu.h" 2 | #include "const.h" 3 | 4 | int main(void){ 5 | Menu* menu = new Menu; 6 | menu->showWelcome(); 7 | while (menu->loginMenu() == BACKTOLASTMENU) { 8 | while (menu->mainMenu() == BACKTOLASTMENU) { 9 | break; 10 | } 11 | } 12 | system("pause"); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | 4 | 5 | MainWindow::MainWindow(QWidget *parent) : 6 | QMainWindow(parent), 7 | ui(new Ui::MainWindow) 8 | { 9 | ui->setupUi(this); 10 | ui->pushButton->setText("New Window"); 11 | } 12 | 13 | MainWindow::~MainWindow() 14 | { 15 | delete ui; 16 | } 17 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/const.h: -------------------------------------------------------------------------------- 1 | #ifndef CONST 2 | #define CONST 3 | 4 | #define USERNAME_UNUSED -1 5 | #define PASSWORD_NOTVALID -2 6 | #define USERNAME_ISEMPTY -3 7 | #define PASSWORD_ISEMPTY -4 8 | 9 | #define HAVEITEM 1 10 | #define NOSUCHITEM -1 11 | 12 | #define BACKTOLASTMENU true 13 | #define DIRECTEXIT false 14 | 15 | enum USERTYPE {ANOMY, USER, ADMIN}; 16 | 17 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/const.h: -------------------------------------------------------------------------------- 1 | #ifndef CONST 2 | #define CONST 3 | 4 | #define USERNAME_UNUSED -1 5 | #define PASSWORD_NOTVALID -2 6 | #define USERNAME_ISEMPTY -3 7 | #define PASSWORD_ISEMPTY -4 8 | 9 | #define HAVEITEM 1 10 | #define NOSUCHITEM -1 11 | 12 | #define BACKTOLASTMENU true 13 | #define DIRECTEXIT false 14 | 15 | enum USERTYPE {ANOMY, USER, ADMIN}; 16 | 17 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/user.h: -------------------------------------------------------------------------------- 1 | #ifndef MYUSER 2 | #define MYUSER 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class User { 9 | public: 10 | User(int nusernum, string nusername); 11 | int getUserNum(void); 12 | string getUsername(void); 13 | void changeUser(int nusernum, string nusername); 14 | private: 15 | int usernum; 16 | string username; 17 | }; 18 | 19 | 20 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Model/user.h: -------------------------------------------------------------------------------- 1 | #ifndef MYUSER 2 | #define MYUSER 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class User { 9 | public: 10 | User(int nusernum, string nusername); 11 | int getUserNum(void); 12 | string getUsername(void); 13 | void changeUser(int nusernum, string nusername); 14 | private: 15 | int usernum; 16 | string username; 17 | }; 18 | 19 | 20 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit MainWindow(QWidget *parent = 0); 16 | ~MainWindow(); 17 | 18 | private: 19 | Ui::MainWindow *ui; 20 | }; 21 | 22 | #endif // MAINWINDOW_H 23 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/user.cpp: -------------------------------------------------------------------------------- 1 | #include "user.h" 2 | 3 | User::User(int nusernum, string nusername) { 4 | usernum = nusernum; 5 | username = nusername; 6 | } 7 | 8 | int User::getUserNum(void) { 9 | return usernum; 10 | } 11 | 12 | string User::getUsername(void) { 13 | return username; 14 | } 15 | 16 | void User::changeUser(int nusernum, string nusername) { 17 | usernum = nusernum; 18 | username = nusernum; 19 | } 20 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Model/user.cpp: -------------------------------------------------------------------------------- 1 | #include "user.h" 2 | 3 | User::User(int nusernum, string nusername) { 4 | usernum = nusernum; 5 | username = nusername; 6 | } 7 | 8 | int User::getUserNum(void) { 9 | return usernum; 10 | } 11 | 12 | string User::getUsername(void) { 13 | return username; 14 | } 15 | 16 | void User::changeUser(int nusernum, string nusername) { 17 | usernum = nusernum; 18 | username = nusernum; 19 | } 20 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/cartctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTCTRL 2 | #define CARTCTRL 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | #include "itemctrl.h" 8 | #include "filectrl.h" 9 | 10 | class CartCtrl { 11 | public: 12 | CartCtrl(string filename); 13 | void buyItem(ItemCtrl* itemctrl, string user); 14 | ItemCtrl* cart; 15 | private: 16 | void clearCart(void); 17 | string filename; 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/cartctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef CARTCTRL 2 | #define CARTCTRL 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | #include "itemctrl.h" 8 | #include "filectrl.h" 9 | 10 | class CartCtrl { 11 | public: 12 | CartCtrl(string filename); 13 | void buyItem(ItemCtrl* itemctrl, string user); 14 | string getFileName(void); 15 | ItemCtrl* cart; 16 | private: 17 | void clearCart(void); 18 | string filename; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/addtocartview.cpp: -------------------------------------------------------------------------------- 1 | #include "addtocartview.h" 2 | #include "ui_addtocartview.h" 3 | #include "showlistview.h" 4 | 5 | AddToCartView::AddToCartView(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::AddToCartView) 8 | { 9 | ui->setupUi(this); 10 | 11 | 12 | } 13 | 14 | AddToCartView::~AddToCartView() 15 | { 16 | delete ui; 17 | } 18 | 19 | void AddToCartView::on_buttonBox_accepted() 20 | { 21 | emit addToCartNum(ui->addNumSpinBox->value()); 22 | } 23 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/file.cpp: -------------------------------------------------------------------------------- 1 | #include "file.h" 2 | 3 | //OutFile::OutFile(string p){ 4 | // path = p; 5 | //} 6 | // 7 | //Item* OutFile::readItem(void){ 8 | // OpFile(); 9 | // 10 | // Item* rst = new Item(); 11 | // ClFile(); 12 | //} 13 | // 14 | // 15 | //bool OutFile::OpFile(void){ 16 | // ofstream* outfile() 17 | //} 18 | // 19 | //bool OutFile::ClFile(void){ 20 | // if(file == NULL) return false; 21 | // else{ 22 | // fclose(file); 23 | // return true; 24 | // } 25 | //} 26 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/file.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE 2 | #define FILE 3 | 4 | #include 5 | //#include 6 | #include 7 | using namespace std; 8 | 9 | #include "item.h" 10 | 11 | class OutFile{ 12 | //public: 13 | // OutFile(string p); 14 | // Item* readItem(void); 15 | //private: 16 | // bool OpFile(void); 17 | // bool ClFile(void); 18 | // string path; 19 | // FILE* file; 20 | }; 21 | 22 | // class InFile{ 23 | // public: 24 | // 25 | // private: 26 | // string path; 27 | // }; 28 | 29 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/addtocartview.h: -------------------------------------------------------------------------------- 1 | #ifndef ADDTOCARTVIEW_H 2 | #define ADDTOCARTVIEW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AddToCartView; 8 | } 9 | 10 | class AddToCartView : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit AddToCartView(QWidget *parent = 0); 16 | ~AddToCartView(); 17 | signals: 18 | void addToCartNum(int num); 19 | 20 | private slots: 21 | void on_buttonBox_accepted(); 22 | 23 | private: 24 | Ui::AddToCartView *ui; 25 | }; 26 | 27 | #endif // ADDTOCARTVIEW_H 28 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/list.txt: -------------------------------------------------------------------------------- 1 | F0001 CuiCui QAQ 5.2 1 clover 2 | F0000 芒果干 三只松鼠 11.9 118 12 3 | F0001 酸奶 光明 51.5 12 asdf 4 | F0002 酸奶 蒙牛 59.4 10 asdf 5 | F0003 酸奶 伊利 56 15 wer 6 | F0004 可乐 可口可乐 18.8 24 qwe 7 | F0006 华夫饼 华美 29.9 12 sdf 8 | F0001 CuiCui QAQ 5.2 1 clover 9 | F0001 CuiCui QAQ 5.2 1 clover 10 | F0001 CuiCui QAQ 5.2 1 clover 11 | F0001 酸奶 光明 51.5 34 clover 12 | F0001 酸奶 光明 51.5 12 clover 13 | F0001 酸奶 光明 51.5 1 clover 14 | F0002 酸奶 蒙牛 59.4 1 clover 15 | F0002 酸奶 蒙牛 59.4 12 clover 16 | F0003 酸奶 伊利 56 4 a 17 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/additemview.cpp: -------------------------------------------------------------------------------- 1 | #include "additemview.h" 2 | #include "ui_additemview.h" 3 | 4 | AddItemView::AddItemView(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::AddItemView) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | AddItemView::~AddItemView() 12 | { 13 | delete ui; 14 | } 15 | 16 | 17 | 18 | void AddItemView::on_buttonBox_accepted() 19 | { 20 | name= ui->nameEdit->text().toStdString(); 21 | label= ui->labelEdit->text().toStdString(); 22 | price = ui->priceDoubleSpinBox->value(); 23 | num = ui->numSpinBox->value(); 24 | } 25 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/additemview.h: -------------------------------------------------------------------------------- 1 | #ifndef ADDITEMVIEW_H 2 | #define ADDITEMVIEW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AddItemView; 8 | } 9 | 10 | class AddItemView : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit AddItemView(QWidget *parent = 0); 16 | ~AddItemView(); 17 | std::string name; 18 | std::string label; 19 | float price; 20 | int num; 21 | 22 | private slots: 23 | void on_buttonBox_accepted(); 24 | 25 | private: 26 | Ui::AddItemView *ui; 27 | 28 | }; 29 | 30 | #endif // ADDITEMVIEW_H 31 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showlistview.h: -------------------------------------------------------------------------------- 1 | #ifndef SHOWLISTVIEW_H 2 | #define SHOWLISTVIEW_H 3 | 4 | #include 5 | #include 6 | #include "../Controller/filectrl.h" 7 | #include "../Controller/itemctrl.h" 8 | #include "../const.h" 9 | 10 | namespace Ui { 11 | class ShowListView; 12 | } 13 | 14 | class ShowListView : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit ShowListView(QWidget *parent = 0); 20 | ~ShowListView(); 21 | 22 | private: 23 | Ui::ShowListView *ui; 24 | QStandardItemModel* model; 25 | }; 26 | 27 | #endif // SHOWLISTVIEW_H 28 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/logindlg.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGINDLG_H 2 | #define LOGINDLG_H 3 | 4 | #include 5 | #include "../Controller/userctrl.h" 6 | #include "usermainwindow.h" 7 | 8 | namespace Ui { 9 | class LoginDlg; 10 | } 11 | 12 | class LoginDlg : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit LoginDlg(QWidget *parent = 0); 18 | void senduserctrl(void); 19 | ~LoginDlg(); 20 | bool isAdmin; 21 | bool isNewUser; 22 | 23 | private slots: 24 | void on_loginButton_clicked(); 25 | 26 | signals: 27 | void sendUserCtrl(UserCtrl* userctrl); 28 | 29 | private: 30 | UserMainWindow u; 31 | UserCtrl* userctrl; 32 | Ui::LoginDlg *ui; 33 | }; 34 | 35 | #endif // LOGINDLG_H 36 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/cartctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "cartctrl.h" 2 | 3 | CartCtrl::CartCtrl(string ifilename) { 4 | cart = new ItemCtrl(ifilename); 5 | cart->readItemFromFile(MAXSHOWITEM,ifilename); 6 | filename = ifilename; 7 | } 8 | 9 | void CartCtrl::buyItem(ItemCtrl* itemctrl, string user) { 10 | for (int i = 0; i < cart->getItemTotalNum(); i++) { 11 | itemctrl->delItemNum(cart->getItemID(i), cart->getItemNum(i)); 12 | } 13 | FileCtrl* filectrl = new FileCtrl(string(LISTFILENAME), string(LISTFILENAME)); 14 | filectrl->putNewBill(cart->getItem(0), user); 15 | delete(filectrl); 16 | clearCart(); 17 | } 18 | 19 | void CartCtrl::clearCart(void) { 20 | FileCtrl* filectrl = new FileCtrl(filename, filename); 21 | filectrl->clearFile(); 22 | delete(filectrl); 23 | delete(cart); 24 | cart = new ItemCtrl(filename); 25 | } -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/userctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef USERCTRL 2 | #define USERCTRL 3 | 4 | //#include "../Model/user.h" 5 | //#include "../Model/file.h" 6 | 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | #include "../const.h" 12 | #include "../setting.h" 13 | #include "../Model/user.h" 14 | #include "filectrl.h" 15 | 16 | class UserCtrl { 17 | public: 18 | UserCtrl(); 19 | int authUser(string username, string password); 20 | int authAdmin(string username, string password); 21 | string getName(void); 22 | USERTYPE getUserType(void); 23 | bool addNewUser(string username, string password); 24 | private: 25 | int searchUserInFile(string username, string file); 26 | bool matchUserPassword(string username, string password, string file); 27 | User* user; 28 | USERTYPE usertype; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/userctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef USERCTRL 2 | #define USERCTRL 3 | 4 | //#include "../Model/user.h" 5 | //#include "../Model/file.h" 6 | 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | #include "../const.h" 12 | #include "../setting.h" 13 | #include "../Model/user.h" 14 | #include "filectrl.h" 15 | 16 | class UserCtrl { 17 | public: 18 | UserCtrl(); 19 | int authUser(string username, string password); 20 | int authAdmin(string username, string password); 21 | string getName(void); 22 | USERTYPE getUserType(void); 23 | bool addNewUser(string username, string password); 24 | private: 25 | int searchUserInFile(string username, string file); 26 | bool matchUserPassword(string username, string password, string file); 27 | User* user; 28 | USERTYPE usertype; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showcart.h: -------------------------------------------------------------------------------- 1 | #ifndef SHOWCART_H 2 | #define SHOWCART_H 3 | 4 | #include 5 | #include "../Controller/cartctrl.h" 6 | #include "../Controller/userctrl.h" 7 | #include "../Controller/itemctrl.h" 8 | #include 9 | 10 | namespace Ui { 11 | class ShowCart; 12 | } 13 | 14 | class ShowCart : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | void init(CartCtrl* ncartctrl, UserCtrl* nuserctrl, ItemCtrl* nitemctrl); 20 | explicit ShowCart(QWidget *parent = 0); 21 | ~ShowCart(); 22 | 23 | private slots: 24 | void on_delBtn_clicked(); 25 | 26 | void on_buyBtn_clicked(); 27 | 28 | private: 29 | Ui::ShowCart *ui; 30 | CartCtrl* cartctrl; 31 | UserCtrl* userctrl; 32 | ItemCtrl* itemctrl; 33 | QStandardItemModel* model; 34 | }; 35 | 36 | #endif // SHOWCART_H 37 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/cartctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "cartctrl.h" 2 | 3 | CartCtrl::CartCtrl(string ifilename) { 4 | cart = new ItemCtrl(ifilename); 5 | cart->readItemFromFile(MAXSHOWITEM,ifilename); 6 | filename = ifilename; 7 | } 8 | 9 | string CartCtrl::getFileName(void){ 10 | return filename; 11 | } 12 | 13 | void CartCtrl::buyItem(ItemCtrl* itemctrl, string user) { 14 | for (int i = 0; i < cart->getItemTotalNum(); i++) { 15 | itemctrl->delItemNum(cart->getItemID(i), cart->getItemNum(i)); 16 | } 17 | FileCtrl* filectrl = new FileCtrl(string(LISTFILENAME), string(LISTFILENAME)); 18 | filectrl->putNewBill(cart->getItem(0), user); 19 | delete(filectrl); 20 | clearCart(); 21 | } 22 | 23 | void CartCtrl::clearCart(void) { 24 | FileCtrl* filectrl = new FileCtrl(filename, filename); 25 | filectrl->clearFile(); 26 | delete(filectrl); 27 | delete(cart); 28 | cart = new ItemCtrl(filename); 29 | } 30 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/adminmainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef ADMINMAINWINDOW_H 2 | #define ADMINMAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include "../Controller/itemctrl.h" 7 | #include "../Controller/cartctrl.h" 8 | #include "../Controller/userctrl.h" 9 | #include "showlistview.h" 10 | #include "additemview.h" 11 | 12 | namespace Ui { 13 | class AdminMainWindow; 14 | } 15 | 16 | class AdminMainWindow : public QMainWindow 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit AdminMainWindow(QWidget *parent = 0); 22 | ~AdminMainWindow(); 23 | 24 | private slots: 25 | void on_showListBtn_clicked(); 26 | void on_delBtn_clicked(); 27 | void on_addBtn_clicked(); 28 | 29 | private: 30 | Ui::AdminMainWindow *ui; 31 | QStandardItemModel* model; 32 | void refresh(); 33 | UserCtrl* userctrl; 34 | ItemCtrl* itemctrl; 35 | CartCtrl* cartctrl; 36 | }; 37 | 38 | #endif // ADMINMAINWINDOW_H 39 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/usermainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef USERMAINWINDOW_H 2 | #define USERMAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include "../Controller/itemctrl.h" 7 | #include "../Controller/cartctrl.h" 8 | #include "../Controller/userctrl.h" 9 | 10 | namespace Ui { 11 | class UserMainWindow; 12 | } 13 | 14 | class UserMainWindow : public QMainWindow 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit UserMainWindow(QWidget *parent = 0); 20 | ~UserMainWindow(); 21 | 22 | private slots: 23 | void addItemToCart(int num); 24 | void passUserCtrl(UserCtrl* nuserctrl); 25 | void on_AddToCartBtn_clicked(); 26 | 27 | void on_seeCartBtn_clicked(); 28 | 29 | void on_logOutBtn_clicked(); 30 | 31 | private: 32 | void refresh(); 33 | Ui::UserMainWindow *ui; 34 | QStandardItemModel* model; 35 | UserCtrl* userctrl; 36 | ItemCtrl* itemctrl; 37 | CartCtrl* cartctrl; 38 | }; 39 | 40 | #endif // USERMAINWINDOW_H 41 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include 4 | 5 | #include "view/logindlg.h" 6 | #include "view/usermainwindow.h" 7 | #include "View/adminmainwindow.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | QApplication a(argc, argv); 12 | //MainWindow w; 13 | LoginDlg dlg; 14 | 15 | 16 | if(dlg.exec() == QDialog::Accepted){ 17 | if(dlg.isAdmin == true){ 18 | AdminMainWindow b; 19 | // QObject::connect(&dlg,SIGNAL(sendUserCtrl(UserCtrl*)),&u,SLOT(passUserCtrl(UserCtrl*))); 20 | b.show(); 21 | return a.exec(); 22 | }else{ 23 | UserMainWindow u; 24 | QObject::connect(&dlg,SIGNAL(sendUserCtrl(UserCtrl*)),&u,SLOT(passUserCtrl(UserCtrl*))); 25 | dlg.senduserctrl(); 26 | u.show(); 27 | return a.exec(); 28 | } 29 | //w.show(); 30 | //return a.exec(); 31 | } 32 | else return 0; 33 | } 34 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/filectrl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef FILECTRL 3 | #define FIELCTRL 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | #include "../const.h" 12 | #include "../Model/item.h" 13 | 14 | 15 | class FileCtrl{ 16 | public: 17 | FileCtrl(string fin, string fout); 18 | 19 | Item* getAllItems(void); 20 | Bill* getAllBills(void); 21 | Item* getItems(int itemnum); 22 | string getNextItemID(void); 23 | bool putNewItem(Item* item); 24 | bool putNewItem(Item* item, string id); 25 | bool saveItems(Item* item); 26 | bool putNewBill(Item* bill, string user); 27 | 28 | int searchUserInFile(string username); 29 | bool matchUserPassword(string iusername, string ipassword); 30 | int getNextUserNum(void); 31 | bool addUser(string username, string password); 32 | 33 | bool clearFile(void); 34 | private: 35 | string getLastItemID(void); 36 | int getLastUserNum(void); 37 | string in; 38 | string out; 39 | }; 40 | 41 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/filectrl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef FILECTRL 3 | #define FIELCTRL 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | #include "../const.h" 12 | #include "../Model/item.h" 13 | 14 | 15 | class FileCtrl{ 16 | public: 17 | FileCtrl(string fin, string fout); 18 | 19 | Item* getAllItems(void); 20 | Bill* getAllBills(void); 21 | Item* getItems(int itemnum); 22 | string getNextItemID(void); 23 | bool putNewItem(Item* item); 24 | bool putNewItem(Item* item, string id); 25 | bool saveItems(Item* item); 26 | bool putNewBill(Item* bill, string user); 27 | 28 | int searchUserInFile(string username); 29 | bool matchUserPassword(string iusername, string ipassword); 30 | int getNextUserNum(void); 31 | bool addUser(string username, string password); 32 | 33 | bool clearFile(void); 34 | private: 35 | string getLastItemID(void); 36 | int getLastUserNum(void); 37 | string in; 38 | string out; 39 | }; 40 | 41 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Taobao", "Taobao\Taobao.vcxproj", "{73C3303D-3653-49E0-A387-C46EBE0B053C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {73C3303D-3653-49E0-A387-C46EBE0B053C}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {73C3303D-3653-49E0-A387-C46EBE0B053C}.Debug|Win32.Build.0 = Debug|Win32 16 | {73C3303D-3653-49E0-A387-C46EBE0B053C}.Release|Win32.ActiveCfg = Release|Win32 17 | {73C3303D-3653-49E0-A387-C46EBE0B053C}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/item.h: -------------------------------------------------------------------------------- 1 | #ifndef ITEM 2 | #define ITEM 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class Item { 9 | public: 10 | Item(string iid, string iname, string ilabel, float iprice, int iquant); 11 | ~Item(); 12 | string getItemID(void); 13 | string getItemName(void); 14 | string getItemLabel(void); 15 | float getItemPrice(void); 16 | int getItemNum(void); 17 | Item* getItemNext(void); 18 | int getItemTotalNum(void); 19 | 20 | bool setItemNext(Item* item); 21 | bool addItemNum(int addnum); 22 | bool delItemNum(int delnum); 23 | bool setItemNum(int newnum); 24 | private: 25 | string id; 26 | string name; 27 | string label; 28 | float price; 29 | int num; 30 | Item* next; 31 | }; 32 | 33 | class Bill:public Item { 34 | public: 35 | Bill(string iid, string iname, string ilabel, float iprice, int iquant, string iuser) :Item(iid, iname, ilabel, iprice, iquant) { 36 | user = iuser; 37 | } 38 | string getBillUser(void); 39 | Bill* getBillNext(void); 40 | int getBillTotalNum(void); 41 | bool setBillNext(Bill* bill); 42 | private: 43 | string user; 44 | Bill* next; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Model/item.h: -------------------------------------------------------------------------------- 1 | #ifndef ITEM 2 | #define ITEM 3 | 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class Item { 9 | public: 10 | Item(string iid, string iname, string ilabel, float iprice, int iquant); 11 | ~Item(); 12 | string getItemID(void); 13 | string getItemName(void); 14 | string getItemLabel(void); 15 | float getItemPrice(void); 16 | int getItemNum(void); 17 | Item* getItemNext(void); 18 | int getItemTotalNum(void); 19 | 20 | bool setItemNext(Item* item); 21 | bool addItemNum(int addnum); 22 | bool delItemNum(int delnum); 23 | bool setItemNum(int newnum); 24 | private: 25 | string id; 26 | string name; 27 | string label; 28 | float price; 29 | int num; 30 | Item* next; 31 | }; 32 | 33 | class Bill:public Item { 34 | public: 35 | Bill(string iid, string iname, string ilabel, float iprice, int iquant, string iuser) :Item(iid, iname, ilabel, iprice, iquant) { 36 | user = iuser; 37 | next = NULL; 38 | } 39 | string getBillUser(void); 40 | Bill* getBillNext(void); 41 | int getBillTotalNum(void); 42 | bool setBillNext(Bill* bill); 43 | private: 44 | string user; 45 | Bill* next; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/.qmake.stash: -------------------------------------------------------------------------------- 1 | QMAKE_CXX.INCDIRS = \ 2 | "D:\\Program\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\ATLMFC\\include" \ 3 | "D:\\Program\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\include" \ 4 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um" \ 5 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\ucrt" \ 6 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\shared" \ 7 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\um" \ 8 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.16299.0\\winrt" 9 | QMAKE_CXX.LIBDIRS = \ 10 | "D:\\Program\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\ATLMFC\\lib\\x64" \ 11 | "D:\\Program\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\lib\\x64" \ 12 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64" \ 13 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.16299.0\\ucrt\\x64" \ 14 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.16299.0\\um\\x64" 15 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L 16 | QMAKE_CXX.QMAKE_MSC_VER = 1912 17 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 191225834 18 | QMAKE_CXX.COMPILER_MACROS = \ 19 | QT_COMPILER_STDCXX \ 20 | QMAKE_MSC_VER \ 21 | QMAKE_MSC_FULL_VER 22 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 120 21 | 180 22 | 80 23 | 15 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 0 35 | 0 36 | 400 37 | 17 38 | 39 | 40 | 41 | 42 | 43 | TopToolBarArea 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/itemctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef ITEMCTRL 2 | #define ITEMCTRL 3 | 4 | #include "../const.h" 5 | #include "../setting.h" 6 | #include "../Model/item.h" 7 | #include "filectrl.h" 8 | 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | class ItemCtrl { 14 | public: 15 | ItemCtrl(); 16 | ItemCtrl(string nfilename); 17 | ItemCtrl* searchItem(string itemname); 18 | string searchItem(string itemname, string label); 19 | int getItemTotalNum(void); 20 | string getItemID(string id); 21 | string getItemID(int num); 22 | string getItemName(string id); 23 | string getItemName(int num); 24 | string getItemLabel(string id); 25 | string getItemLabel(int num); 26 | float getItemPrice(string id); 27 | float getItemPrice(int num); 28 | int getItemNum(string id); 29 | int getItemNum(int num); 30 | float getTotalPrice(void); 31 | int readItemFromFile(int num,string filename); 32 | bool clearFile(string filename); 33 | 34 | Item* getItem(int num); 35 | 36 | bool addNewItem(string name, string label, float price, int num); 37 | bool addNewItem(string id, string name, string label, float price, int num); 38 | bool addVirtualItem(string id, string name, string label, float price, int num); 39 | bool addItemNum(string id, int addquant); 40 | bool delItemNum(string id, int addnum); 41 | bool delItem(string id); 42 | 43 | bool hasMoreItem(string id, int num); 44 | bool hasTheItem(string id); 45 | 46 | private: 47 | string filename; 48 | bool isItemEmpty(void); 49 | Item* getItem(string id); 50 | 51 | int itemNum; 52 | Item* item; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/itemctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef ITEMCTRL 2 | #define ITEMCTRL 3 | 4 | #include "../const.h" 5 | #include "../setting.h" 6 | #include "../Model/item.h" 7 | #include "filectrl.h" 8 | 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | class ItemCtrl { 14 | public: 15 | ItemCtrl(); 16 | ItemCtrl(string nfilename); 17 | ItemCtrl* searchItem(string itemname); 18 | string searchItem(string itemname, string label); 19 | int getItemTotalNum(void); 20 | string getItemID(string id); 21 | string getItemID(int num); 22 | string getItemName(string id); 23 | string getItemName(int num); 24 | string getItemLabel(string id); 25 | string getItemLabel(int num); 26 | float getItemPrice(string id); 27 | float getItemPrice(int num); 28 | int getItemNum(string id); 29 | int getItemNum(int num); 30 | float getTotalPrice(void); 31 | int readItemFromFile(int num,string filename); 32 | bool clearFile(string filename); 33 | 34 | Item* getItem(int num); 35 | 36 | bool addNewItem(string name, string label, float price, int num); 37 | bool addNewItem(string id, string name, string label, float price, int num); 38 | bool addVirtualItem(string id, string name, string label, float price, int num); 39 | bool addItemNum(string id, int addquant); 40 | bool delItemNum(string id, int addnum); 41 | bool delItem(string id); 42 | 43 | bool hasMoreItem(string id, int num); 44 | bool hasTheItem(string id); 45 | 46 | private: 47 | string filename; 48 | bool isItemEmpty(void); 49 | Item* getItem(string id); 50 | 51 | int itemNum; 52 | Item* item; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Model/item.cpp: -------------------------------------------------------------------------------- 1 | #include "item.h" 2 | 3 | Item::Item(string iid, string iname, string ilabel, float iprice, int inum) { 4 | id = iid; 5 | name = iname; 6 | label = ilabel; 7 | price = iprice; 8 | num = inum; 9 | next = NULL; 10 | } 11 | Item::~Item(){ 12 | if (next == NULL) delete(this); 13 | else delete(next); 14 | } 15 | 16 | string Item::getItemID(void) { 17 | return id; 18 | } 19 | string Item::getItemName(void) { 20 | return name; 21 | } 22 | string Item::getItemLabel(void) { 23 | return label; 24 | } 25 | float Item::getItemPrice(void) { 26 | return price; 27 | } 28 | int Item::getItemNum(void) { 29 | return num; 30 | } 31 | Item* Item::getItemNext(void) { 32 | return next; 33 | } 34 | int Item::getItemTotalNum(void) { 35 | int totalNum = 1; 36 | Item* temp = next; 37 | while (temp != NULL) { 38 | totalNum++; 39 | temp = temp->next; 40 | } 41 | return totalNum; 42 | } 43 | 44 | bool Item::setItemNext(Item* item) { 45 | next = item; 46 | return true; 47 | } 48 | bool Item::addItemNum(int addnum) { 49 | setItemNum(num + addnum); 50 | return true; 51 | } 52 | bool Item::delItemNum(int delnum) { 53 | setItemNum(num - delnum); 54 | return true; 55 | } 56 | 57 | bool Item::setItemNum(int newnum) { 58 | num = newnum; 59 | return true; 60 | } 61 | 62 | string Bill::getBillUser(void) { 63 | return user; 64 | } 65 | int Bill::getBillTotalNum(void) { 66 | int totalNum = 1; 67 | Bill* temp = next; 68 | while (temp != NULL) { 69 | totalNum++; 70 | temp = temp->next; 71 | } 72 | return totalNum; 73 | } 74 | Bill* Bill::getBillNext(void) { 75 | return next; 76 | } 77 | bool Bill::setBillNext(Bill* bill) { 78 | next = bill; 79 | return true; 80 | } 81 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Model/item.cpp: -------------------------------------------------------------------------------- 1 | #include "item.h" 2 | 3 | Item::Item(string iid, string iname, string ilabel, float iprice, int inum) { 4 | id = iid; 5 | name = iname; 6 | label = ilabel; 7 | price = iprice; 8 | num = inum; 9 | next = NULL; 10 | } 11 | Item::~Item(){ 12 | if (next == NULL) delete(this); 13 | else delete(next); 14 | } 15 | 16 | string Item::getItemID(void) { 17 | return id; 18 | } 19 | string Item::getItemName(void) { 20 | return name; 21 | } 22 | string Item::getItemLabel(void) { 23 | return label; 24 | } 25 | float Item::getItemPrice(void) { 26 | return price; 27 | } 28 | int Item::getItemNum(void) { 29 | return num; 30 | } 31 | Item* Item::getItemNext(void) { 32 | return next; 33 | } 34 | int Item::getItemTotalNum(void) { 35 | int totalNum = 1; 36 | Item* temp = next; 37 | while (temp != NULL) { 38 | totalNum++; 39 | temp = temp->next; 40 | } 41 | return totalNum; 42 | } 43 | 44 | bool Item::setItemNext(Item* item) { 45 | next = item; 46 | return true; 47 | } 48 | bool Item::addItemNum(int addnum) { 49 | setItemNum(num + addnum); 50 | return true; 51 | } 52 | bool Item::delItemNum(int delnum) { 53 | setItemNum(num - delnum); 54 | return true; 55 | } 56 | 57 | bool Item::setItemNum(int newnum) { 58 | num = newnum; 59 | return true; 60 | } 61 | 62 | string Bill::getBillUser(void) { 63 | return user; 64 | } 65 | int Bill::getBillTotalNum(void) { 66 | int totalNum = 1; 67 | Bill* temp = next; 68 | while (temp != NULL) { 69 | totalNum++; 70 | temp = temp->next; 71 | } 72 | return totalNum; 73 | } 74 | Bill* Bill::getBillNext(void) { 75 | return next; 76 | } 77 | bool Bill::setBillNext(Bill* bill) { 78 | next = bill; 79 | return true; 80 | } 81 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showlistview.cpp: -------------------------------------------------------------------------------- 1 | #include "showlistview.h" 2 | #include "ui_showlistview.h" 3 | 4 | ShowListView::ShowListView(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::ShowListView) 7 | { 8 | ui->setupUi(this); 9 | 10 | FileCtrl* file = new FileCtrl(string(LISTFILENAME), string(LISTFILENAME)); 11 | Bill* bill = file->getAllBills(); 12 | 13 | ui->tableView->setShowGrid(true); 14 | 15 | ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); 16 | 17 | model = new QStandardItemModel(); 18 | QStringList labels = QObject::tr("ID, name, label, price, num, user").simplified().split(","); 19 | model->setHorizontalHeaderLabels(labels); 20 | ui->tableView->setModel(model); 21 | 22 | for (int i = 0; i < bill->getBillTotalNum(); i++) { 23 | if (bill != NULL) { 24 | for(int i = 0; i < bill->getBillTotalNum(); i++){ 25 | model->setItem(i, 0, new QStandardItem(QString::fromStdString(bill->getItemID()))); 26 | model->setItem(i, 1, new QStandardItem(QString::fromStdString(bill->getItemName()))); 27 | model->setItem(i, 2, new QStandardItem(QString::fromStdString(bill->getItemLabel()))); 28 | model->setItem(i, 3, new QStandardItem(QString::number(bill->getItemPrice()))); 29 | model->setItem(i, 4, new QStandardItem(QString::number(bill->getItemNum()))); 30 | model->setItem(i, 5, new QStandardItem(QString::fromStdString(bill->getBillUser()))); 31 | bill = bill->getBillNext(); 32 | } 33 | } 34 | } 35 | 36 | ui->tableView->show(); 37 | delete(file); 38 | } 39 | 40 | ShowListView::~ShowListView() 41 | { 42 | delete ui; 43 | } 44 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/View/menu.h: -------------------------------------------------------------------------------- 1 | #ifndef MENU 2 | #define MENU 3 | 4 | #include "../setting.h" 5 | #include "../const.h" 6 | 7 | #include "../Controller/userctrl.h" 8 | #include "../Controller/itemctrl.h" 9 | #include "../Controller/cartctrl.h" 10 | 11 | #include 12 | #include 13 | using namespace std; 14 | 15 | class Menu{ 16 | public: 17 | Menu(); 18 | void showWelcome(void); 19 | bool loginMenu(void); 20 | bool mainMenu(void); 21 | 22 | private: 23 | void showUserLoginMainMenu(void); 24 | int requestInput(void); 25 | 26 | void theUserRegisterMenu(void); 27 | void theUserLoginMenu(void); 28 | void theAdminLoginMenu(void); 29 | 30 | void showUsernameUsedMenu(void); 31 | void showUsernameUnusedMenu(void); 32 | void showPasswordUnvalidMenu(void); 33 | void showUserWelcome(void); 34 | 35 | bool userMainMenu(void); 36 | bool adminMainMenu(void); 37 | 38 | void showItemsList(void); 39 | void showItemsList(ItemCtrl* tarItem); 40 | void showUserMainMenu(void); 41 | void showAdminMainMenu(void); 42 | 43 | string getUserName(void); 44 | string getUserPassword(void); 45 | 46 | void searchItemMenu(void); 47 | string requestItemID(void); 48 | string requestItemName(void); 49 | string requestItemLabel(void); 50 | float requestItemPrice(void); 51 | int requestItemNum(void); 52 | 53 | void showSoldMenu(void); 54 | 55 | void addItemMenu(void); 56 | void delItemMenu(void); 57 | void addItemNumMenu(void); 58 | void showAddItemNumMenu(void); 59 | 60 | void addItemToCartMenu(void); 61 | void delItemFromCartMenu(void); 62 | void showItemCartMenu(void); 63 | void buyItemMenu(void); 64 | 65 | void showItemNotFoundMenu(void); 66 | 67 | 68 | bool reloadItemCtrl(void); 69 | ItemCtrl* itemctrl; 70 | UserCtrl* userctrl; 71 | CartCtrl* cartctrl; 72 | int cmd; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/README.md: -------------------------------------------------------------------------------- 1 | # 网点购物管理系统 2 | 3 | ----- 4 | 5 | ## 实现功能 6 | 7 | ### 管理员功能 8 | 9 | * 管理员登录、注销 10 | 11 | * 商品系统信息查询 12 | 13 | * 商品增加、修改、删除 14 | 15 | * 售出清单查看 16 | 17 | ### 用户功能 18 | 19 | * 登录、注册、注销 20 | * 查看商品 21 | * 商品搜索 22 | * 查看购物车、添加商品至购物车、删除购物车商品 23 | * 结账,完成购物 24 | 25 | ## 程序架构 26 | 27 | ### Model 28 | 29 | * User:负责用户信息的存储,更改 30 | * Item:负责商品信息的存储,更改 31 | * Bill:负责交易信息的存储,更改 32 | 33 | ### Presenter 34 | 35 | * CartCtrl:购物车控制器,负责对购物车信息的控制 36 | * ItemCtrl:商品控制器,负责对商品信息的控制 37 | * UserCtrl:用户控制器,负责对用户信息的控制 38 | * FileCtrl:文件控制器,负责文件的读写 39 | 40 | ### View 41 | 42 | * v1.0:命令行视图 43 | * v2.0:基于Qt的GUI 44 | 45 | 46 | ## 程序展示 47 | 48 | ### 用户视图 49 | 50 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/logindialog.png) 51 | 52 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/userhasbenused.png) 53 | 54 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/cantregisteradmin.png) 55 | 56 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/usermainwindow.png) 57 | 58 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/addtocart.png) 59 | 60 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/cart.png) 61 | 62 | ### 管理员视图 63 | 64 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/adminmainwindow.png) 65 | 66 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/additemnum.png) 67 | 68 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/logindialog.png) 69 | 70 | ![additemnum](https://github.com/idealclover/NJU-Homework/raw/master/17-18%20下%20程序设计基础实验/项目一%20网店购物管理系统/Pics/list.png) -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showlistview.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ShowListView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 933 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 830 20 | 20 21 | 81 22 | 241 23 | 24 | 25 | 26 | Qt::Vertical 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 0 36 | 0 37 | 801 38 | 301 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | buttonBox 47 | accepted() 48 | ShowListView 49 | accept() 50 | 51 | 52 | 248 53 | 254 54 | 55 | 56 | 157 57 | 274 58 | 59 | 60 | 61 | 62 | buttonBox 63 | rejected() 64 | ShowListView 65 | reject() 66 | 67 | 68 | 316 69 | 260 70 | 71 | 72 | 286 73 | 274 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/userctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "userctrl.h" 2 | 3 | UserCtrl::UserCtrl() { 4 | usertype = ANOMY; 5 | user = NULL; 6 | } 7 | 8 | int UserCtrl::authUser(string username, string password) { 9 | 10 | ///* Version 0.01 11 | // * Auth: idealclover 12 | // * Time: 04/08/2018 13 | // * a total fake authuser function 14 | // */ 15 | // if(username == "clover" && password == "clover") return 1; 16 | // else if (username == "clover" && password != "clover") return PASSWORD_NOTVALID; 17 | // else return USERNAME_UNUSED; 18 | // 19 | 20 | int userNum = searchUserInFile(username, string(USERFILENAME)); 21 | if (userNum == USERNAME_UNUSED) { 22 | return USERNAME_UNUSED; 23 | } 24 | else if (matchUserPassword(username, password, string(USERFILENAME))) { 25 | usertype = USER; 26 | user = new User(userNum, username); 27 | return userNum; 28 | } 29 | else return PASSWORD_NOTVALID; 30 | 31 | } 32 | int UserCtrl::authAdmin(string username, string password) { 33 | int userNum = searchUserInFile(username, string(ADMINFILENAME)); 34 | if (userNum == USERNAME_UNUSED) { 35 | return USERNAME_UNUSED; 36 | } 37 | if (matchUserPassword(username, password, string(ADMINFILENAME))) { 38 | usertype = ADMIN; 39 | user = new User(userNum, username); 40 | return userNum; 41 | } 42 | else return PASSWORD_NOTVALID; 43 | } 44 | 45 | string UserCtrl::getName(void) { 46 | return user->getUsername(); 47 | } 48 | USERTYPE UserCtrl::getUserType(void) { 49 | return usertype; 50 | } 51 | 52 | int UserCtrl::searchUserInFile(string username, string file) { 53 | //if (username == "clover") return 1; 54 | //else return USERNAME_UNUSED; 55 | FileCtrl ifile(file, file); 56 | return ifile.searchUserInFile(username); 57 | } 58 | bool UserCtrl::matchUserPassword(string username, string password, string file) { 59 | FileCtrl ifile(file, file); 60 | return ifile.matchUserPassword(username, password); 61 | } 62 | 63 | bool UserCtrl::addNewUser(string username, string password) { 64 | if (searchUserInFile(username, USERFILENAME) != USERNAME_UNUSED) return false; 65 | FileCtrl ifile(string(USERFILENAME), string(USERFILENAME)); 66 | ifile.addUser(username, password); 67 | return true; 68 | } -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/userctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "userctrl.h" 2 | 3 | UserCtrl::UserCtrl() { 4 | usertype = ANOMY; 5 | user = NULL; 6 | } 7 | 8 | int UserCtrl::authUser(string username, string password) { 9 | 10 | ///* Version 0.01 11 | // * Auth: idealclover 12 | // * Time: 04/08/2018 13 | // * a total fake authuser function 14 | // */ 15 | // if(username == "clover" && password == "clover") return 1; 16 | // else if (username == "clover" && password != "clover") return PASSWORD_NOTVALID; 17 | // else return USERNAME_UNUSED; 18 | // 19 | 20 | int userNum = searchUserInFile(username, string(USERFILENAME)); 21 | if (userNum == USERNAME_UNUSED) { 22 | return USERNAME_UNUSED; 23 | } 24 | else if (matchUserPassword(username, password, string(USERFILENAME))) { 25 | usertype = USER; 26 | user = new User(userNum, username); 27 | return userNum; 28 | } 29 | else return PASSWORD_NOTVALID; 30 | 31 | } 32 | int UserCtrl::authAdmin(string username, string password) { 33 | int userNum = searchUserInFile(username, string(ADMINFILENAME)); 34 | if (userNum == USERNAME_UNUSED) { 35 | return USERNAME_UNUSED; 36 | } 37 | if (matchUserPassword(username, password, string(ADMINFILENAME))) { 38 | usertype = ADMIN; 39 | user = new User(userNum, username); 40 | return userNum; 41 | } 42 | else return PASSWORD_NOTVALID; 43 | } 44 | 45 | string UserCtrl::getName(void) { 46 | return user->getUsername(); 47 | } 48 | USERTYPE UserCtrl::getUserType(void) { 49 | return usertype; 50 | } 51 | 52 | int UserCtrl::searchUserInFile(string username, string file) { 53 | //if (username == "clover") return 1; 54 | //else return USERNAME_UNUSED; 55 | FileCtrl ifile(file, file); 56 | return ifile.searchUserInFile(username); 57 | } 58 | bool UserCtrl::matchUserPassword(string username, string password, string file) { 59 | FileCtrl ifile(file, file); 60 | return ifile.matchUserPassword(username, password); 61 | } 62 | 63 | bool UserCtrl::addNewUser(string username, string password) { 64 | if (searchUserInFile(username, USERFILENAME) != USERNAME_UNUSED) return false; 65 | FileCtrl ifile(string(USERFILENAME), string(USERFILENAME)); 66 | ifile.addUser(username, password); 67 | return true; 68 | } -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/TaoBao.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2018-04-17T15:32:42 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = TaoBao 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which has been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | 26 | SOURCES += \ 27 | main.cpp \ 28 | mainwindow.cpp \ 29 | View/logindlg.cpp \ 30 | Model/item.cpp \ 31 | Model/user.cpp \ 32 | Controller/cartctrl.cpp \ 33 | Controller/filectrl.cpp \ 34 | Controller/itemctrl.cpp \ 35 | Controller/userctrl.cpp \ 36 | View/usermainwindow.cpp \ 37 | View/addtocartview.cpp \ 38 | View/showcart.cpp \ 39 | View/adminmainwindow.cpp \ 40 | View/showlistview.cpp \ 41 | View/additemview.cpp 42 | 43 | HEADERS += \ 44 | mainwindow.h \ 45 | View/logindlg.h \ 46 | Model/item.h \ 47 | Model/user.h \ 48 | Controller/cartctrl.h \ 49 | Controller/filectrl.h \ 50 | Controller/itemctrl.h \ 51 | Controller/userctrl.h \ 52 | const.h \ 53 | setting.h \ 54 | View/usermainwindow.h \ 55 | View/addtocartview.h \ 56 | View/showcart.h \ 57 | View/adminmainwindow.h \ 58 | View/showlistview.h \ 59 | View/additemview.h 60 | 61 | FORMS += \ 62 | mainwindow.ui \ 63 | View/logindlg.ui \ 64 | View/usermainwindow.ui \ 65 | View/addtocartview.ui \ 66 | View/showcart.ui \ 67 | View/adminmainwindow.ui \ 68 | View/showlistview.ui \ 69 | View/additemview.ui 70 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/usermainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | UserMainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 782 10 | 600 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 30 22 | 781 23 | 481 24 | 25 | 26 | 27 | 28 | 29 | 30 | 140 31 | 530 32 | 531 33 | 31 34 | 35 | 36 | 37 | Qt::Horizontal 38 | 39 | 40 | 41 | Add to cart 42 | 43 | 44 | 45 | 46 | View cart 47 | 48 | 49 | 50 | 51 | logout 52 | 53 | 54 | 55 | 56 | Exit 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | exitBtn 67 | clicked() 68 | UserMainWindow 69 | close() 70 | 71 | 72 | 606 73 | 541 74 | 75 | 76 | 711 77 | 519 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showcart.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ShowCart 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1061 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 0 20 | 0 21 | 881 22 | 301 23 | 24 | 25 | 26 | 27 | 28 | 29 | 910 30 | 20 31 | 131 32 | 81 33 | 34 | 35 | 36 | Qt::Vertical 37 | 38 | 39 | 40 | Buy All 41 | 42 | 43 | 44 | 45 | Delete 46 | 47 | 48 | 49 | 50 | Exit 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | buyBtn 59 | clicked() 60 | ShowCart 61 | accept() 62 | 63 | 64 | 956 65 | 38 66 | 67 | 68 | 996 69 | 9 70 | 71 | 72 | 73 | 74 | exitBtn 75 | clicked() 76 | ShowCart 77 | exec() 78 | 79 | 80 | 967 81 | 96 82 | 83 | 84 | 1001 85 | 128 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_showlistview.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'showlistview.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_SHOWLISTVIEW_H 10 | #define UI_SHOWLISTVIEW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Ui_ShowListView 24 | { 25 | public: 26 | QDialogButtonBox *buttonBox; 27 | QTableView *tableView; 28 | 29 | void setupUi(QDialog *ShowListView) 30 | { 31 | if (ShowListView->objectName().isEmpty()) 32 | ShowListView->setObjectName(QStringLiteral("ShowListView")); 33 | ShowListView->resize(933, 300); 34 | buttonBox = new QDialogButtonBox(ShowListView); 35 | buttonBox->setObjectName(QStringLiteral("buttonBox")); 36 | buttonBox->setGeometry(QRect(830, 20, 81, 241)); 37 | buttonBox->setOrientation(Qt::Vertical); 38 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); 39 | tableView = new QTableView(ShowListView); 40 | tableView->setObjectName(QStringLiteral("tableView")); 41 | tableView->setGeometry(QRect(0, 0, 801, 301)); 42 | 43 | retranslateUi(ShowListView); 44 | QObject::connect(buttonBox, SIGNAL(accepted()), ShowListView, SLOT(accept())); 45 | QObject::connect(buttonBox, SIGNAL(rejected()), ShowListView, SLOT(reject())); 46 | 47 | QMetaObject::connectSlotsByName(ShowListView); 48 | } // setupUi 49 | 50 | void retranslateUi(QDialog *ShowListView) 51 | { 52 | ShowListView->setWindowTitle(QApplication::translate("ShowListView", "Dialog", nullptr)); 53 | } // retranslateUi 54 | 55 | }; 56 | 57 | namespace Ui { 58 | class ShowListView: public Ui_ShowListView {}; 59 | } // namespace Ui 60 | 61 | QT_END_NAMESPACE 62 | 63 | #endif // UI_SHOWLISTVIEW_H 64 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/addtocartview.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AddToCartView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 160 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 30 20 | 120 21 | 341 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 60 36 | 30 37 | 271 38 | 80 39 | 40 | 41 | 42 | 43 | 44 | 45 | 请选择添加的数量 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | buttonBox 59 | accepted() 60 | AddToCartView 61 | accept() 62 | 63 | 64 | 248 65 | 134 66 | 67 | 68 | 157 69 | 159 70 | 71 | 72 | 73 | 74 | buttonBox 75 | rejected() 76 | AddToCartView 77 | reject() 78 | 79 | 80 | 316 81 | 140 82 | 83 | 84 | 286 85 | 159 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/adminmainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AdminMainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 753 10 | 512 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 801 23 | 411 24 | 25 | 26 | 27 | 28 | 29 | 30 | 41 31 | 443 32 | 681 33 | 31 34 | 35 | 36 | 37 | Qt::Horizontal 38 | 39 | 40 | 41 | Add 42 | 43 | 44 | 45 | 46 | Delete 47 | 48 | 49 | 50 | 51 | List 52 | 53 | 54 | 55 | 56 | Logout 57 | 58 | 59 | 60 | 61 | Exit 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | exitBtn 72 | clicked() 73 | AdminMainWindow 74 | close() 75 | 76 | 77 | 545 78 | 459 79 | 80 | 81 | 585 82 | 473 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/showcart.cpp: -------------------------------------------------------------------------------- 1 | #include "showcart.h" 2 | #include "ui_showcart.h" 3 | #include 4 | 5 | ShowCart::ShowCart(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::ShowCart) 8 | { 9 | ui->setupUi(this); 10 | 11 | 12 | } 13 | 14 | void ShowCart::init(CartCtrl* ncartctrl,UserCtrl* nuserctrl, ItemCtrl* nitemctrl){ 15 | //tableView****************************************************************** 16 | //int width = this->width(); 17 | //int height = this->height(); 18 | //ui->tableView->resize(width,height); 19 | 20 | ui->tableView->setShowGrid(true); 21 | 22 | ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); 23 | 24 | model = new QStandardItemModel(); 25 | QStringList labels = QObject::tr("ID, name, label, price, num").simplified().split(","); 26 | model->setHorizontalHeaderLabels(labels); 27 | ui->tableView->setModel(model); 28 | 29 | cartctrl = ncartctrl; 30 | itemctrl = nitemctrl; 31 | userctrl = nuserctrl; 32 | 33 | ItemCtrl* titemctrl = cartctrl->cart; 34 | titemctrl->readItemFromFile(MAXSHOWITEM,cartctrl->getFileName()); 35 | int j = 0; 36 | for(int i = 0; i < titemctrl->getItemTotalNum(); i++){ 37 | if(titemctrl->getItemNum(i) == -1 || titemctrl->getItemNum(i) == 0) continue; 38 | model->setItem(j, 0, new QStandardItem(QString::fromStdString(titemctrl->getItemID(i)))); 39 | model->setItem(j, 1, new QStandardItem(QString::fromStdString(titemctrl->getItemName(i)))); 40 | model->setItem(j, 2, new QStandardItem(QString::fromStdString(titemctrl->getItemLabel(i)))); 41 | model->setItem(j, 3, new QStandardItem(QString::number(titemctrl->getItemPrice(i)))); 42 | model->setItem(j, 4, new QStandardItem(QString::number(titemctrl->getItemNum(i)))); 43 | j++; 44 | } 45 | 46 | ui->tableView->show(); 47 | } 48 | 49 | ShowCart::~ShowCart() 50 | { 51 | delete ui; 52 | } 53 | 54 | void ShowCart::on_delBtn_clicked() 55 | { 56 | string targetID = cartctrl->cart->getItemID(ui->tableView->currentIndex().row()); 57 | cartctrl->cart->delItem(targetID); 58 | model->removeRows(ui->tableView->currentIndex().row(),1); 59 | } 60 | 61 | void ShowCart::on_buyBtn_clicked() 62 | { 63 | QMessageBox message(QMessageBox::Warning,"Information",tr("Total cost: %1, sure to buy?").arg(cartctrl->cart->getTotalPrice()) 64 | ,QMessageBox::Yes|QMessageBox::No,NULL); 65 | if (message.exec()==QMessageBox::Yes) { 66 | cartctrl->buyItem(itemctrl,userctrl->getName()); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/logindlg.cpp: -------------------------------------------------------------------------------- 1 | #include "logindlg.h" 2 | #include "ui_logindlg.h" 3 | #include 4 | 5 | LoginDlg::LoginDlg(QWidget *parent) : 6 | QDialog(parent), 7 | ui(new Ui::LoginDlg) 8 | { 9 | userctrl = new UserCtrl(); 10 | ui->setupUi(this); 11 | } 12 | 13 | LoginDlg::~LoginDlg() 14 | { 15 | delete ui; 16 | } 17 | 18 | void LoginDlg::senduserctrl(void){ 19 | emit sendUserCtrl(userctrl); 20 | } 21 | 22 | void LoginDlg::on_loginButton_clicked() 23 | { 24 | isAdmin = ui->isAdminCheckBox->checkState(); 25 | isNewUser = ui->isNewUserCheckBox->checkState(); 26 | if(isNewUser && isAdmin){ 27 | QMessageBox::warning(this, tr("Waring"), 28 | tr("can't register admin!"), 29 | QMessageBox::Yes); 30 | } 31 | else if(isNewUser){ 32 | if (userctrl->addNewUser(ui->usrLineEdit->text().toStdString(), ui->pwdLineEdit->text().toStdString()) == false) { 33 | QMessageBox::warning(this, tr("Waring"), 34 | tr("user name has been used!"), 35 | QMessageBox::Yes); 36 | }else{ 37 | userctrl->authUser(ui->usrLineEdit->text().toStdString(), ui->pwdLineEdit->text().toStdString()); 38 | accept(); 39 | } 40 | } 41 | else if(isAdmin){ 42 | int rst = userctrl->authAdmin(ui->usrLineEdit->text().toStdString(), ui->pwdLineEdit->text().toStdString()); 43 | switch (rst) { 44 | case USERNAME_UNUSED: 45 | QMessageBox::warning(this, tr("Waring"), 46 | tr("user name unused!"), 47 | QMessageBox::Yes); 48 | break; 49 | case PASSWORD_NOTVALID: 50 | QMessageBox::warning(this, tr("Waring"), 51 | tr("user name or password error!"), 52 | QMessageBox::Yes); 53 | break; 54 | default: 55 | accept(); 56 | } 57 | }else{ 58 | int rst = userctrl->authUser(ui->usrLineEdit->text().toStdString(), ui->pwdLineEdit->text().toStdString()); 59 | switch (rst) { 60 | case USERNAME_UNUSED: 61 | QMessageBox::warning(this, tr("Waring"), 62 | tr("user name unused!"), 63 | QMessageBox::Yes); 64 | break; 65 | case PASSWORD_NOTVALID: 66 | QMessageBox::warning(this, tr("Waring"), 67 | tr("user name or password error!"), 68 | QMessageBox::Yes); 69 | break; 70 | default: 71 | accept(); 72 | } 73 | } 74 | //accept(); 75 | } 76 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_mainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'mainwindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_MAINWINDOW_H 10 | #define UI_MAINWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_MainWindow 27 | { 28 | public: 29 | QWidget *centralWidget; 30 | QPushButton *pushButton; 31 | QMenuBar *menuBar; 32 | QToolBar *mainToolBar; 33 | QStatusBar *statusBar; 34 | 35 | void setupUi(QMainWindow *MainWindow) 36 | { 37 | if (MainWindow->objectName().isEmpty()) 38 | MainWindow->setObjectName(QStringLiteral("MainWindow")); 39 | MainWindow->resize(400, 300); 40 | centralWidget = new QWidget(MainWindow); 41 | centralWidget->setObjectName(QStringLiteral("centralWidget")); 42 | pushButton = new QPushButton(centralWidget); 43 | pushButton->setObjectName(QStringLiteral("pushButton")); 44 | pushButton->setGeometry(QRect(120, 180, 80, 15)); 45 | MainWindow->setCentralWidget(centralWidget); 46 | menuBar = new QMenuBar(MainWindow); 47 | menuBar->setObjectName(QStringLiteral("menuBar")); 48 | menuBar->setGeometry(QRect(0, 0, 400, 17)); 49 | MainWindow->setMenuBar(menuBar); 50 | mainToolBar = new QToolBar(MainWindow); 51 | mainToolBar->setObjectName(QStringLiteral("mainToolBar")); 52 | MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); 53 | statusBar = new QStatusBar(MainWindow); 54 | statusBar->setObjectName(QStringLiteral("statusBar")); 55 | MainWindow->setStatusBar(statusBar); 56 | 57 | retranslateUi(MainWindow); 58 | 59 | QMetaObject::connectSlotsByName(MainWindow); 60 | } // setupUi 61 | 62 | void retranslateUi(QMainWindow *MainWindow) 63 | { 64 | MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr)); 65 | pushButton->setText(QString()); 66 | } // retranslateUi 67 | 68 | }; 69 | 70 | namespace Ui { 71 | class MainWindow: public Ui_MainWindow {}; 72 | } // namespace Ui 73 | 74 | QT_END_NAMESPACE 75 | 76 | #endif // UI_MAINWINDOW_H 77 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_showcart.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'showcart.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_SHOWCART_H 10 | #define UI_SHOWCART_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | QT_BEGIN_NAMESPACE 23 | 24 | class Ui_ShowCart 25 | { 26 | public: 27 | QTableView *tableView; 28 | QSplitter *splitter; 29 | QPushButton *buyBtn; 30 | QPushButton *delBtn; 31 | QPushButton *exitBtn; 32 | 33 | void setupUi(QDialog *ShowCart) 34 | { 35 | if (ShowCart->objectName().isEmpty()) 36 | ShowCart->setObjectName(QStringLiteral("ShowCart")); 37 | ShowCart->resize(1061, 300); 38 | tableView = new QTableView(ShowCart); 39 | tableView->setObjectName(QStringLiteral("tableView")); 40 | tableView->setGeometry(QRect(0, 0, 881, 301)); 41 | splitter = new QSplitter(ShowCart); 42 | splitter->setObjectName(QStringLiteral("splitter")); 43 | splitter->setGeometry(QRect(910, 20, 131, 81)); 44 | splitter->setOrientation(Qt::Vertical); 45 | buyBtn = new QPushButton(splitter); 46 | buyBtn->setObjectName(QStringLiteral("buyBtn")); 47 | splitter->addWidget(buyBtn); 48 | delBtn = new QPushButton(splitter); 49 | delBtn->setObjectName(QStringLiteral("delBtn")); 50 | splitter->addWidget(delBtn); 51 | exitBtn = new QPushButton(splitter); 52 | exitBtn->setObjectName(QStringLiteral("exitBtn")); 53 | splitter->addWidget(exitBtn); 54 | 55 | retranslateUi(ShowCart); 56 | QObject::connect(buyBtn, SIGNAL(clicked()), ShowCart, SLOT(accept())); 57 | QObject::connect(exitBtn, SIGNAL(clicked()), ShowCart, SLOT(exec())); 58 | 59 | QMetaObject::connectSlotsByName(ShowCart); 60 | } // setupUi 61 | 62 | void retranslateUi(QDialog *ShowCart) 63 | { 64 | ShowCart->setWindowTitle(QApplication::translate("ShowCart", "Dialog", nullptr)); 65 | buyBtn->setText(QApplication::translate("ShowCart", "Buy All", nullptr)); 66 | delBtn->setText(QApplication::translate("ShowCart", "Delete", nullptr)); 67 | exitBtn->setText(QApplication::translate("ShowCart", "Exit", nullptr)); 68 | } // retranslateUi 69 | 70 | }; 71 | 72 | namespace Ui { 73 | class ShowCart: public Ui_ShowCart {}; 74 | } // namespace Ui 75 | 76 | QT_END_NAMESPACE 77 | 78 | #endif // UI_SHOWCART_H 79 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/adminmainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "adminmainwindow.h" 2 | #include "ui_adminmainwindow.h" 3 | 4 | AdminMainWindow::AdminMainWindow(QWidget *parent) : 5 | QMainWindow(parent), 6 | ui(new Ui::AdminMainWindow) 7 | { 8 | ui->setupUi(this); 9 | 10 | 11 | //tableView****************************************************************** 12 | 13 | ui->tableView->setShowGrid(true); 14 | 15 | ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); 16 | 17 | model = new QStandardItemModel(); 18 | QStringList labels = QObject::tr("ID, name, label, price, num").simplified().split(","); 19 | model->setHorizontalHeaderLabels(labels); 20 | ui->tableView->setModel(model); 21 | 22 | itemctrl = new ItemCtrl(); 23 | itemctrl->readItemFromFile(MAXSHOWITEM,string(ITEMFILENAME)); 24 | int j = 0; 25 | for(int i = 0; i < itemctrl->getItemTotalNum(); i++){ 26 | if(itemctrl->getItemNum(i) == -1) continue; 27 | model->setItem(j, 0, new QStandardItem(QString::fromStdString(itemctrl->getItemID(i)))); 28 | model->setItem(j, 1, new QStandardItem(QString::fromStdString(itemctrl->getItemName(i)))); 29 | model->setItem(j, 2, new QStandardItem(QString::fromStdString(itemctrl->getItemLabel(i)))); 30 | model->setItem(j, 3, new QStandardItem(QString::number(itemctrl->getItemPrice(i)))); 31 | model->setItem(j, 4, new QStandardItem(QString::number(itemctrl->getItemNum(i)))); 32 | j++; 33 | } 34 | 35 | ui->tableView->show(); 36 | } 37 | 38 | AdminMainWindow::~AdminMainWindow() 39 | { 40 | delete ui; 41 | } 42 | 43 | void AdminMainWindow::on_showListBtn_clicked() 44 | { 45 | ShowListView listview; 46 | listview.show(); 47 | listview.exec(); 48 | } 49 | 50 | void AdminMainWindow::on_delBtn_clicked() 51 | { 52 | string targetID = itemctrl->getItemID(ui->tableView->currentIndex().row()); 53 | itemctrl->delItem(targetID); 54 | model->removeRows(ui->tableView->currentIndex().row(),1); 55 | } 56 | 57 | void AdminMainWindow::on_addBtn_clicked() 58 | { 59 | AddItemView additemview; 60 | additemview.show(); 61 | if(additemview.exec()== QDialog::Accepted){ 62 | itemctrl->addNewItem(additemview.name, additemview.label, additemview.price, additemview.num); 63 | refresh(); 64 | } 65 | } 66 | 67 | void AdminMainWindow::refresh(){ 68 | delete(itemctrl); 69 | model->removeRows(0, model->rowCount()); 70 | itemctrl = new ItemCtrl(); 71 | itemctrl->readItemFromFile(MAXSHOWITEM,string(ITEMFILENAME)); 72 | int j = 0; 73 | for(int i = 0; i < itemctrl->getItemTotalNum(); i++){ 74 | if(itemctrl->getItemNum(i) == -1) continue; 75 | model->setItem(j, 0, new QStandardItem(QString::fromStdString(itemctrl->getItemID(i)))); 76 | model->setItem(j, 1, new QStandardItem(QString::fromStdString(itemctrl->getItemName(i)))); 77 | model->setItem(j, 2, new QStandardItem(QString::fromStdString(itemctrl->getItemLabel(i)))); 78 | model->setItem(j, 3, new QStandardItem(QString::number(itemctrl->getItemPrice(i)))); 79 | model->setItem(j, 4, new QStandardItem(QString::number(itemctrl->getItemNum(i)))); 80 | j++; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_addtocartview.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'addtocartview.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_ADDTOCARTVIEW_H 10 | #define UI_ADDTOCARTVIEW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_AddToCartView 27 | { 28 | public: 29 | QDialogButtonBox *buttonBox; 30 | QWidget *horizontalLayoutWidget; 31 | QHBoxLayout *horizontalLayout; 32 | QLabel *label; 33 | QSpinBox *addNumSpinBox; 34 | 35 | void setupUi(QDialog *AddToCartView) 36 | { 37 | if (AddToCartView->objectName().isEmpty()) 38 | AddToCartView->setObjectName(QStringLiteral("AddToCartView")); 39 | AddToCartView->resize(400, 160); 40 | buttonBox = new QDialogButtonBox(AddToCartView); 41 | buttonBox->setObjectName(QStringLiteral("buttonBox")); 42 | buttonBox->setGeometry(QRect(30, 120, 341, 32)); 43 | buttonBox->setOrientation(Qt::Horizontal); 44 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); 45 | horizontalLayoutWidget = new QWidget(AddToCartView); 46 | horizontalLayoutWidget->setObjectName(QStringLiteral("horizontalLayoutWidget")); 47 | horizontalLayoutWidget->setGeometry(QRect(60, 30, 271, 80)); 48 | horizontalLayout = new QHBoxLayout(horizontalLayoutWidget); 49 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 50 | horizontalLayout->setContentsMargins(0, 0, 0, 0); 51 | label = new QLabel(horizontalLayoutWidget); 52 | label->setObjectName(QStringLiteral("label")); 53 | 54 | horizontalLayout->addWidget(label); 55 | 56 | addNumSpinBox = new QSpinBox(horizontalLayoutWidget); 57 | addNumSpinBox->setObjectName(QStringLiteral("addNumSpinBox")); 58 | 59 | horizontalLayout->addWidget(addNumSpinBox); 60 | 61 | 62 | retranslateUi(AddToCartView); 63 | QObject::connect(buttonBox, SIGNAL(accepted()), AddToCartView, SLOT(accept())); 64 | QObject::connect(buttonBox, SIGNAL(rejected()), AddToCartView, SLOT(reject())); 65 | 66 | QMetaObject::connectSlotsByName(AddToCartView); 67 | } // setupUi 68 | 69 | void retranslateUi(QDialog *AddToCartView) 70 | { 71 | AddToCartView->setWindowTitle(QApplication::translate("AddToCartView", "Dialog", nullptr)); 72 | label->setText(QApplication::translate("AddToCartView", "\350\257\267\351\200\211\346\213\251\346\267\273\345\212\240\347\232\204\346\225\260\351\207\217", nullptr)); 73 | } // retranslateUi 74 | 75 | }; 76 | 77 | namespace Ui { 78 | class AddToCartView: public Ui_AddToCartView {}; 79 | } // namespace Ui 80 | 81 | QT_END_NAMESPACE 82 | 83 | #endif // UI_ADDTOCARTVIEW_H 84 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/additemview.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AddItemView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 191 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 20 | 150 21 | 341 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 30 36 | 20 37 | 331 38 | 111 39 | 40 | 41 | 42 | 43 | 44 | 45 | Name 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Label 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Price 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Number 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | buttonBox 89 | accepted() 90 | AddItemView 91 | accept() 92 | 93 | 94 | 238 95 | 164 96 | 97 | 98 | 157 99 | 190 100 | 101 | 102 | 103 | 104 | buttonBox 105 | rejected() 106 | AddItemView 107 | reject() 108 | 109 | 110 | 306 111 | 170 112 | 113 | 114 | 286 115 | 190 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Taobao.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {7e55c9f4-b2ee-441b-bfb4-b1f127b65939} 18 | 19 | 20 | {89856f8e-90be-4157-94db-1dd8474c2f41} 21 | 22 | 23 | {8b6e6795-044a-46a1-8dc8-b2a35d04b510} 24 | 25 | 26 | {6eaa2acc-8bfe-45bb-a73e-cd9fde253b50} 27 | 28 | 29 | {ea33095c-b8d4-4d9c-a4c5-504d39d77aa0} 30 | 31 | 32 | {28c478f4-207e-4912-a18a-270d7dde7269} 33 | 34 | 35 | 36 | 37 | 源文件 38 | 39 | 40 | 源文件\View 41 | 42 | 43 | 源文件\Controller 44 | 45 | 46 | 源文件\Model 47 | 48 | 49 | 源文件\Model 50 | 51 | 52 | 源文件\Controller 53 | 54 | 55 | 源文件\Controller 56 | 57 | 58 | 源文件\Controller 59 | 60 | 61 | 62 | 63 | 头文件 64 | 65 | 66 | 头文件\View 67 | 68 | 69 | 头文件 70 | 71 | 72 | 头文件\Controller 73 | 74 | 75 | 头文件\Model 76 | 77 | 78 | 头文件\Model 79 | 80 | 81 | 头文件\Controller 82 | 83 | 84 | 头文件\Controller 85 | 86 | 87 | 头文件\Controller 88 | 89 | 90 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/logindlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LoginDlg 4 | 5 | 6 | 7 | 0 8 | 0 9 | 481 10 | 239 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 50 20 | 40 21 | 381 22 | 71 23 | 24 | 25 | 26 | 27 | 28 | 29 | Username 30 | 31 | 32 | 33 | 34 | 35 | 36 | Password 37 | 38 | 39 | 40 | 41 | 42 | 43 | QLineEdit::Password 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 340 56 | 180 57 | 91 58 | 41 59 | 60 | 61 | 62 | Exit 63 | 64 | 65 | 66 | 67 | 68 | 50 69 | 180 70 | 91 71 | 41 72 | 73 | 74 | 75 | Login 76 | 77 | 78 | 79 | 80 | 81 | 350 82 | 130 83 | 81 84 | 21 85 | 86 | 87 | 88 | Admin 89 | 90 | 91 | 92 | 93 | 94 | 50 95 | 130 96 | 121 97 | 21 98 | 99 | 100 | 101 | New user 102 | 103 | 104 | 105 | 106 | usrLineEdit 107 | pwdLineEdit 108 | isAdminCheckBox 109 | loginButton 110 | exitButton 111 | 112 | 113 | 114 | 115 | exitButton 116 | clicked() 117 | LoginDlg 118 | close() 119 | 120 | 121 | 194 122 | 128 123 | 124 | 125 | 215 126 | 101 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_usermainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'usermainwindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_USERMAINWINDOW_H 10 | #define UI_USERMAINWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_UserMainWindow 27 | { 28 | public: 29 | QWidget *centralwidget; 30 | QTableView *tableView; 31 | QSplitter *splitter; 32 | QPushButton *AddToCartBtn; 33 | QPushButton *seeCartBtn; 34 | QPushButton *logOutBtn; 35 | QPushButton *exitBtn; 36 | QStatusBar *statusbar; 37 | 38 | void setupUi(QMainWindow *UserMainWindow) 39 | { 40 | if (UserMainWindow->objectName().isEmpty()) 41 | UserMainWindow->setObjectName(QStringLiteral("UserMainWindow")); 42 | UserMainWindow->resize(782, 600); 43 | centralwidget = new QWidget(UserMainWindow); 44 | centralwidget->setObjectName(QStringLiteral("centralwidget")); 45 | tableView = new QTableView(centralwidget); 46 | tableView->setObjectName(QStringLiteral("tableView")); 47 | tableView->setGeometry(QRect(0, 30, 781, 481)); 48 | splitter = new QSplitter(centralwidget); 49 | splitter->setObjectName(QStringLiteral("splitter")); 50 | splitter->setGeometry(QRect(140, 530, 531, 31)); 51 | splitter->setOrientation(Qt::Horizontal); 52 | AddToCartBtn = new QPushButton(splitter); 53 | AddToCartBtn->setObjectName(QStringLiteral("AddToCartBtn")); 54 | splitter->addWidget(AddToCartBtn); 55 | seeCartBtn = new QPushButton(splitter); 56 | seeCartBtn->setObjectName(QStringLiteral("seeCartBtn")); 57 | splitter->addWidget(seeCartBtn); 58 | logOutBtn = new QPushButton(splitter); 59 | logOutBtn->setObjectName(QStringLiteral("logOutBtn")); 60 | splitter->addWidget(logOutBtn); 61 | exitBtn = new QPushButton(splitter); 62 | exitBtn->setObjectName(QStringLiteral("exitBtn")); 63 | splitter->addWidget(exitBtn); 64 | UserMainWindow->setCentralWidget(centralwidget); 65 | statusbar = new QStatusBar(UserMainWindow); 66 | statusbar->setObjectName(QStringLiteral("statusbar")); 67 | UserMainWindow->setStatusBar(statusbar); 68 | 69 | retranslateUi(UserMainWindow); 70 | QObject::connect(exitBtn, SIGNAL(clicked()), UserMainWindow, SLOT(close())); 71 | 72 | QMetaObject::connectSlotsByName(UserMainWindow); 73 | } // setupUi 74 | 75 | void retranslateUi(QMainWindow *UserMainWindow) 76 | { 77 | UserMainWindow->setWindowTitle(QApplication::translate("UserMainWindow", "MainWindow", nullptr)); 78 | AddToCartBtn->setText(QApplication::translate("UserMainWindow", "Add to cart", nullptr)); 79 | seeCartBtn->setText(QApplication::translate("UserMainWindow", "View cart", nullptr)); 80 | logOutBtn->setText(QApplication::translate("UserMainWindow", "logout", nullptr)); 81 | exitBtn->setText(QApplication::translate("UserMainWindow", "Exit", nullptr)); 82 | } // retranslateUi 83 | 84 | }; 85 | 86 | namespace Ui { 87 | class UserMainWindow: public Ui_UserMainWindow {}; 88 | } // namespace Ui 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif // UI_USERMAINWINDOW_H 93 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/View/usermainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "usermainwindow.h" 2 | #include "ui_usermainwindow.h" 3 | #include "addtocartview.h" 4 | #include "showcart.h" 5 | 6 | #include 7 | 8 | UserMainWindow::UserMainWindow(QWidget *parent) : 9 | QMainWindow(parent), 10 | ui(new Ui::UserMainWindow) 11 | { 12 | ui->setupUi(this); 13 | 14 | 15 | //tableView****************************************************************** 16 | //int width = this->width(); 17 | //int height = this->height(); 18 | //ui->tableView->resize(width,height); 19 | 20 | ui->tableView->setShowGrid(true); 21 | 22 | ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); 23 | 24 | model = new QStandardItemModel(); 25 | QStringList labels = QObject::tr("ID, name, label, price, num").simplified().split(","); 26 | model->setHorizontalHeaderLabels(labels); 27 | ui->tableView->setModel(model); 28 | 29 | itemctrl = new ItemCtrl(); 30 | itemctrl->readItemFromFile(MAXSHOWITEM,string(ITEMFILENAME)); 31 | int j = 0; 32 | for(int i = 0; i < itemctrl->getItemTotalNum(); i++){ 33 | if(itemctrl->getItemNum(i) == -1 || itemctrl->getItemNum(i) == 0) continue; 34 | model->setItem(j, 0, new QStandardItem(QString::fromStdString(itemctrl->getItemID(i)))); 35 | model->setItem(j, 1, new QStandardItem(QString::fromStdString(itemctrl->getItemName(i)))); 36 | model->setItem(j, 2, new QStandardItem(QString::fromStdString(itemctrl->getItemLabel(i)))); 37 | model->setItem(j, 3, new QStandardItem(QString::number(itemctrl->getItemPrice(i)))); 38 | model->setItem(j, 4, new QStandardItem(QString::number(itemctrl->getItemNum(i)))); 39 | j++; 40 | } 41 | 42 | ui->tableView->show(); 43 | } 44 | 45 | void UserMainWindow::passUserCtrl(UserCtrl *nuserctrl){ 46 | userctrl = nuserctrl; 47 | cartctrl = new CartCtrl((userctrl->getName())+string(".txt")); 48 | } 49 | 50 | UserMainWindow::~UserMainWindow() 51 | { 52 | delete ui; 53 | } 54 | 55 | void UserMainWindow::addItemToCart(int num){ 56 | 57 | QMessageBox::warning(this, tr("Waring"), 58 | tr("add succeed!%1").arg(num), 59 | QMessageBox::Yes); 60 | int targetNum = ui->tableView->currentIndex().row(); 61 | cartctrl->cart->addNewItem(itemctrl->getItemID(targetNum),itemctrl->getItemName(targetNum), itemctrl->getItemLabel(targetNum), itemctrl->getItemPrice(targetNum), num); 62 | } 63 | 64 | void UserMainWindow::on_AddToCartBtn_clicked() 65 | { 66 | AddToCartView addtocartview; 67 | connect(&addtocartview,SIGNAL(addToCartNum(int)),this,SLOT(addItemToCart(int))); 68 | addtocartview.show(); 69 | if(addtocartview.exec() == QDialog::Accepted){ 70 | } 71 | } 72 | 73 | void UserMainWindow::refresh(){ 74 | itemctrl->readItemFromFile(MAXSHOWITEM,string(ITEMFILENAME)); 75 | int j = 0; 76 | for(int i = 0; i < itemctrl->getItemTotalNum(); i++){ 77 | if(itemctrl->getItemNum(i) == -1 || itemctrl->getItemNum(i) == 0) continue; 78 | model->setItem(j, 0, new QStandardItem(QString::fromStdString(itemctrl->getItemID(i)))); 79 | model->setItem(j, 1, new QStandardItem(QString::fromStdString(itemctrl->getItemName(i)))); 80 | model->setItem(j, 2, new QStandardItem(QString::fromStdString(itemctrl->getItemLabel(i)))); 81 | model->setItem(j, 3, new QStandardItem(QString::number(itemctrl->getItemPrice(i)))); 82 | model->setItem(j, 4, new QStandardItem(QString::number(itemctrl->getItemNum(i)))); 83 | j++; 84 | } 85 | } 86 | 87 | void UserMainWindow::on_seeCartBtn_clicked() 88 | { 89 | ShowCart showcart; 90 | showcart.init(cartctrl,userctrl,itemctrl); 91 | showcart.show(); 92 | if(showcart.exec() == QDialog::Accepted){ 93 | refresh(); 94 | } 95 | } 96 | 97 | void UserMainWindow::on_logOutBtn_clicked() 98 | { 99 | 100 | } 101 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_adminmainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'adminmainwindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_ADMINMAINWINDOW_H 10 | #define UI_ADMINMAINWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | QT_BEGIN_NAMESPACE 25 | 26 | class Ui_AdminMainWindow 27 | { 28 | public: 29 | QWidget *centralwidget; 30 | QTableView *tableView; 31 | QSplitter *splitter; 32 | QPushButton *addBtn; 33 | QPushButton *delBtn; 34 | QPushButton *showListBtn; 35 | QPushButton *logoutBtn; 36 | QPushButton *exitBtn; 37 | QStatusBar *statusbar; 38 | 39 | void setupUi(QMainWindow *AdminMainWindow) 40 | { 41 | if (AdminMainWindow->objectName().isEmpty()) 42 | AdminMainWindow->setObjectName(QStringLiteral("AdminMainWindow")); 43 | AdminMainWindow->resize(753, 512); 44 | centralwidget = new QWidget(AdminMainWindow); 45 | centralwidget->setObjectName(QStringLiteral("centralwidget")); 46 | tableView = new QTableView(centralwidget); 47 | tableView->setObjectName(QStringLiteral("tableView")); 48 | tableView->setGeometry(QRect(0, 0, 801, 411)); 49 | splitter = new QSplitter(centralwidget); 50 | splitter->setObjectName(QStringLiteral("splitter")); 51 | splitter->setGeometry(QRect(41, 443, 681, 31)); 52 | splitter->setOrientation(Qt::Horizontal); 53 | addBtn = new QPushButton(splitter); 54 | addBtn->setObjectName(QStringLiteral("addBtn")); 55 | splitter->addWidget(addBtn); 56 | delBtn = new QPushButton(splitter); 57 | delBtn->setObjectName(QStringLiteral("delBtn")); 58 | splitter->addWidget(delBtn); 59 | showListBtn = new QPushButton(splitter); 60 | showListBtn->setObjectName(QStringLiteral("showListBtn")); 61 | splitter->addWidget(showListBtn); 62 | logoutBtn = new QPushButton(splitter); 63 | logoutBtn->setObjectName(QStringLiteral("logoutBtn")); 64 | splitter->addWidget(logoutBtn); 65 | exitBtn = new QPushButton(splitter); 66 | exitBtn->setObjectName(QStringLiteral("exitBtn")); 67 | splitter->addWidget(exitBtn); 68 | AdminMainWindow->setCentralWidget(centralwidget); 69 | statusbar = new QStatusBar(AdminMainWindow); 70 | statusbar->setObjectName(QStringLiteral("statusbar")); 71 | AdminMainWindow->setStatusBar(statusbar); 72 | 73 | retranslateUi(AdminMainWindow); 74 | QObject::connect(exitBtn, SIGNAL(clicked()), AdminMainWindow, SLOT(close())); 75 | 76 | QMetaObject::connectSlotsByName(AdminMainWindow); 77 | } // setupUi 78 | 79 | void retranslateUi(QMainWindow *AdminMainWindow) 80 | { 81 | AdminMainWindow->setWindowTitle(QApplication::translate("AdminMainWindow", "MainWindow", nullptr)); 82 | addBtn->setText(QApplication::translate("AdminMainWindow", "Add", nullptr)); 83 | delBtn->setText(QApplication::translate("AdminMainWindow", "Delete", nullptr)); 84 | showListBtn->setText(QApplication::translate("AdminMainWindow", "List", nullptr)); 85 | logoutBtn->setText(QApplication::translate("AdminMainWindow", "Logout", nullptr)); 86 | exitBtn->setText(QApplication::translate("AdminMainWindow", "Exit", nullptr)); 87 | } // retranslateUi 88 | 89 | }; 90 | 91 | namespace Ui { 92 | class AdminMainWindow: public Ui_AdminMainWindow {}; 93 | } // namespace Ui 94 | 95 | QT_END_NAMESPACE 96 | 97 | #endif // UI_ADMINMAINWINDOW_H 98 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Taobao.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {73C3303D-3653-49E0-A387-C46EBE0B053C} 15 | Taobao 16 | 10.0.16299.0 17 | 18 | 19 | 20 | Application 21 | true 22 | v141 23 | MultiByte 24 | 25 | 26 | Application 27 | false 28 | v141 29 | true 30 | MultiByte 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | true 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | Level3 56 | MaxSpeed 57 | true 58 | true 59 | true 60 | 61 | 62 | true 63 | true 64 | true 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_logindlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'logindlg.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_LOGINDLG_H 10 | #define UI_LOGINDLG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | QT_BEGIN_NAMESPACE 26 | 27 | class Ui_LoginDlg 28 | { 29 | public: 30 | QWidget *formLayoutWidget; 31 | QFormLayout *formLayout; 32 | QLabel *label; 33 | QLabel *label_2; 34 | QLineEdit *pwdLineEdit; 35 | QLineEdit *usrLineEdit; 36 | QPushButton *exitButton; 37 | QPushButton *loginButton; 38 | QCheckBox *isAdminCheckBox; 39 | QCheckBox *isNewUserCheckBox; 40 | 41 | void setupUi(QDialog *LoginDlg) 42 | { 43 | if (LoginDlg->objectName().isEmpty()) 44 | LoginDlg->setObjectName(QStringLiteral("LoginDlg")); 45 | LoginDlg->resize(481, 239); 46 | formLayoutWidget = new QWidget(LoginDlg); 47 | formLayoutWidget->setObjectName(QStringLiteral("formLayoutWidget")); 48 | formLayoutWidget->setGeometry(QRect(50, 40, 381, 71)); 49 | formLayout = new QFormLayout(formLayoutWidget); 50 | formLayout->setObjectName(QStringLiteral("formLayout")); 51 | formLayout->setContentsMargins(0, 0, 0, 0); 52 | label = new QLabel(formLayoutWidget); 53 | label->setObjectName(QStringLiteral("label")); 54 | 55 | formLayout->setWidget(0, QFormLayout::LabelRole, label); 56 | 57 | label_2 = new QLabel(formLayoutWidget); 58 | label_2->setObjectName(QStringLiteral("label_2")); 59 | 60 | formLayout->setWidget(1, QFormLayout::LabelRole, label_2); 61 | 62 | pwdLineEdit = new QLineEdit(formLayoutWidget); 63 | pwdLineEdit->setObjectName(QStringLiteral("pwdLineEdit")); 64 | pwdLineEdit->setEchoMode(QLineEdit::Password); 65 | 66 | formLayout->setWidget(1, QFormLayout::FieldRole, pwdLineEdit); 67 | 68 | usrLineEdit = new QLineEdit(formLayoutWidget); 69 | usrLineEdit->setObjectName(QStringLiteral("usrLineEdit")); 70 | 71 | formLayout->setWidget(0, QFormLayout::FieldRole, usrLineEdit); 72 | 73 | exitButton = new QPushButton(LoginDlg); 74 | exitButton->setObjectName(QStringLiteral("exitButton")); 75 | exitButton->setGeometry(QRect(340, 180, 91, 41)); 76 | loginButton = new QPushButton(LoginDlg); 77 | loginButton->setObjectName(QStringLiteral("loginButton")); 78 | loginButton->setGeometry(QRect(50, 180, 91, 41)); 79 | isAdminCheckBox = new QCheckBox(LoginDlg); 80 | isAdminCheckBox->setObjectName(QStringLiteral("isAdminCheckBox")); 81 | isAdminCheckBox->setGeometry(QRect(350, 130, 81, 21)); 82 | isNewUserCheckBox = new QCheckBox(LoginDlg); 83 | isNewUserCheckBox->setObjectName(QStringLiteral("isNewUserCheckBox")); 84 | isNewUserCheckBox->setGeometry(QRect(50, 130, 121, 21)); 85 | QWidget::setTabOrder(usrLineEdit, pwdLineEdit); 86 | QWidget::setTabOrder(pwdLineEdit, isAdminCheckBox); 87 | QWidget::setTabOrder(isAdminCheckBox, loginButton); 88 | QWidget::setTabOrder(loginButton, exitButton); 89 | 90 | retranslateUi(LoginDlg); 91 | QObject::connect(exitButton, SIGNAL(clicked()), LoginDlg, SLOT(close())); 92 | 93 | QMetaObject::connectSlotsByName(LoginDlg); 94 | } // setupUi 95 | 96 | void retranslateUi(QDialog *LoginDlg) 97 | { 98 | LoginDlg->setWindowTitle(QApplication::translate("LoginDlg", "Dialog", nullptr)); 99 | label->setText(QApplication::translate("LoginDlg", "Username", nullptr)); 100 | label_2->setText(QApplication::translate("LoginDlg", "Password", nullptr)); 101 | exitButton->setText(QApplication::translate("LoginDlg", "Exit", nullptr)); 102 | loginButton->setText(QApplication::translate("LoginDlg", "Login", nullptr)); 103 | isAdminCheckBox->setText(QApplication::translate("LoginDlg", "Admin", nullptr)); 104 | isNewUserCheckBox->setText(QApplication::translate("LoginDlg", "New user", nullptr)); 105 | } // retranslateUi 106 | 107 | }; 108 | 109 | namespace Ui { 110 | class LoginDlg: public Ui_LoginDlg {}; 111 | } // namespace Ui 112 | 113 | QT_END_NAMESPACE 114 | 115 | #endif // UI_LOGINDLG_H 116 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/ui_additemview.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'additemview.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_ADDITEMVIEW_H 10 | #define UI_ADDITEMVIEW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | QT_BEGIN_NAMESPACE 27 | 28 | class Ui_AddItemView 29 | { 30 | public: 31 | QDialogButtonBox *buttonBox; 32 | QWidget *formLayoutWidget; 33 | QFormLayout *formLayout; 34 | QLabel *label_2; 35 | QLineEdit *nameEdit; 36 | QLabel *label; 37 | QLineEdit *labelEdit; 38 | QLabel *label_3; 39 | QDoubleSpinBox *priceDoubleSpinBox; 40 | QLabel *label_4; 41 | QSpinBox *numSpinBox; 42 | 43 | void setupUi(QDialog *AddItemView) 44 | { 45 | if (AddItemView->objectName().isEmpty()) 46 | AddItemView->setObjectName(QStringLiteral("AddItemView")); 47 | AddItemView->resize(400, 191); 48 | buttonBox = new QDialogButtonBox(AddItemView); 49 | buttonBox->setObjectName(QStringLiteral("buttonBox")); 50 | buttonBox->setGeometry(QRect(20, 150, 341, 32)); 51 | buttonBox->setOrientation(Qt::Horizontal); 52 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); 53 | formLayoutWidget = new QWidget(AddItemView); 54 | formLayoutWidget->setObjectName(QStringLiteral("formLayoutWidget")); 55 | formLayoutWidget->setGeometry(QRect(30, 20, 331, 111)); 56 | formLayout = new QFormLayout(formLayoutWidget); 57 | formLayout->setObjectName(QStringLiteral("formLayout")); 58 | formLayout->setContentsMargins(0, 0, 0, 0); 59 | label_2 = new QLabel(formLayoutWidget); 60 | label_2->setObjectName(QStringLiteral("label_2")); 61 | 62 | formLayout->setWidget(0, QFormLayout::LabelRole, label_2); 63 | 64 | nameEdit = new QLineEdit(formLayoutWidget); 65 | nameEdit->setObjectName(QStringLiteral("nameEdit")); 66 | 67 | formLayout->setWidget(0, QFormLayout::FieldRole, nameEdit); 68 | 69 | label = new QLabel(formLayoutWidget); 70 | label->setObjectName(QStringLiteral("label")); 71 | 72 | formLayout->setWidget(1, QFormLayout::LabelRole, label); 73 | 74 | labelEdit = new QLineEdit(formLayoutWidget); 75 | labelEdit->setObjectName(QStringLiteral("labelEdit")); 76 | 77 | formLayout->setWidget(1, QFormLayout::FieldRole, labelEdit); 78 | 79 | label_3 = new QLabel(formLayoutWidget); 80 | label_3->setObjectName(QStringLiteral("label_3")); 81 | 82 | formLayout->setWidget(2, QFormLayout::LabelRole, label_3); 83 | 84 | priceDoubleSpinBox = new QDoubleSpinBox(formLayoutWidget); 85 | priceDoubleSpinBox->setObjectName(QStringLiteral("priceDoubleSpinBox")); 86 | 87 | formLayout->setWidget(2, QFormLayout::FieldRole, priceDoubleSpinBox); 88 | 89 | label_4 = new QLabel(formLayoutWidget); 90 | label_4->setObjectName(QStringLiteral("label_4")); 91 | 92 | formLayout->setWidget(3, QFormLayout::LabelRole, label_4); 93 | 94 | numSpinBox = new QSpinBox(formLayoutWidget); 95 | numSpinBox->setObjectName(QStringLiteral("numSpinBox")); 96 | 97 | formLayout->setWidget(3, QFormLayout::FieldRole, numSpinBox); 98 | 99 | 100 | retranslateUi(AddItemView); 101 | QObject::connect(buttonBox, SIGNAL(accepted()), AddItemView, SLOT(accept())); 102 | QObject::connect(buttonBox, SIGNAL(rejected()), AddItemView, SLOT(reject())); 103 | 104 | QMetaObject::connectSlotsByName(AddItemView); 105 | } // setupUi 106 | 107 | void retranslateUi(QDialog *AddItemView) 108 | { 109 | AddItemView->setWindowTitle(QApplication::translate("AddItemView", "Dialog", nullptr)); 110 | label_2->setText(QApplication::translate("AddItemView", "Name", nullptr)); 111 | label->setText(QApplication::translate("AddItemView", "Label", nullptr)); 112 | label_3->setText(QApplication::translate("AddItemView", "Price", nullptr)); 113 | label_4->setText(QApplication::translate("AddItemView", "Number", nullptr)); 114 | } // retranslateUi 115 | 116 | }; 117 | 118 | namespace Ui { 119 | class AddItemView: public Ui_AddItemView {}; 120 | } // namespace Ui 121 | 122 | QT_END_NAMESPACE 123 | 124 | #endif // UI_ADDITEMVIEW_H 125 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/filectrl.cpp: -------------------------------------------------------------------------------- 1 | #include "filectrl.h" 2 | 3 | FileCtrl::FileCtrl(string fin, string fout) { 4 | in = fin; 5 | out = fout; 6 | } 7 | 8 | Item* FileCtrl::getAllItems(void) { 9 | ifstream ifile(in, ios::in); 10 | if (ifile.peek() == EOF) return NULL; 11 | int num; 12 | float price; 13 | string id, name, label; 14 | ifile >> id >> name >> label >> price >> num; 15 | Item* rst = new Item(id, name, label, price, num); 16 | Item* temp = rst; 17 | Item* pre = rst; 18 | while(ifile >> id){ 19 | ifile >> name >> label >> price >> num; 20 | temp = new Item(id, name, label, price, num); 21 | pre->setItemNext(temp); 22 | pre = temp; 23 | } 24 | ifile.close(); 25 | return rst; 26 | } 27 | Bill* FileCtrl::getAllBills(void) { 28 | ifstream ifile(in, ios::in); 29 | if (ifile.peek() == EOF) return NULL; 30 | int num; 31 | float price; 32 | string id, name, label, user; 33 | ifile >> id >> name >> label >> price >> num >> user; 34 | Bill* rst = new Bill(id, name, label, price, num, user); 35 | 36 | Bill* temp = rst; 37 | Bill* pre = rst; 38 | while (ifile >> id) { 39 | ifile >> name >> label >> price >> num >> user; 40 | temp = new Bill(id, name, label, price, num, user); 41 | pre->setBillNext(temp); 42 | pre = temp; 43 | } 44 | ifile.close(); 45 | return rst; 46 | } 47 | string FileCtrl::getNextItemID(void) { 48 | string lastID = getLastItemID(); 49 | char rst[6]; 50 | rst[0] = lastID[0]; 51 | string tmpstr(lastID, 2); 52 | int tmpint = stoi(tmpstr); 53 | tmpint++; 54 | snprintf(&rst[1], 5, "%04d", tmpint); 55 | return rst; 56 | } 57 | Item* FileCtrl::getItems(int itemnum) { 58 | ifstream ifile(in, ios::in); 59 | int num; 60 | float price; 61 | string id, name, label; 62 | ifile >> num >> name >> label >> price >> num; 63 | Item* rst = new Item(id, name, label, price, num); 64 | Item* temp = rst; 65 | Item* pre = rst; 66 | for (int i = 0; i < itemnum-1; i++) { 67 | if (!(ifile.peek() == EOF)) break; 68 | ifile >> id >> name >> label >> price >> num; 69 | temp = new Item(id, name, label, price, num); 70 | pre->setItemNext(temp); 71 | pre = temp; 72 | } 73 | return rst; 74 | } 75 | bool FileCtrl::putNewItem(Item* item) { 76 | ofstream ofile(out, ios::app); 77 | ofile << getNextItemID() << "\t" 78 | << item->getItemName() << "\t" 79 | << item->getItemLabel() << "\t" 80 | << item->getItemPrice() << "\t" 81 | << item->getItemNum() << "\n"; 82 | return true; 83 | } 84 | bool FileCtrl::putNewItem(Item* item, string id) { 85 | ofstream ofile(out, ios::app); 86 | ofile << id << "\t" 87 | << item->getItemName() << "\t" 88 | << item->getItemLabel() << "\t" 89 | << item->getItemPrice() << "\t" 90 | << item->getItemNum() << "\n"; 91 | ofile.close(); 92 | return true; 93 | } 94 | bool FileCtrl::saveItems(Item* item) { 95 | ofstream ofile(out, ios::trunc); 96 | Item* now = item; 97 | //while (now->getItemNext() != NULL) { 98 | while (now->getItemNext() != NULL) { 99 | ofile << now->getItemID() << "\t" 100 | << now->getItemName() << "\t" 101 | << now->getItemLabel() << "\t" 102 | << now->getItemPrice() << "\t" 103 | << now->getItemNum() << "\n"; 104 | now = now->getItemNext(); 105 | } 106 | //ofile << now->getItemID() << "\t" 107 | // << now->getItemName() << "\t" 108 | // << now->getItemLabel() << "\t" 109 | // << now->getItemPrice() << "\t" 110 | // << now->getItemNum(); 111 | return true; 112 | } 113 | string FileCtrl::getLastItemID(void) { 114 | ifstream ifile(in, ios::in); 115 | int num; 116 | float price; 117 | string id, name, label; 118 | ifile >> id >> name >> label >> price >> num; 119 | while (!ifile.eof()) { 120 | ifile >> id >> name >> label >> price >> num; 121 | } 122 | ifile.close(); 123 | return id; 124 | } 125 | bool FileCtrl::putNewBill(Item* bill, string user) { 126 | ofstream ofile(out, ios::app); 127 | Item* now = bill; 128 | while (now != NULL) { 129 | ofile << now->getItemID() << "\t" 130 | << now->getItemName() << "\t" 131 | << now->getItemLabel() << "\t" 132 | << now->getItemPrice() << "\t" 133 | << now->getItemNum() << "\t" 134 | << user <<"\n"; 135 | now = now->getItemNext(); 136 | } 137 | return true; 138 | } 139 | 140 | int FileCtrl::searchUserInFile(string iusername) { 141 | ifstream ifile(in, ios::in); 142 | int usernum; 143 | string username; 144 | string password; 145 | bool isactive; 146 | while (!ifile.eof()) { 147 | ifile >> usernum >> username >> password >> isactive; 148 | if (username == iusername)return usernum; 149 | } 150 | ifile.close(); 151 | return USERNAME_UNUSED; 152 | } 153 | bool FileCtrl::matchUserPassword(string iusername, string ipassword) { 154 | ifstream ifile(in, ios::in); 155 | int usernum; 156 | string username; 157 | string password; 158 | bool isactive; 159 | while (!ifile.eof()) { 160 | ifile >> usernum >> username >> password >> isactive; 161 | if (username == iusername && password == ipassword && isactive == true) 162 | return true; 163 | } 164 | ifile.close(); 165 | return false; 166 | } 167 | bool FileCtrl::addUser(string username, string password) { 168 | ofstream ofile(out, ios::app); 169 | ofile << "\n" 170 | << getNextUserNum() << "\t" 171 | << username << "\t" 172 | << password << "\t" 173 | << true << "\t"; 174 | ofile.close(); 175 | string filename = username + ".txt"; 176 | ofile.open(filename); 177 | ofile.close(); 178 | return true; 179 | } 180 | int FileCtrl::getNextUserNum(void) { 181 | return getLastUserNum() + 1; 182 | } 183 | int FileCtrl::getLastUserNum(void) { 184 | ifstream ifile(in, ios::in); 185 | int usernum; 186 | string username; 187 | string password; 188 | bool isactive; 189 | while (!ifile.eof()) { 190 | ifile >> usernum >> username >> password >> isactive; 191 | } 192 | ifile.close(); 193 | return usernum; 194 | } 195 | 196 | bool FileCtrl::clearFile(void) { 197 | ofstream ofile(out, ios::trunc); 198 | ofile.clear(); 199 | ofile.close(); 200 | return true; 201 | } -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/filectrl.cpp: -------------------------------------------------------------------------------- 1 | #include "filectrl.h" 2 | 3 | FileCtrl::FileCtrl(string fin, string fout) { 4 | in = fin; 5 | out = fout; 6 | } 7 | 8 | Item* FileCtrl::getAllItems(void) { 9 | ifstream ifile(in, ios::in); 10 | if (ifile.peek() == EOF) return NULL; 11 | int num; 12 | float price; 13 | string id, name, label; 14 | ifile >> id >> name >> label >> price >> num; 15 | Item* rst = new Item(id, name, label, price, num); 16 | Item* temp = rst; 17 | Item* pre = rst; 18 | while(ifile >> id){ 19 | ifile >> name >> label >> price >> num; 20 | temp = new Item(id, name, label, price, num); 21 | pre->setItemNext(temp); 22 | pre = temp; 23 | } 24 | ifile.close(); 25 | return rst; 26 | } 27 | Bill* FileCtrl::getAllBills(void) { 28 | ifstream ifile(in, ios::in); 29 | if (ifile.peek() == EOF) return NULL; 30 | int num; 31 | float price; 32 | string id, name, label, user; 33 | ifile >> id >> name >> label >> price >> num >> user; 34 | Bill* rst = new Bill(id, name, label, price, num, user); 35 | 36 | Bill* temp = rst; 37 | Bill* pre = rst; 38 | while (ifile >> id) { 39 | ifile >> name >> label >> price >> num >> user; 40 | temp = new Bill(id, name, label, price, num, user); 41 | pre->setBillNext(temp); 42 | pre = temp; 43 | } 44 | ifile.close(); 45 | return rst; 46 | } 47 | string FileCtrl::getNextItemID(void) { 48 | string lastID = getLastItemID(); 49 | char rst[6]; 50 | rst[0] = lastID[0]; 51 | string tmpstr(lastID, 2); 52 | int tmpint = stoi(tmpstr); 53 | tmpint++; 54 | snprintf(&rst[1], 5, "%04d", tmpint); 55 | return rst; 56 | } 57 | Item* FileCtrl::getItems(int itemnum) { 58 | ifstream ifile(in, ios::in); 59 | int num; 60 | float price; 61 | string id, name, label; 62 | ifile >> num >> name >> label >> price >> num; 63 | Item* rst = new Item(id, name, label, price, num); 64 | Item* temp = rst; 65 | Item* pre = rst; 66 | for (int i = 0; i < itemnum-1; i++) { 67 | if (!(ifile.peek() == EOF)) break; 68 | ifile >> id >> name >> label >> price >> num; 69 | temp = new Item(id, name, label, price, num); 70 | pre->setItemNext(temp); 71 | pre = temp; 72 | } 73 | return rst; 74 | } 75 | bool FileCtrl::putNewItem(Item* item) { 76 | ofstream ofile(out, ios::app); 77 | ofile << getNextItemID() << "\t" 78 | << item->getItemName() << "\t" 79 | << item->getItemLabel() << "\t" 80 | << item->getItemPrice() << "\t" 81 | << item->getItemNum() << "\n"; 82 | return true; 83 | } 84 | bool FileCtrl::putNewItem(Item* item, string id) { 85 | ofstream ofile(out, ios::app); 86 | ofile << id << "\t" 87 | << item->getItemName() << "\t" 88 | << item->getItemLabel() << "\t" 89 | << item->getItemPrice() << "\t" 90 | << item->getItemNum() << "\n"; 91 | ofile.close(); 92 | return true; 93 | } 94 | bool FileCtrl::saveItems(Item* item) { 95 | ofstream ofile(out, ios::trunc); 96 | Item* now = item; 97 | //while (now->getItemNext() != NULL) { 98 | while (now != NULL) { 99 | ofile << now->getItemID() << "\t" 100 | << now->getItemName() << "\t" 101 | << now->getItemLabel() << "\t" 102 | << now->getItemPrice() << "\t" 103 | << now->getItemNum() << "\n"; 104 | now = now->getItemNext(); 105 | } 106 | //ofile << now->getItemID() << "\t" 107 | // << now->getItemName() << "\t" 108 | // << now->getItemLabel() << "\t" 109 | // << now->getItemPrice() << "\t" 110 | // << now->getItemNum(); 111 | return true; 112 | } 113 | string FileCtrl::getLastItemID(void) { 114 | ifstream ifile(in, ios::in); 115 | int num; 116 | float price; 117 | string id, name, label; 118 | ifile >> id >> name >> label >> price >> num; 119 | while (!ifile.eof()) { 120 | ifile >> id >> name >> label >> price >> num; 121 | } 122 | ifile.close(); 123 | return id; 124 | } 125 | bool FileCtrl::putNewBill(Item* bill, string user) { 126 | ofstream ofile(out, ios::app); 127 | Item* now = bill; 128 | while (now != NULL) { 129 | ofile << now->getItemID() << "\t" 130 | << now->getItemName() << "\t" 131 | << now->getItemLabel() << "\t" 132 | << now->getItemPrice() << "\t" 133 | << now->getItemNum() << "\t" 134 | << user <<"\n"; 135 | now = now->getItemNext(); 136 | } 137 | return true; 138 | } 139 | 140 | int FileCtrl::searchUserInFile(string iusername) { 141 | ifstream ifile(in, ios::in); 142 | int usernum; 143 | string username; 144 | string password; 145 | bool isactive; 146 | if(!ifile.fail()){ 147 | while (!ifile.eof()) { 148 | ifile >> usernum >> username >> password >> isactive; 149 | if (username == iusername)return usernum; 150 | } 151 | } 152 | ifile.close(); 153 | return USERNAME_UNUSED; 154 | } 155 | bool FileCtrl::matchUserPassword(string iusername, string ipassword) { 156 | ifstream ifile(in, ios::in); 157 | int usernum; 158 | string username; 159 | string password; 160 | bool isactive; 161 | while (!ifile.eof()) { 162 | ifile >> usernum >> username >> password >> isactive; 163 | if (username == iusername && password == ipassword && isactive == true) 164 | return true; 165 | } 166 | ifile.close(); 167 | return false; 168 | } 169 | bool FileCtrl::addUser(string username, string password) { 170 | ofstream ofile(out, ios::app); 171 | ofile << "\n" 172 | << getNextUserNum() << "\t" 173 | << username << "\t" 174 | << password << "\t" 175 | << true << "\t"; 176 | ofile.close(); 177 | string filename = username + ".txt"; 178 | ofile.open(filename); 179 | ofile.close(); 180 | return true; 181 | } 182 | int FileCtrl::getNextUserNum(void) { 183 | return getLastUserNum() + 1; 184 | } 185 | int FileCtrl::getLastUserNum(void) { 186 | ifstream ifile(in, ios::in); 187 | int usernum; 188 | string username; 189 | string password; 190 | bool isactive; 191 | while (!ifile.eof()) { 192 | ifile >> usernum >> username >> password >> isactive; 193 | } 194 | ifile.close(); 195 | return usernum; 196 | } 197 | 198 | bool FileCtrl::clearFile(void) { 199 | ofstream ofile(out, ios::trunc); 200 | ofile.clear(); 201 | ofile.close(); 202 | return true; 203 | } 204 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/Controller/itemctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "itemctrl.h" 2 | 3 | ItemCtrl::ItemCtrl() { 4 | itemNum = 0; 5 | item = NULL; 6 | filename = ITEMFILENAME; 7 | } 8 | ItemCtrl::ItemCtrl(string nfilename) { 9 | itemNum = 0; 10 | item = NULL; 11 | filename = nfilename; 12 | } 13 | 14 | ItemCtrl* ItemCtrl::searchItem(string itemname) { 15 | //if (itemname == "CuiCui") { 16 | // readItemFromFile(2); 17 | // item = new Item(string("CuiCui"), string("QAQ"), 5.2, 10); 18 | //} 19 | //else return NULL; 20 | ItemCtrl* rst = new ItemCtrl(); 21 | Item* now = item; 22 | while (now != NULL) { 23 | if (itemname == now->getItemName()) { 24 | rst->addVirtualItem(now->getItemID(), now->getItemName(), now->getItemLabel(), now->getItemPrice(), now->getItemNum()); 25 | } 26 | now = now->getItemNext(); 27 | } 28 | return rst; 29 | } 30 | string ItemCtrl::searchItem(string itemname, string label) { 31 | Item* now = item; 32 | while (now != NULL) { 33 | if (itemname == now->getItemName() && label == now->getItemLabel()) { 34 | return now->getItemID(); 35 | } 36 | now = now->getItemNext(); 37 | } 38 | return string("NOSUCHITEM"); 39 | } 40 | 41 | 42 | int ItemCtrl::getItemTotalNum(void) { 43 | return itemNum; 44 | } 45 | 46 | string ItemCtrl::getItemID(string id) { 47 | /*if (!isItemEmpty()) { 48 | return item->getItemNum(); 49 | } 50 | else return NULL;*/ 51 | Item* temp = getItem(id); 52 | return temp->getItemID(); 53 | } 54 | string ItemCtrl::getItemID(int num) { 55 | Item* temp = getItem(num); 56 | return temp->getItemID(); 57 | } 58 | 59 | string ItemCtrl::getItemName(string id) { 60 | //if (!isItemEmpty()) { 61 | // return item->getItemName(); 62 | //} 63 | //else return NULL; 64 | if (isItemEmpty()) return NULL; 65 | Item* temp = getItem(id); 66 | return temp->getItemName(); 67 | } 68 | string ItemCtrl::getItemName(int num) { 69 | Item* temp = getItem(num); 70 | return temp->getItemName(); 71 | } 72 | 73 | string ItemCtrl::getItemLabel(string id) { 74 | //if (!isItemEmpty()) { 75 | // return item->getItemLabel(); 76 | //} 77 | //else return NULL; 78 | if (isItemEmpty()) return NULL; 79 | Item* temp = getItem(id); 80 | return temp->getItemLabel(); 81 | } 82 | string ItemCtrl::getItemLabel(int num) { 83 | Item* temp = getItem(num); 84 | return temp->getItemLabel(); 85 | } 86 | 87 | float ItemCtrl::getItemPrice(string id) { 88 | //if (!isItemEmpty()) { 89 | // return item->getItemPrice(); 90 | //} 91 | //else return NULL; 92 | if (isItemEmpty()) return NULL; 93 | Item* temp = getItem(id); 94 | return temp->getItemPrice(); 95 | } 96 | float ItemCtrl::getItemPrice(int num) { 97 | Item* temp = getItem(num); 98 | return temp->getItemPrice(); 99 | } 100 | 101 | int ItemCtrl::getItemNum(string id) { 102 | //if (!isItemEmpty()) { 103 | // return item->getItemQuant(); 104 | //} 105 | //else return NULL; 106 | if (isItemEmpty()) return NULL; 107 | Item* temp = getItem(id); 108 | return temp->getItemNum(); 109 | } 110 | int ItemCtrl::getItemNum(int num) { 111 | Item* temp = getItem(num); 112 | return temp->getItemNum(); 113 | } 114 | 115 | //num is how many items you want to read 116 | int ItemCtrl::readItemFromFile(int num, string filename) { 117 | FileCtrl file(filename, filename); 118 | this->item = file.getAllItems(); 119 | if (this->item == NULL) return 0; 120 | itemNum = item->getItemTotalNum(); 121 | return itemNum; 122 | } 123 | bool ItemCtrl::clearFile(string filename) { 124 | FileCtrl file(filename, filename); 125 | return file.clearFile(); 126 | } 127 | 128 | bool ItemCtrl::addNewItem(string name, string label, float price, int num) { 129 | FileCtrl file(string(ITEMFILENAME), filename); 130 | Item* temp = new Item(file.getNextItemID(), name, label, price, num); 131 | if (itemNum == 0) item = temp; 132 | else getItem(itemNum - 1)->setItemNext(temp); 133 | file.putNewItem(temp); 134 | itemNum++; 135 | return true; 136 | } 137 | bool ItemCtrl::addNewItem(string id, string name, string label, float price, int num) { 138 | FileCtrl file(string(ITEMFILENAME), filename); 139 | Item* temp = new Item(id, name, label, price, num); 140 | if (itemNum == 0) item = temp; 141 | else getItem(itemNum - 1)->setItemNext(temp); 142 | file.putNewItem(temp, id); 143 | itemNum++; 144 | return true; 145 | } 146 | bool ItemCtrl::addVirtualItem(string id, string name, string label, float price, int num) { 147 | Item* temp = new Item(id, name, label, price, num); 148 | if (itemNum == 0) item = temp; 149 | else getItem(itemNum - 1)->setItemNext(temp); 150 | itemNum++; 151 | return true; 152 | } 153 | 154 | bool ItemCtrl::delItem(string id) { 155 | getItem(id)->setItemNum(-1); 156 | FileCtrl file(filename, filename); 157 | file.saveItems(item); 158 | return true; 159 | } 160 | 161 | bool ItemCtrl::addItemNum(string id, int addnum) { 162 | getItem(id)->addItemNum(addnum); 163 | FileCtrl file(string(ITEMFILENAME), string(ITEMFILENAME)); 164 | file.saveItems(item); 165 | return true; 166 | } 167 | bool ItemCtrl::delItemNum(string id, int addnum) { 168 | getItem(id)->delItemNum(addnum); 169 | FileCtrl file(string(ITEMFILENAME), string(ITEMFILENAME)); 170 | file.saveItems(item); 171 | return true; 172 | } 173 | 174 | Item* ItemCtrl::getItem(string id) { 175 | Item* temp = item; 176 | for (int i = 0; i < itemNum; i++) { 177 | if (id == temp->getItemID()) break; 178 | temp = temp->getItemNext(); 179 | } 180 | return temp; 181 | } 182 | Item* ItemCtrl::getItem(int num) { 183 | Item* temp = item; 184 | for (int i = 0; i < num; i++) { 185 | temp = temp->getItemNext(); 186 | } 187 | return temp; 188 | } 189 | 190 | float ItemCtrl::getTotalPrice(void) { 191 | float rst = 0; 192 | for (int i = 0; i < itemNum; i++) { 193 | rst += getItemNum(i)*getItemPrice(i); 194 | } 195 | return rst; 196 | } 197 | 198 | bool ItemCtrl::isItemEmpty(void) { 199 | if (item == NULL) return true; 200 | else return false; 201 | } 202 | 203 | bool ItemCtrl::hasMoreItem(string id, int num) { 204 | Item* item = getItem(id); 205 | if (item->getItemNum() >= num) return true; 206 | else return false; 207 | } 208 | bool ItemCtrl::hasTheItem(string id) { 209 | if (getItem(id) == NULL) return false; 210 | else return true; 211 | } -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/TaoBao/Controller/itemctrl.cpp: -------------------------------------------------------------------------------- 1 | #include "itemctrl.h" 2 | 3 | ItemCtrl::ItemCtrl() { 4 | itemNum = 0; 5 | item = NULL; 6 | filename = ITEMFILENAME; 7 | } 8 | ItemCtrl::ItemCtrl(string nfilename) { 9 | itemNum = 0; 10 | item = NULL; 11 | filename = nfilename; 12 | } 13 | 14 | ItemCtrl* ItemCtrl::searchItem(string itemname) { 15 | //if (itemname == "CuiCui") { 16 | // readItemFromFile(2); 17 | // item = new Item(string("CuiCui"), string("QAQ"), 5.2, 10); 18 | //} 19 | //else return NULL; 20 | ItemCtrl* rst = new ItemCtrl(); 21 | Item* now = item; 22 | while (now != NULL) { 23 | if (itemname == now->getItemName()) { 24 | rst->addVirtualItem(now->getItemID(), now->getItemName(), now->getItemLabel(), now->getItemPrice(), now->getItemNum()); 25 | } 26 | now = now->getItemNext(); 27 | } 28 | return rst; 29 | } 30 | string ItemCtrl::searchItem(string itemname, string label) { 31 | Item* now = item; 32 | while (now != NULL) { 33 | if (itemname == now->getItemName() && label == now->getItemLabel()) { 34 | return now->getItemID(); 35 | } 36 | now = now->getItemNext(); 37 | } 38 | return string("NOSUCHITEM"); 39 | } 40 | 41 | 42 | int ItemCtrl::getItemTotalNum(void) { 43 | return itemNum; 44 | } 45 | 46 | string ItemCtrl::getItemID(string id) { 47 | /*if (!isItemEmpty()) { 48 | return item->getItemNum(); 49 | } 50 | else return NULL;*/ 51 | Item* temp = getItem(id); 52 | return temp->getItemID(); 53 | } 54 | string ItemCtrl::getItemID(int num) { 55 | Item* temp = getItem(num); 56 | return temp->getItemID(); 57 | } 58 | 59 | string ItemCtrl::getItemName(string id) { 60 | //if (!isItemEmpty()) { 61 | // return item->getItemName(); 62 | //} 63 | //else return NULL; 64 | if (isItemEmpty()) return NULL; 65 | Item* temp = getItem(id); 66 | return temp->getItemName(); 67 | } 68 | string ItemCtrl::getItemName(int num) { 69 | Item* temp = getItem(num); 70 | return temp->getItemName(); 71 | } 72 | 73 | string ItemCtrl::getItemLabel(string id) { 74 | //if (!isItemEmpty()) { 75 | // return item->getItemLabel(); 76 | //} 77 | //else return NULL; 78 | if (isItemEmpty()) return NULL; 79 | Item* temp = getItem(id); 80 | return temp->getItemLabel(); 81 | } 82 | string ItemCtrl::getItemLabel(int num) { 83 | Item* temp = getItem(num); 84 | return temp->getItemLabel(); 85 | } 86 | 87 | float ItemCtrl::getItemPrice(string id) { 88 | //if (!isItemEmpty()) { 89 | // return item->getItemPrice(); 90 | //} 91 | //else return NULL; 92 | if (isItemEmpty()) return NULL; 93 | Item* temp = getItem(id); 94 | return temp->getItemPrice(); 95 | } 96 | float ItemCtrl::getItemPrice(int num) { 97 | Item* temp = getItem(num); 98 | return temp->getItemPrice(); 99 | } 100 | 101 | int ItemCtrl::getItemNum(string id) { 102 | //if (!isItemEmpty()) { 103 | // return item->getItemQuant(); 104 | //} 105 | //else return NULL; 106 | if (isItemEmpty()) return NULL; 107 | Item* temp = getItem(id); 108 | return temp->getItemNum(); 109 | } 110 | int ItemCtrl::getItemNum(int num) { 111 | Item* temp = getItem(num); 112 | return temp->getItemNum(); 113 | } 114 | 115 | //num is how many items you want to read 116 | int ItemCtrl::readItemFromFile(int num, string filename) { 117 | FileCtrl file(filename, filename); 118 | this->item = file.getAllItems(); 119 | if (this->item == NULL) return 0; 120 | itemNum = item->getItemTotalNum(); 121 | return itemNum; 122 | } 123 | bool ItemCtrl::clearFile(string filename) { 124 | FileCtrl file(filename, filename); 125 | return file.clearFile(); 126 | } 127 | 128 | bool ItemCtrl::addNewItem(string name, string label, float price, int num) { 129 | FileCtrl file(string(ITEMFILENAME), filename); 130 | Item* temp = new Item(file.getNextItemID(), name, label, price, num); 131 | if (itemNum == 0) item = temp; 132 | else getItem(itemNum - 1)->setItemNext(temp); 133 | file.putNewItem(temp); 134 | itemNum++; 135 | return true; 136 | } 137 | bool ItemCtrl::addNewItem(string id, string name, string label, float price, int num) { 138 | FileCtrl file(string(ITEMFILENAME), filename); 139 | Item* temp = new Item(id, name, label, price, num); 140 | if (itemNum == 0) item = temp; 141 | else getItem(itemNum - 1)->setItemNext(temp); 142 | file.putNewItem(temp, id); 143 | itemNum++; 144 | return true; 145 | } 146 | bool ItemCtrl::addVirtualItem(string id, string name, string label, float price, int num) { 147 | Item* temp = new Item(id, name, label, price, num); 148 | if (itemNum == 0) item = temp; 149 | else getItem(itemNum - 1)->setItemNext(temp); 150 | itemNum++; 151 | return true; 152 | } 153 | 154 | bool ItemCtrl::delItem(string id) { 155 | getItem(id)->setItemNum(-1); 156 | FileCtrl file(filename, filename); 157 | file.saveItems(item); 158 | return true; 159 | } 160 | 161 | bool ItemCtrl::addItemNum(string id, int addnum) { 162 | getItem(id)->addItemNum(addnum); 163 | FileCtrl file(string(ITEMFILENAME), string(ITEMFILENAME)); 164 | file.saveItems(item); 165 | return true; 166 | } 167 | bool ItemCtrl::delItemNum(string id, int addnum) { 168 | getItem(id)->delItemNum(addnum); 169 | FileCtrl file(string(ITEMFILENAME), string(ITEMFILENAME)); 170 | file.saveItems(item); 171 | return true; 172 | } 173 | 174 | Item* ItemCtrl::getItem(string id) { 175 | Item* temp = item; 176 | for (int i = 0; i < itemNum; i++) { 177 | if (id == temp->getItemID()) break; 178 | temp = temp->getItemNext(); 179 | } 180 | return temp; 181 | } 182 | Item* ItemCtrl::getItem(int num) { 183 | Item* temp = item; 184 | for (int i = 0; i < num; i++) { 185 | temp = temp->getItemNext(); 186 | } 187 | return temp; 188 | } 189 | 190 | float ItemCtrl::getTotalPrice(void) { 191 | float rst = 0; 192 | for (int i = 0; i < itemNum; i++) { 193 | rst += getItemNum(i)*getItemPrice(i); 194 | } 195 | return rst; 196 | } 197 | 198 | bool ItemCtrl::isItemEmpty(void) { 199 | if (item == NULL) return true; 200 | else return false; 201 | } 202 | 203 | bool ItemCtrl::hasMoreItem(string id, int num) { 204 | Item* item = getItem(id); 205 | if (item->getItemNum() >= num) return true; 206 | else return false; 207 | } 208 | bool ItemCtrl::hasTheItem(string id) { 209 | if (getItem(id) == NULL) return false; 210 | else return true; 211 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.iobj 68 | *.pch 69 | *.pdb 70 | *.ipdb 71 | *.pgc 72 | *.pgd 73 | *.rsp 74 | *.sbr 75 | *.tlb 76 | *.tli 77 | *.tlh 78 | *.tmp 79 | *.tmp_proj 80 | *.log 81 | *.vspscc 82 | *.vssscc 83 | .builds 84 | *.pidb 85 | *.svclog 86 | *.scc 87 | 88 | # Chutzpah Test files 89 | _Chutzpah* 90 | 91 | # Visual C++ cache files 92 | ipch/ 93 | *.aps 94 | *.ncb 95 | *.opendb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | *.VC.db 100 | *.VC.VC.opendb 101 | 102 | # Visual Studio profiler 103 | *.psess 104 | *.vsp 105 | *.vspx 106 | *.sap 107 | 108 | # Visual Studio Trace Files 109 | *.e2e 110 | 111 | # TFS 2012 Local Workspace 112 | $tf/ 113 | 114 | # Guidance Automation Toolkit 115 | *.gpState 116 | 117 | # ReSharper is a .NET coding add-in 118 | _ReSharper*/ 119 | *.[Rr]e[Ss]harper 120 | *.DotSettings.user 121 | 122 | # JustCode is a .NET coding add-in 123 | .JustCode 124 | 125 | # TeamCity is a build add-in 126 | _TeamCity* 127 | 128 | # DotCover is a Code Coverage Tool 129 | *.dotCover 130 | 131 | # AxoCover is a Code Coverage Tool 132 | .axoCover/* 133 | !.axoCover/settings.json 134 | 135 | # Visual Studio code coverage results 136 | *.coverage 137 | *.coveragexml 138 | 139 | # NCrunch 140 | _NCrunch_* 141 | .*crunch*.local.xml 142 | nCrunchTemp_* 143 | 144 | # MightyMoose 145 | *.mm.* 146 | AutoTest.Net/ 147 | 148 | # Web workbench (sass) 149 | .sass-cache/ 150 | 151 | # Installshield output folder 152 | [Ee]xpress/ 153 | 154 | # DocProject is a documentation generator add-in 155 | DocProject/buildhelp/ 156 | DocProject/Help/*.HxT 157 | DocProject/Help/*.HxC 158 | DocProject/Help/*.hhc 159 | DocProject/Help/*.hhk 160 | DocProject/Help/*.hhp 161 | DocProject/Help/Html2 162 | DocProject/Help/html 163 | 164 | # Click-Once directory 165 | publish/ 166 | 167 | # Publish Web Output 168 | *.[Pp]ublish.xml 169 | *.azurePubxml 170 | # Note: Comment the next line if you want to checkin your web deploy settings, 171 | # but database connection strings (with potential passwords) will be unencrypted 172 | *.pubxml 173 | *.publishproj 174 | 175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 176 | # checkin your Azure Web App publish settings, but sensitive information contained 177 | # in these scripts will be unencrypted 178 | PublishScripts/ 179 | 180 | # NuGet Packages 181 | *.nupkg 182 | # The packages folder can be ignored because of Package Restore 183 | **/[Pp]ackages/* 184 | # except build/, which is used as an MSBuild target. 185 | !**/[Pp]ackages/build/ 186 | # Uncomment if necessary however generally it will be regenerated when needed 187 | #!**/[Pp]ackages/repositories.config 188 | # NuGet v3's project.json files produces more ignorable files 189 | *.nuget.props 190 | *.nuget.targets 191 | 192 | # Microsoft Azure Build Output 193 | csx/ 194 | *.build.csdef 195 | 196 | # Microsoft Azure Emulator 197 | ecf/ 198 | rcf/ 199 | 200 | # Windows Store app package directories and files 201 | AppPackages/ 202 | BundleArtifacts/ 203 | Package.StoreAssociation.xml 204 | _pkginfo.txt 205 | *.appx 206 | 207 | # Visual Studio cache files 208 | # files ending in .cache can be ignored 209 | *.[Cc]ache 210 | # but keep track of directories ending in .cache 211 | !*.[Cc]ache/ 212 | 213 | # Others 214 | ClientBin/ 215 | ~$* 216 | *~ 217 | *.dbmdl 218 | *.dbproj.schemaview 219 | *.jfm 220 | *.pfx 221 | *.publishsettings 222 | orleans.codegen.cs 223 | 224 | # Including strong name files can present a security risk 225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 226 | #*.snk 227 | 228 | # Since there are multiple workflows, uncomment next line to ignore bower_components 229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 230 | #bower_components/ 231 | 232 | # RIA/Silverlight projects 233 | Generated_Code/ 234 | 235 | # Backup & report files from converting an old project file 236 | # to a newer Visual Studio version. Backup files are not needed, 237 | # because we have git ;-) 238 | _UpgradeReport_Files/ 239 | Backup*/ 240 | UpgradeLog*.XML 241 | UpgradeLog*.htm 242 | ServiceFabricBackup/ 243 | *.rptproj.bak 244 | 245 | # SQL Server files 246 | *.mdf 247 | *.ldf 248 | *.ndf 249 | 250 | # Business Intelligence projects 251 | *.rdl.data 252 | *.bim.layout 253 | *.bim_*.settings 254 | *.rptproj.rsuser 255 | 256 | # Microsoft Fakes 257 | FakesAssemblies/ 258 | 259 | # GhostDoc plugin setting file 260 | *.GhostDoc.xml 261 | 262 | # Node.js Tools for Visual Studio 263 | .ntvs_analysis.dat 264 | node_modules/ 265 | 266 | # Visual Studio 6 build log 267 | *.plg 268 | 269 | # Visual Studio 6 workspace options file 270 | *.opt 271 | 272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 273 | *.vbw 274 | 275 | # Visual Studio LightSwitch build output 276 | **/*.HTMLClient/GeneratedArtifacts 277 | **/*.DesktopClient/GeneratedArtifacts 278 | **/*.DesktopClient/ModelManifest.xml 279 | **/*.Server/GeneratedArtifacts 280 | **/*.Server/ModelManifest.xml 281 | _Pvt_Extensions 282 | 283 | # Paket dependency manager 284 | .paket/paket.exe 285 | paket-files/ 286 | 287 | # FAKE - F# Make 288 | .fake/ 289 | 290 | # JetBrains Rider 291 | .idea/ 292 | *.sln.iml 293 | 294 | # CodeRush 295 | .cr/ 296 | 297 | # Python Tools for Visual Studio (PTVS) 298 | __pycache__/ 299 | *.pyc 300 | 301 | # Cake - Uncomment if you are using it 302 | # tools/** 303 | # !tools/packages.config 304 | 305 | # Tabs Studio 306 | *.tss 307 | 308 | # Telerik's JustMock configuration file 309 | *.jmconfig 310 | 311 | # BizTalk build output 312 | *.btp.cs 313 | *.btm.cs 314 | *.odx.cs 315 | *.xsd.cs 316 | 317 | # OpenCover UI analysis results 318 | OpenCover/ 319 | 320 | # Azure Stream Analytics local run output 321 | ASALocalRun/ 322 | 323 | # MSBuild Binary and Structured Log 324 | *.binlog 325 | 326 | # NVidia Nsight GPU debugger configuration file 327 | *.nvuser 328 | 329 | # MFractors (Xamarin productivity tool) working folder 330 | .mfractor/ 331 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v1.0/Taobao/View/menu.cpp: -------------------------------------------------------------------------------- 1 | #include "menu.h" 2 | 3 | Menu::Menu() { 4 | cmd = -1; 5 | itemctrl = NULL; 6 | userctrl = new UserCtrl(); 7 | cartctrl = NULL; 8 | } 9 | void Menu::showWelcome(void) { 10 | cout << endl; 11 | cout << "************************************************************" << endl; 12 | cout << "Welcome to CuiCuiJiang's shopping system!" << endl; 13 | cout << "************************************************************" << endl; 14 | cout << endl; 15 | } 16 | bool Menu::loginMenu(void){ 17 | showUserLoginMainMenu(); 18 | cmd = requestInput(); 19 | switch (cmd){ 20 | case 1: 21 | theUserRegisterMenu(); 22 | break; 23 | case 2: 24 | theUserLoginMenu(); 25 | break; 26 | case 3: 27 | theAdminLoginMenu(); 28 | break; 29 | case 0: 30 | return DIRECTEXIT; 31 | } 32 | showUserWelcome(); 33 | return BACKTOLASTMENU; 34 | } 35 | bool Menu::mainMenu(void) { 36 | if (userctrl->getUserType() == USER) return userMainMenu(); 37 | else if (userctrl->getUserType() == ADMIN) return adminMainMenu(); 38 | return DIRECTEXIT; 39 | } 40 | 41 | 42 | 43 | //private*************************************** 44 | 45 | //user login 46 | void Menu::showUserLoginMainMenu(void){ 47 | cout << endl; 48 | cout << "************************************************************" << endl; 49 | cout << "1. User register 2. User login 3. Admin login" << endl; 50 | if (ISALLOWANOMY) cout << "4. Blowse in anomy" << endl; 51 | cout << "************************************************************" << endl; 52 | cout << endl; 53 | } 54 | 55 | void Menu::theUserRegisterMenu() { 56 | string username = getUserName(); 57 | string password = getUserPassword(); 58 | if (userctrl->addNewUser(username, password) == false) { 59 | showUsernameUsedMenu(); 60 | } 61 | else cout << "OK" << endl; 62 | userctrl->authUser(username, password); 63 | } 64 | void Menu::showUsernameUsedMenu(void) { 65 | cout << "There is such a user!" << endl; 66 | } 67 | void Menu::theUserLoginMenu(void) { 68 | int rst = USERNAME_ISEMPTY; 69 | cout << endl; 70 | string username, password; 71 | while (rst < 0) { 72 | cout << endl; 73 | username = getUserName(); 74 | password = getUserPassword(); 75 | rst = userctrl->authUser(username, password); 76 | switch (rst) { 77 | case USERNAME_UNUSED: 78 | showUsernameUnusedMenu(); 79 | break; 80 | case PASSWORD_NOTVALID: 81 | showPasswordUnvalidMenu(); 82 | break; 83 | } 84 | cout << endl; 85 | } 86 | cartctrl = new CartCtrl(username + string(".txt")); 87 | } 88 | void Menu::theAdminLoginMenu(void) { 89 | userctrl = new UserCtrl(); 90 | int rst = USERNAME_ISEMPTY; 91 | cout << endl; 92 | while (rst < 0) { 93 | cout << endl; 94 | string username = getUserName(); 95 | string password = getUserPassword(); 96 | rst = userctrl->authAdmin(username, password); 97 | switch (rst) { 98 | case USERNAME_UNUSED: 99 | showUsernameUnusedMenu(); 100 | break; 101 | case PASSWORD_NOTVALID: 102 | showPasswordUnvalidMenu(); 103 | break; 104 | } 105 | cout << endl; 106 | } 107 | } 108 | 109 | void Menu::showUsernameUnusedMenu(void) { 110 | cout << "No such user!" << endl; 111 | } 112 | void Menu::showPasswordUnvalidMenu(void) { 113 | cout << "Password unvalid!" << endl; 114 | } 115 | void Menu::showUserWelcome(void) { 116 | cout << endl; 117 | cout << "************************************************************" << endl; 118 | cout << "Welcome, " << userctrl->getName() << "!" << endl; 119 | cout << "************************************************************" << endl; 120 | cout << endl; 121 | } 122 | 123 | string Menu::getUserName(void) { 124 | cout << "Username: "; 125 | string input; 126 | cin >> input; 127 | return input; 128 | } 129 | string Menu::getUserPassword(void) { 130 | cout << "Password: "; 131 | string input; 132 | cin >> input; 133 | return input; 134 | } 135 | 136 | //main menu 137 | bool Menu::userMainMenu(void) { 138 | itemctrl = new ItemCtrl(); 139 | itemctrl->readItemFromFile(MAXSHOWITEM,string(ITEMFILENAME)); 140 | showItemsList(itemctrl); 141 | cmd = -1; 142 | while (cmd != 0) { 143 | showUserMainMenu(); 144 | cmd = requestInput(); 145 | switch (cmd) { 146 | case 1: 147 | showItemsList(itemctrl); 148 | break; 149 | case 2: 150 | searchItemMenu(); 151 | break; 152 | case 3: 153 | addItemToCartMenu(); 154 | break; 155 | case 4: 156 | delItemFromCartMenu(); 157 | break; 158 | case 5: 159 | showItemCartMenu(); 160 | break; 161 | case 6: 162 | buyItemMenu(); 163 | break; 164 | case 7: 165 | return BACKTOLASTMENU; 166 | break; 167 | case 0: 168 | return DIRECTEXIT; 169 | } 170 | } 171 | return DIRECTEXIT; 172 | } 173 | bool Menu::adminMainMenu(void) { 174 | itemctrl = new ItemCtrl(); 175 | itemctrl->readItemFromFile(MAXSHOWITEM, string(ITEMFILENAME)); 176 | showItemsList(itemctrl); 177 | cmd = -1; 178 | while (cmd != 0) { 179 | showAdminMainMenu(); 180 | cmd = requestInput(); 181 | switch (cmd) { 182 | case 1: 183 | showItemsList(itemctrl); 184 | break; 185 | case 2: 186 | searchItemMenu(); 187 | break; 188 | case 3: 189 | addItemMenu(); 190 | break; 191 | case 4: 192 | delItemMenu(); 193 | break; 194 | case 5: 195 | addItemNumMenu(); 196 | break; 197 | case 6: 198 | showSoldMenu(); 199 | break; 200 | case 7: 201 | return BACKTOLASTMENU; 202 | break; 203 | case 0: 204 | return DIRECTEXIT; 205 | } 206 | } 207 | return DIRECTEXIT; 208 | } 209 | 210 | void Menu::showItemsList(void) { 211 | cout << endl; 212 | cout << "************************************************************" << endl; 213 | cout << "ITEM LIST" << endl; 214 | cout << "0" << "\t" << "CuiCui" << "\t" << 5.20 << endl; 215 | cout << "************************************************************" << endl; 216 | cout << endl; 217 | } 218 | void Menu::showItemsList(ItemCtrl* tarItem) { 219 | cout << endl; 220 | cout << "************************************************************" << endl; 221 | cout << "ITEM LIST" << endl; 222 | cout << "ID" << "\t" << "Name" << "\t" << "Label" << "\t" << "Price" << "\t" << "Number" << endl; 223 | for (int i = 0; i < tarItem->getItemTotalNum(); i++) { 224 | if (userctrl->getUserType() == ADMIN) { 225 | if (tarItem->getItemNum(i) != -1) { 226 | cout << tarItem->getItemID(i) << "\t" 227 | << tarItem->getItemName(i) << "\t" 228 | << tarItem->getItemLabel(i) << "\t" 229 | << tarItem->getItemPrice(i) << "\t" 230 | << tarItem->getItemNum(i) << endl; 231 | } 232 | } 233 | else if (userctrl->getUserType() == USER) { 234 | if (tarItem->getItemNum(i) != -1 && tarItem->getItemNum(i) != 0) { 235 | cout << tarItem->getItemID(i) << "\t" 236 | << tarItem->getItemName(i) << "\t" 237 | << tarItem->getItemLabel(i) << "\t" 238 | << tarItem->getItemPrice(i) << "\t" 239 | << tarItem->getItemNum(i) << endl; 240 | } 241 | } 242 | 243 | } 244 | cout << "************************************************************" << endl; 245 | cout << endl; 246 | } 247 | 248 | void Menu::showUserMainMenu(void) { 249 | cout << endl; 250 | cout << "************************************************************" << endl; 251 | cout << "1. Show items 2. Search items 3. Add items to cart 4.Remove items from cart 5. Show cart 6. Buy items 7. Logout 0. exit" << endl; 252 | cout << "************************************************************" << endl; 253 | cout << endl; 254 | } 255 | void Menu::showAdminMainMenu(void) { 256 | cout << endl; 257 | cout << "************************************************************" << endl; 258 | cout << "1. show items 2. Search items 3.Add new item 4. Delete item 5. Add item number 6. Show list 7. Logout 0. exit" << endl; 259 | cout << "************************************************************" << endl; 260 | cout << endl; 261 | } 262 | 263 | 264 | //search item 265 | void Menu::searchItemMenu(void) { 266 | string targetItem; 267 | targetItem = requestItemName(); 268 | //if (reloadItemCtrl() == false) exit(-1); 269 | ItemCtrl* rst = itemctrl->searchItem(targetItem); 270 | if (rst->getItemTotalNum() == 0) showItemNotFoundMenu(); 271 | else showItemsList(rst); 272 | delete(rst); 273 | } 274 | void Menu::showItemNotFoundMenu(void) { 275 | cout << endl; 276 | cout << "No such item QAQ" << endl; 277 | cout << endl; 278 | } 279 | 280 | //add item 281 | void Menu::addItemMenu(void) { 282 | string itemname = requestItemName(); 283 | string itemlabel = requestItemLabel(); 284 | if (itemctrl->searchItem(itemname, itemlabel) != "NOSUCHITEM") { 285 | int itemnum = requestItemNum(); 286 | itemctrl->addItemNum(itemctrl->searchItem(itemname, itemlabel), itemnum); 287 | } 288 | else { 289 | float itemprice = requestItemPrice(); 290 | int itemnum = requestItemNum(); 291 | itemctrl->addNewItem(itemname, itemlabel, itemprice, itemnum); 292 | } 293 | } 294 | 295 | //del item 296 | void Menu::delItemMenu(void) { 297 | string itemid = requestItemID(); 298 | if (!itemctrl->hasTheItem(itemid)) { 299 | cout << "NO SUCH ITEM" << endl; 300 | return; 301 | } 302 | itemctrl->delItem(itemid); 303 | cout << "OK" << endl; 304 | } 305 | 306 | //change item num 307 | void Menu::addItemNumMenu(void) { 308 | string itemnum = requestItemID(); 309 | if (!itemctrl->hasTheItem(itemnum)) { 310 | cout << "NO SUCH ITEM" << endl; 311 | return; 312 | } 313 | int addquant = requestItemNum(); 314 | itemctrl->addItemNum(itemnum, addquant); 315 | cout << "OK" << endl; 316 | } 317 | void Menu::showAddItemNumMenu(void) { 318 | 319 | } 320 | 321 | //add to cart 322 | void Menu::addItemToCartMenu(void) { 323 | string targetID; 324 | targetID = requestItemID(); 325 | if (!itemctrl->hasTheItem(targetID)) { 326 | cout << "NO SUCH ITEM" << endl; 327 | return; 328 | } 329 | int num; 330 | num = requestItemNum(); 331 | if (!itemctrl->hasMoreItem(targetID, num)) { 332 | cout << "You put more items into your cart!" << endl; 333 | return; 334 | } 335 | cartctrl->cart->addNewItem(targetID,itemctrl->getItemName(targetID), itemctrl->getItemLabel(targetID), itemctrl->getItemPrice(targetID), num); 336 | cout << "OK" << endl; 337 | } 338 | void Menu::delItemFromCartMenu(void) { 339 | string targetID; 340 | targetID = requestItemID(); 341 | if (!cartctrl->cart->hasTheItem(targetID)) { 342 | cout << "NO SUCH ITEM" << endl; 343 | return; 344 | } 345 | cartctrl->cart->delItem(targetID); 346 | cout << "OK" << endl; 347 | } 348 | void Menu::showItemCartMenu(void) { 349 | showItemsList(cartctrl->cart); 350 | } 351 | 352 | void Menu::showSoldMenu(void) { 353 | FileCtrl* file = new FileCtrl(string(LISTFILENAME), string(LISTFILENAME)); 354 | Bill* bill = file->getAllBills(); 355 | cout << endl; 356 | cout << "************************************************************" << endl; 357 | cout << "ID" << "\t" << "Name" << "\t" << "Label" << "\t" << "Price" << "\t" << "Number" << "\t" << "User" << endl; 358 | for (int i = 0; i < bill->getBillTotalNum(); i++) { 359 | if (bill != NULL) { 360 | cout << bill->getItemID() << "\t" 361 | << bill->getItemName() << "\t" 362 | << bill->getItemLabel() << "\t" 363 | << bill->getItemPrice() << "\t" 364 | << bill->getItemNum() << "\t" 365 | << bill->getBillUser() << endl; 366 | bill = bill->getBillNext(); 367 | } 368 | } 369 | cout << "************************************************************" << endl; 370 | cout << endl; 371 | } 372 | 373 | //buy item 374 | void Menu::buyItemMenu(void) { 375 | showItemCartMenu(); 376 | cout << "Total cost: " << cartctrl->cart->getTotalPrice() << ". Sure?" << endl; 377 | string cmd; 378 | cin >> cmd; 379 | if (cmd == string("Y") || cmd == string("y")) { 380 | cartctrl->buyItem(itemctrl,userctrl->getName()); 381 | cout << "OK" << endl; 382 | } 383 | } 384 | 385 | //requests 386 | int Menu::requestInput(void) { 387 | cout << endl; 388 | cout << "Please input your command: "; 389 | int input; 390 | cin >> input; 391 | return input; 392 | } 393 | string Menu::requestItemID(void) { 394 | cout << endl; 395 | cout << "Please input the id of the item: "; 396 | string input; 397 | cin >> input; 398 | return input; 399 | } 400 | string Menu::requestItemName(void) { 401 | cout << endl; 402 | cout << "Please input the name of the item: "; 403 | string input; 404 | cin >> input; 405 | return input; 406 | } 407 | string Menu::requestItemLabel(void) { 408 | cout << endl; 409 | cout << "Please input the label of the item: "; 410 | string input; 411 | cin >> input; 412 | return input; 413 | } 414 | float Menu::requestItemPrice(void) { 415 | cout << endl; 416 | cout << "Please input the price of the item: "; 417 | float input; 418 | cin >> input; 419 | return input; 420 | } 421 | int Menu::requestItemNum(void) { 422 | cout << endl; 423 | cout << "Please input the number of the item: "; 424 | int input; 425 | cin >> input; 426 | return input; 427 | } 428 | 429 | bool Menu::reloadItemCtrl(void) { 430 | if (itemctrl != NULL) delete(itemctrl); 431 | itemctrl = new ItemCtrl(); 432 | return true; 433 | } 434 | -------------------------------------------------------------------------------- /17-18 下 程序设计基础实验/项目一 网店购物管理系统/Taobao v2.0/build-TaoBao-Desktop_Qt_5_10_0_MSVC2017_64bit-Debug/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # Makefile for building: TaoBao 3 | # Generated by qmake (3.1) (Qt 5.10.0) 4 | # Project: ..\TaoBao\TaoBao.pro 5 | # Template: app 6 | # Command: D:\Program\QT\5.10.0\msvc2017_64\bin\qmake.exe -o Makefile ..\TaoBao\TaoBao.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" 7 | ############################################################################# 8 | 9 | MAKEFILE = Makefile 10 | 11 | first: debug 12 | install: debug-install 13 | uninstall: debug-uninstall 14 | QMAKE = D:\Program\QT\5.10.0\msvc2017_64\bin\qmake.exe 15 | DEL_FILE = del 16 | CHK_DIR_EXISTS= if not exist 17 | MKDIR = mkdir 18 | COPY = copy /y 19 | COPY_FILE = copy /y 20 | COPY_DIR = xcopy /s /q /y /i 21 | INSTALL_FILE = copy /y 22 | INSTALL_PROGRAM = copy /y 23 | INSTALL_DIR = xcopy /s /q /y /i 24 | QINSTALL = D:\Program\QT\5.10.0\msvc2017_64\bin\qmake.exe -install qinstall 25 | QINSTALL_PROGRAM = D:\Program\QT\5.10.0\msvc2017_64\bin\qmake.exe -install qinstall -exe 26 | DEL_FILE = del 27 | SYMLINK = $(QMAKE) -install ln -f -s 28 | DEL_DIR = rmdir 29 | MOVE = move 30 | SUBTARGETS = \ 31 | debug \ 32 | release 33 | 34 | 35 | debug: FORCE 36 | @set MAKEFLAGS=$(MAKEFLAGS) 37 | $(MAKE) -f $(MAKEFILE).Debug 38 | debug-make_first: FORCE 39 | @set MAKEFLAGS=$(MAKEFLAGS) 40 | $(MAKE) -f $(MAKEFILE).Debug 41 | debug-all: FORCE 42 | @set MAKEFLAGS=$(MAKEFLAGS) 43 | $(MAKE) -f $(MAKEFILE).Debug all 44 | debug-clean: FORCE 45 | @set MAKEFLAGS=$(MAKEFLAGS) 46 | $(MAKE) -f $(MAKEFILE).Debug clean 47 | debug-distclean: FORCE 48 | @set MAKEFLAGS=$(MAKEFLAGS) 49 | $(MAKE) -f $(MAKEFILE).Debug distclean 50 | debug-install: FORCE 51 | @set MAKEFLAGS=$(MAKEFLAGS) 52 | $(MAKE) -f $(MAKEFILE).Debug install 53 | debug-uninstall: FORCE 54 | @set MAKEFLAGS=$(MAKEFLAGS) 55 | $(MAKE) -f $(MAKEFILE).Debug uninstall 56 | release: FORCE 57 | @set MAKEFLAGS=$(MAKEFLAGS) 58 | $(MAKE) -f $(MAKEFILE).Release 59 | release-make_first: FORCE 60 | @set MAKEFLAGS=$(MAKEFLAGS) 61 | $(MAKE) -f $(MAKEFILE).Release 62 | release-all: FORCE 63 | @set MAKEFLAGS=$(MAKEFLAGS) 64 | $(MAKE) -f $(MAKEFILE).Release all 65 | release-clean: FORCE 66 | @set MAKEFLAGS=$(MAKEFLAGS) 67 | $(MAKE) -f $(MAKEFILE).Release clean 68 | release-distclean: FORCE 69 | @set MAKEFLAGS=$(MAKEFLAGS) 70 | $(MAKE) -f $(MAKEFILE).Release distclean 71 | release-install: FORCE 72 | @set MAKEFLAGS=$(MAKEFLAGS) 73 | $(MAKE) -f $(MAKEFILE).Release install 74 | release-uninstall: FORCE 75 | @set MAKEFLAGS=$(MAKEFLAGS) 76 | $(MAKE) -f $(MAKEFILE).Release uninstall 77 | 78 | Makefile: ..\TaoBao\TaoBao.pro D:\Program\QT\5.10.0\msvc2017_64\mkspecs\win32-msvc\qmake.conf D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\spec_pre.prf \ 79 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\angle.conf \ 80 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\windows-vulkan.conf \ 81 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\msvc-desktop.conf \ 82 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\qconfig.pri \ 83 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3danimation.pri \ 84 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3danimation_private.pri \ 85 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dcore.pri \ 86 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dcore_private.pri \ 87 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dextras.pri \ 88 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dextras_private.pri \ 89 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dinput.pri \ 90 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dinput_private.pri \ 91 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dlogic.pri \ 92 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dlogic_private.pri \ 93 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquick.pri \ 94 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquick_private.pri \ 95 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickanimation.pri \ 96 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickanimation_private.pri \ 97 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickextras.pri \ 98 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickextras_private.pri \ 99 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickinput.pri \ 100 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickinput_private.pri \ 101 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickrender.pri \ 102 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickrender_private.pri \ 103 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickscene2d.pri \ 104 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickscene2d_private.pri \ 105 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3drender.pri \ 106 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3drender_private.pri \ 107 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_accessibility_support_private.pri \ 108 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axbase.pri \ 109 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axbase_private.pri \ 110 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axcontainer.pri \ 111 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axcontainer_private.pri \ 112 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axserver.pri \ 113 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axserver_private.pri \ 114 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bluetooth.pri \ 115 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bluetooth_private.pri \ 116 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bootstrap_private.pri \ 117 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_concurrent.pri \ 118 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_concurrent_private.pri \ 119 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_core.pri \ 120 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_core_private.pri \ 121 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_dbus.pri \ 122 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_dbus_private.pri \ 123 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designer.pri \ 124 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designer_private.pri \ 125 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designercomponents_private.pri \ 126 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_devicediscovery_support_private.pri \ 127 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_edid_support_private.pri \ 128 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_egl_support_private.pri \ 129 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_eventdispatcher_support_private.pri \ 130 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_fb_support_private.pri \ 131 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_fontdatabase_support_private.pri \ 132 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gamepad.pri \ 133 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gamepad_private.pri \ 134 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gui.pri \ 135 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gui_private.pri \ 136 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_help.pri \ 137 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_help_private.pri \ 138 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_location.pri \ 139 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_location_private.pri \ 140 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimedia.pri \ 141 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimedia_private.pri \ 142 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimediawidgets.pri \ 143 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri \ 144 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_network.pri \ 145 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_network_private.pri \ 146 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_nfc.pri \ 147 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_nfc_private.pri \ 148 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_opengl.pri \ 149 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_opengl_private.pri \ 150 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_openglextensions.pri \ 151 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_openglextensions_private.pri \ 152 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_packetprotocol_private.pri \ 153 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_platformcompositor_support_private.pri \ 154 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_positioning.pri \ 155 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_positioning_private.pri \ 156 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_printsupport.pri \ 157 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_printsupport_private.pri \ 158 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qml.pri \ 159 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qml_private.pri \ 160 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmldebug_private.pri \ 161 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmldevtools_private.pri \ 162 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmltest.pri \ 163 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmltest_private.pri \ 164 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri \ 165 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quick.pri \ 166 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quick_private.pri \ 167 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickcontrols2.pri \ 168 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri \ 169 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickparticles_private.pri \ 170 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri \ 171 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickwidgets.pri \ 172 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickwidgets_private.pri \ 173 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_scxml.pri \ 174 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_scxml_private.pri \ 175 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sensors.pri \ 176 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sensors_private.pri \ 177 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialbus.pri \ 178 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialbus_private.pri \ 179 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialport.pri \ 180 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialport_private.pri \ 181 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sql.pri \ 182 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sql_private.pri \ 183 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_svg.pri \ 184 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_svg_private.pri \ 185 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_testlib.pri \ 186 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_testlib_private.pri \ 187 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_texttospeech.pri \ 188 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_texttospeech_private.pri \ 189 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_theme_support_private.pri \ 190 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uiplugin.pri \ 191 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uitools.pri \ 192 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uitools_private.pri \ 193 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_vulkan_support_private.pri \ 194 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webchannel.pri \ 195 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webchannel_private.pri \ 196 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_websockets.pri \ 197 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_websockets_private.pri \ 198 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webview.pri \ 199 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webview_private.pri \ 200 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_widgets.pri \ 201 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_widgets_private.pri \ 202 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_winextras.pri \ 203 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_winextras_private.pri \ 204 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xml.pri \ 205 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xml_private.pri \ 206 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xmlpatterns.pri \ 207 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri \ 208 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_zlib_private.pri \ 209 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt_functions.prf \ 210 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt_config.prf \ 211 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\win32-msvc\qmake.conf \ 212 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\spec_post.prf \ 213 | .qmake.stash \ 214 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exclusive_builds.prf \ 215 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\msvc-version.conf \ 216 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\toolchain.prf \ 217 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\default_pre.prf \ 218 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\default_pre.prf \ 219 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\resolve_config.prf \ 220 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exclusive_builds_post.prf \ 221 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\default_post.prf \ 222 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qml_debug.prf \ 223 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\precompile_header.prf \ 224 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\warn_on.prf \ 225 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt.prf \ 226 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\resources.prf \ 227 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\moc.prf \ 228 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\opengl.prf \ 229 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\uic.prf \ 230 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qmake_use.prf \ 231 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\file_copies.prf \ 232 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\windows.prf \ 233 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\testcase_targets.prf \ 234 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exceptions.prf \ 235 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\yacc.prf \ 236 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\lex.prf \ 237 | ..\TaoBao\TaoBao.pro \ 238 | D:\Program\QT\5.10.0\msvc2017_64\lib\qtmaind.prl \ 239 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Widgets.prl \ 240 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Gui.prl \ 241 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Core.prl 242 | $(QMAKE) -o Makefile ..\TaoBao\TaoBao.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" 243 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\spec_pre.prf: 244 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\angle.conf: 245 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\windows-vulkan.conf: 246 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\msvc-desktop.conf: 247 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\qconfig.pri: 248 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3danimation.pri: 249 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3danimation_private.pri: 250 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dcore.pri: 251 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dcore_private.pri: 252 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dextras.pri: 253 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dextras_private.pri: 254 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dinput.pri: 255 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dinput_private.pri: 256 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dlogic.pri: 257 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dlogic_private.pri: 258 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquick.pri: 259 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquick_private.pri: 260 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickanimation.pri: 261 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickanimation_private.pri: 262 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickextras.pri: 263 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickextras_private.pri: 264 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickinput.pri: 265 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickinput_private.pri: 266 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickrender.pri: 267 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickrender_private.pri: 268 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickscene2d.pri: 269 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3dquickscene2d_private.pri: 270 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3drender.pri: 271 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_3drender_private.pri: 272 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_accessibility_support_private.pri: 273 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axbase.pri: 274 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axbase_private.pri: 275 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axcontainer.pri: 276 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axcontainer_private.pri: 277 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axserver.pri: 278 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_axserver_private.pri: 279 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bluetooth.pri: 280 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bluetooth_private.pri: 281 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_bootstrap_private.pri: 282 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_concurrent.pri: 283 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_concurrent_private.pri: 284 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_core.pri: 285 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_core_private.pri: 286 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_dbus.pri: 287 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_dbus_private.pri: 288 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designer.pri: 289 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designer_private.pri: 290 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_designercomponents_private.pri: 291 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_devicediscovery_support_private.pri: 292 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_edid_support_private.pri: 293 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_egl_support_private.pri: 294 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_eventdispatcher_support_private.pri: 295 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_fb_support_private.pri: 296 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_fontdatabase_support_private.pri: 297 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gamepad.pri: 298 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gamepad_private.pri: 299 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gui.pri: 300 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_gui_private.pri: 301 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_help.pri: 302 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_help_private.pri: 303 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_location.pri: 304 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_location_private.pri: 305 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimedia.pri: 306 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimedia_private.pri: 307 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimediawidgets.pri: 308 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri: 309 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_network.pri: 310 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_network_private.pri: 311 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_nfc.pri: 312 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_nfc_private.pri: 313 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_opengl.pri: 314 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_opengl_private.pri: 315 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_openglextensions.pri: 316 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_openglextensions_private.pri: 317 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_packetprotocol_private.pri: 318 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_platformcompositor_support_private.pri: 319 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_positioning.pri: 320 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_positioning_private.pri: 321 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_printsupport.pri: 322 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_printsupport_private.pri: 323 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qml.pri: 324 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qml_private.pri: 325 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmldebug_private.pri: 326 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmldevtools_private.pri: 327 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmltest.pri: 328 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qmltest_private.pri: 329 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri: 330 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quick.pri: 331 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quick_private.pri: 332 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickcontrols2.pri: 333 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri: 334 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickparticles_private.pri: 335 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri: 336 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickwidgets.pri: 337 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_quickwidgets_private.pri: 338 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_scxml.pri: 339 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_scxml_private.pri: 340 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sensors.pri: 341 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sensors_private.pri: 342 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialbus.pri: 343 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialbus_private.pri: 344 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialport.pri: 345 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_serialport_private.pri: 346 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sql.pri: 347 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_sql_private.pri: 348 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_svg.pri: 349 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_svg_private.pri: 350 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_testlib.pri: 351 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_testlib_private.pri: 352 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_texttospeech.pri: 353 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_texttospeech_private.pri: 354 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_theme_support_private.pri: 355 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uiplugin.pri: 356 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uitools.pri: 357 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_uitools_private.pri: 358 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_vulkan_support_private.pri: 359 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webchannel.pri: 360 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webchannel_private.pri: 361 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_websockets.pri: 362 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_websockets_private.pri: 363 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webview.pri: 364 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_webview_private.pri: 365 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_widgets.pri: 366 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_widgets_private.pri: 367 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_winextras.pri: 368 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_winextras_private.pri: 369 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xml.pri: 370 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xml_private.pri: 371 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xmlpatterns.pri: 372 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri: 373 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\modules\qt_lib_zlib_private.pri: 374 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt_functions.prf: 375 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt_config.prf: 376 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\win32-msvc\qmake.conf: 377 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\spec_post.prf: 378 | .qmake.stash: 379 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exclusive_builds.prf: 380 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\common\msvc-version.conf: 381 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\toolchain.prf: 382 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\default_pre.prf: 383 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\default_pre.prf: 384 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\resolve_config.prf: 385 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exclusive_builds_post.prf: 386 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\default_post.prf: 387 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qml_debug.prf: 388 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\precompile_header.prf: 389 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\warn_on.prf: 390 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qt.prf: 391 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\resources.prf: 392 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\moc.prf: 393 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\opengl.prf: 394 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\uic.prf: 395 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\qmake_use.prf: 396 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\file_copies.prf: 397 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\win32\windows.prf: 398 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\testcase_targets.prf: 399 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\exceptions.prf: 400 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\yacc.prf: 401 | D:\Program\QT\5.10.0\msvc2017_64\mkspecs\features\lex.prf: 402 | ..\TaoBao\TaoBao.pro: 403 | D:\Program\QT\5.10.0\msvc2017_64\lib\qtmaind.prl: 404 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Widgets.prl: 405 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Gui.prl: 406 | D:\Program\QT\5.10.0\msvc2017_64\lib\Qt5Core.prl: 407 | qmake: FORCE 408 | @$(QMAKE) -o Makefile ..\TaoBao\TaoBao.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" 409 | 410 | qmake_all: FORCE 411 | 412 | make_first: debug-make_first release-make_first FORCE 413 | all: debug-all release-all FORCE 414 | clean: debug-clean release-clean FORCE 415 | -$(DEL_FILE) TaoBao.exp 416 | -$(DEL_FILE) TaoBao.vc.pdb 417 | -$(DEL_FILE) TaoBao.ilk 418 | -$(DEL_FILE) TaoBao.idb 419 | distclean: debug-distclean release-distclean FORCE 420 | -$(DEL_FILE) Makefile 421 | -$(DEL_FILE) .qmake.stash TaoBao.lib TaoBao.pdb 422 | 423 | debug-mocclean: 424 | @set MAKEFLAGS=$(MAKEFLAGS) 425 | $(MAKE) -f $(MAKEFILE).Debug mocclean 426 | release-mocclean: 427 | @set MAKEFLAGS=$(MAKEFLAGS) 428 | $(MAKE) -f $(MAKEFILE).Release mocclean 429 | mocclean: debug-mocclean release-mocclean 430 | 431 | debug-mocables: 432 | @set MAKEFLAGS=$(MAKEFLAGS) 433 | $(MAKE) -f $(MAKEFILE).Debug mocables 434 | release-mocables: 435 | @set MAKEFLAGS=$(MAKEFLAGS) 436 | $(MAKE) -f $(MAKEFILE).Release mocables 437 | mocables: debug-mocables release-mocables 438 | 439 | check: first 440 | 441 | benchmark: first 442 | FORCE: 443 | 444 | $(MAKEFILE).Debug: Makefile 445 | $(MAKEFILE).Release: Makefile 446 | --------------------------------------------------------------------------------