RCommonObject::RCommonObject(bool upkey, QWidget *parent) : QWidget(parent){ upkeyBool = upkey; settingsKeys = new QSettings("klabis", "reception", this); // загружаем настройки клавиш loadSettings(); inclubAction = new QAction(parent); inclubAction->setIcon(QIcon::fromTheme("dialog-ok")); inclubAction->setShortcut(upkey?QKeySequence(listKeys.at(0).at(1)):QKeySequence(listKeys.at(0).at(0))); inclubAction->setText("Приход "+inclubAction->shortcut().toString()); connect(inclubAction,SIGNAL(triggered()),this,SIGNAL(signal_inclub())); p_actions << inclubAction; inclubAction->setDisabled(true); outclubAction = new QAction(parent); outclubAction->setIcon(QIcon::fromTheme("dialog-cancel")); outclubAction->setShortcut(upkey?QKeySequence(listKeys.at(1).at(1)):QKeySequence(listKeys.at(1).at(0))); outclubAction->setText("Уход "+outclubAction->shortcut().toString()); connect(outclubAction,SIGNAL(triggered()),this,SIGNAL(signal_outclub())); p_actions << outclubAction; outclubAction->setDisabled(true); checkAction = new QAction(parent); checkAction->setIcon(QIcon(":/img/check.png")); checkAction->setShortcut(upkey?QKeySequence(listKeys.at(2).at(1)):QKeySequence(listKeys.at(2).at(0))); checkAction->setText("Чек "+checkAction->shortcut().toString()); connect(checkAction,SIGNAL(triggered()),this,SLOT(showCheck())); p_actions << checkAction; checkAction->setEnabled(ECoreObject::instance()->tryAccesMode(103)); blockAction = new QAction(parent); blockAction->setIcon(QIcon(":/img/block.png")); blockAction->setShortcut(upkey?QKeySequence(listKeys.at(3).at(1)):QKeySequence(listKeys.at(3).at(0))); blockAction->setText("Блоки "+blockAction->shortcut().toString()); connect(blockAction,SIGNAL(triggered()),this,SLOT(showBlocks())); p_actions << blockAction; blockAction->setEnabled(ECoreObject::instance()->tryAccesMode(104)); phonesAction = new QAction(parent); phonesAction->setIcon(QIcon::fromTheme("phone")); phonesAction->setShortcut(upkey?QKeySequence(listKeys.at(4).at(1)):QKeySequence(listKeys.at(4).at(0))); phonesAction->setText("Телефоны "+phonesAction->shortcut().toString()); connect(phonesAction,SIGNAL(triggered()),this,SLOT(showPhones())); p_actions << phonesAction; phonesAction->setEnabled(ECoreObject::instance()->tryAccesMode(105)); freezeAction = new QAction(parent); freezeAction->setIcon(QIcon(":/img/freeze.png")); freezeAction->setShortcut(upkey?QKeySequence(listKeys.at(6).at(1)):QKeySequence(listKeys.at(6).at(0))); freezeAction->setText("Заморозка "+freezeAction->shortcut().toString()); connect(freezeAction,SIGNAL(triggered()),this,SLOT(showFreeze())); p_actions << freezeAction; freezeAction->setEnabled(ECoreObject::instance()->tryAccesMode(106)); depositAction = new QAction(parent); depositAction->setIcon(QIcon(":/img/deposit.png")); depositAction->setShortcut(upkey?QKeySequence(listKeys.at(7).at(1)):QKeySequence(listKeys.at(7).at(0))); depositAction->setText("Депозит "+depositAction->shortcut().toString()); connect(depositAction,SIGNAL(triggered()),this,SLOT(showDeposit())); p_actions << depositAction; depositAction->setEnabled(ECoreObject::instance()->tryAccesMode(107)); mailAction = new QAction(parent); mailAction->setIcon(QIcon::fromTheme("mail-message")); mailAction->setShortcut(upkey?QKeySequence(listKeys.at(5).at(1)):QKeySequence(listKeys.at(5).at(0))); mailAction->setText("Сообщения "+mailAction->shortcut().toString()); connect(mailAction,SIGNAL(triggered()),this,SLOT(showMail())); p_actions << mailAction; guestAction = new QAction(parent); guestAction->setIcon(QIcon(":/img/guest.png")); guestAction->setShortcut(upkey?QKeySequence(listKeys.at(8).at(1)):QKeySequence(listKeys.at(8).at(0))); guestAction->setText("Гость "+guestAction->shortcut().toString()); connect(guestAction,SIGNAL(triggered()),this,SLOT(showGuest())); p_actions << guestAction; guestAction->setEnabled(ECoreObject::instance()->tryAccesMode(108)); QAction *rentAction = new QAction(QIcon(":/img/rent.png"),"Аренда",parent); connect(rentAction,SIGNAL(triggered()),this,SLOT(showRent())); p_actions << rentAction; // --- !!!!!!!!!!!! temporary hack !!!!!!!!! --- if(upkey) { phonesAction->setDisabled(true); }}...здесь ничего полезного...// загружаем горячие клавишиvoid RCommonObject::loadSettings(){ QStringList lst; // Карточка клиентов << список в клубе lst << "Alt+3" << "Ctrl+3"; listKeys.append(lst); lst.clear(); lst << "Alt+4" << ""; listKeys.append(lst); lst.clear(); lst << "Alt+6" << "Ctrl+6"; listKeys.append(lst); lst.clear(); lst << "Alt+8" << ""; listKeys.append(lst); lst.clear(); lst << "" << ""; listKeys.append(lst); lst.clear(); lst << "" << ""; listKeys.append(lst); lst.clear(); lst << "" << ""; listKeys.append(lst); lst.clear(); lst << "" << ""; listKeys.append(lst); lst.clear(); lst << "Alt+5" << ""; listKeys.append(lst); // Чек lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); // Поиск lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); lst.clear(); lst << ""; listKeys.append(lst); // Карточка клиентов settingsKeys->beginGroup("Customer_card"); listKeys[0][0] = settingsKeys->value("Prihod", listKeys.at(0).at(0)).toString(); listKeys[1][0] = settingsKeys->value("Uhod", listKeys.at(1).at(0)).toString(); listKeys[2][0] = settingsKeys->value("Chek", listKeys.at(2).at(0)).toString(); listKeys[3][0] = settingsKeys->value("Bloks", listKeys.at(3).at(0)).toString(); listKeys[4][0] = settingsKeys->value("Telephon", listKeys.at(4).at(0)).toString(); listKeys[5][0] = settingsKeys->value("Message", listKeys.at(5).at(0)).toString(); listKeys[6][0] = settingsKeys->value("Freezing", listKeys.at(6).at(0)).toString(); listKeys[7][0] = settingsKeys->value("Deposit", listKeys.at(7).at(0)).toString(); listKeys[8][0] = settingsKeys->value("Quest`", listKeys.at(8).at(0)).toString(); settingsKeys->endGroup(); qDebug()<<listKeys; // Cписок в клубе settingsKeys->beginGroup("List_club"); listKeys[0][1] = settingsKeys->value("Prihod", listKeys.at(0).at(1)).toString(); listKeys[1][1] = settingsKeys->value("Uhod", listKeys.at(1).at(1)).toString(); listKeys[2][1] = settingsKeys->value("Chek", listKeys.at(2).at(1)).toString(); listKeys[3][1] = settingsKeys->value("Bloks", listKeys.at(3).at(1)).toString(); listKeys[4][1] = settingsKeys->value("Telephon", listKeys.at(4).at(1)).toString(); listKeys[5][1] = settingsKeys->value("Message", listKeys.at(5).at(1)).toString(); listKeys[6][1] = settingsKeys->value("Freezing", listKeys.at(6).at(1)).toString(); listKeys[7][1] = settingsKeys->value("Deposit", listKeys.at(7).at(1)).toString(); listKeys[8][1] = settingsKeys->value("Quest`", listKeys.at(8).at(1)).toString(); settingsKeys->endGroup(); // Чек settingsKeys->beginGroup("Check"); listKeys[9][0] = settingsKeys->value("Add", listKeys.at(9).at(0)).toString(); listKeys[10][0] = settingsKeys->value("Del", listKeys.at(10).at(0)).toString(); listKeys[11][0] = settingsKeys->value("Save", listKeys.at(11).at(0)).toString(); listKeys[12][0] = settingsKeys->value("Print", listKeys.at(12).at(0)).toString(); listKeys[13][0] = settingsKeys->value("Pay", listKeys.at(13).at(0)).toString(); settingsKeys->endGroup(); // Поиск settingsKeys->beginGroup("Search"); listKeys[14][0] = settingsKeys->value("Find", listKeys.at(14).at(0)).toString(); listKeys[15][0] = settingsKeys->value("Clear", listKeys.at(15).at(0)).toString(); listKeys[16][0] = settingsKeys->value("View", listKeys.at(16).at(0)).toString(); listKeys[17][0] = settingsKeys->value("Prihod", listKeys.at(17).at(0)).toString(); settingsKeys->endGroup();}// сохраняем горячие клавишиvoid RCommonObject::GetListKeys(const QList<QStringList> &list){ listKeys = list; settingsKeys->clear(); // Карточка клиентов settingsKeys->beginGroup("Customer_card"); settingsKeys->setValue("Prihod", listKeys.at(0).at(0)); settingsKeys->setValue("Uhod", listKeys.at(1).at(0)); settingsKeys->setValue("Chek", listKeys.at(2).at(0)); settingsKeys->setValue("Bloks", listKeys.at(3).at(0)); settingsKeys->setValue("Telephon", listKeys.at(4).at(0)); settingsKeys->setValue("Message", listKeys.at(5).at(0)); settingsKeys->setValue("Freezing", listKeys.at(6).at(0)); settingsKeys->setValue("Deposit", listKeys.at(7).at(0)); settingsKeys->setValue("Quest`", listKeys.at(8).at(0)); settingsKeys->endGroup(); // Cписок в клубе settingsKeys->beginGroup("List_club"); settingsKeys->setValue("Prihod", listKeys.at(0).at(1)); settingsKeys->setValue("Uhod", listKeys.at(1).at(1)); settingsKeys->setValue("Chek", listKeys.at(2).at(1)); settingsKeys->setValue("Bloks", listKeys.at(3).at(1)); settingsKeys->setValue("Telephon", listKeys.at(4).at(1)); settingsKeys->setValue("Message", listKeys.at(5).at(1)); settingsKeys->setValue("Freezing", listKeys.at(6).at(1)); settingsKeys->setValue("Deposit", listKeys.at(7).at(1)); settingsKeys->setValue("Quest`", listKeys.at(8).at(1)); settingsKeys->endGroup(); // Чек settingsKeys->beginGroup("Check"); settingsKeys->setValue("Add", listKeys.at(9).at(0)); settingsKeys->setValue("Del", listKeys.at(10).at(0)); settingsKeys->setValue("Save", listKeys.at(11).at(0)); settingsKeys->setValue("Print", listKeys.at(12).at(0)); settingsKeys->setValue("Pay", listKeys.at(13).at(0)); settingsKeys->endGroup(); // Поиск settingsKeys->beginGroup("Search"); settingsKeys->setValue("Find", listKeys.at(14).at(0)); settingsKeys->setValue("Clear", listKeys.at(15).at(0)); settingsKeys->setValue("View", listKeys.at(16).at(0)); settingsKeys->setValue("Prihod", listKeys.at(17).at(0)); settingsKeys->endGroup(); setHotKeys();}void RCommonObject::setHotKeys(){ qDebug()<<"назначаем клавиши"; inclubAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(0).at(1)):QKeySequence(listKeys.at(0).at(0))); outclubAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(1).at(1)):QKeySequence(listKeys.at(1).at(0))); checkAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(2).at(1)):QKeySequence(listKeys.at(2).at(0))); blockAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(3).at(1)):QKeySequence(listKeys.at(3).at(0))); phonesAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(4).at(1)):QKeySequence(listKeys.at(4).at(0))); mailAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(5).at(1)):QKeySequence(listKeys.at(5).at(0))); freezeAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(6).at(1)):QKeySequence(listKeys.at(6).at(0))); depositAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(7).at(1)):QKeySequence(listKeys.at(7).at(0))); guestAction->setShortcut(upkeyBool?QKeySequence(listKeys.at(8).at(1)):QKeySequence(listKeys.at(8).at(0)));}