const char *SaveLoad_v6::getDescription(const char *fileName) const { const SaveFile *saveFile = getSaveFile(fileName); if (saveFile) return saveFile->description; return 0; }
SaveLoad::SaveMode SaveLoad_v6::getSaveMode(const char *fileName) const { const SaveFile *saveFile = getSaveFile(fileName); if (saveFile) return saveFile->mode; return kSaveModeNone; }
SaveHandler *SaveLoad_v6::getHandler(const char *fileName) const { const SaveFile *saveFile = getSaveFile(fileName); if (saveFile) return saveFile->handler; return 0; }
/*! \brief Constructor */ MyLocalDirPanel::MyLocalDirPanel(QWidget * parent) : XLet(parent) { setTitle( tr("Personal Directory") ); m_searchBox = new SearchDialog(this); connect(m_searchBox, SIGNAL(findNext()), this, SLOT(findNext())); QVBoxLayout *vlayout = new QVBoxLayout(this); // button line QHBoxLayout *hlayout = new QHBoxLayout(); QPushButton *addNewBtn = new QPushButton(tr("&New Contact")); connect(addNewBtn, SIGNAL(clicked()), this, SLOT(openNewContactDialog())); hlayout->addWidget( addNewBtn ); QPushButton *exportBtn = new QPushButton(tr("&Export Contacts")); connect(exportBtn, SIGNAL(clicked()), this, SLOT(exportContacts()) ); hlayout->addWidget( exportBtn ); QPushButton *importBtn = new QPushButton(tr("&Import Contacts")); connect(importBtn, SIGNAL(clicked()), this, SLOT(importContacts()) ); hlayout->addWidget( importBtn ); QPushButton *searchBtn = new QPushButton(tr("&Search")); connect(searchBtn, SIGNAL(clicked()), m_searchBox, SLOT(show()) ); hlayout->addWidget( searchBtn ); QPushButton *removeAllBtn = new QPushButton(tr("&Remove all Contacts")); connect(removeAllBtn, SIGNAL(clicked()), this, SLOT(removeAllContacts()) ); hlayout->addWidget( removeAllBtn ); vlayout->addLayout(hlayout); m_table = new ExtendedTableWidget; m_table->setEditable( true ); QStringList columnNames; columnNames.append(tr("First Name")); columnNames.append(tr("Last Name")); columnNames.append(tr("Phone Number")); columnNames.append(tr("Email Address")); columnNames.append(tr("Company")); columnNames.append(tr("Fax Number")); columnNames.append(tr("Mobile Number")); m_table->setColumnCount(contacts_index.size()); m_table->setHorizontalHeaderLabels(columnNames); m_table->setSortingEnabled(true); vlayout->addWidget(m_table); QFile file(getSaveFile()); file.copy(getBackupFile()); loadFromFile(file); }
void Save::makeSave(CIndieLib* mI, Ship* mShip, vector<Planet*>& mPlanets) { if (mShip != NULL && mShip->getHealth() > 0) { setMI(mI); getSaveFile()->open("../SpaceGame/Saves/quickSave.txt", ios::trunc); if (!getSaveFile()->is_open()) { writeError(1000, 100, "Save", "Can't open file for writing!"); return; } writeShip(mShip); short int i = 0; for (vector<Planet*>::iterator it = mPlanets.begin(); it != mPlanets.end(); ++it) { writePlanet(*it, i); i++; } getSaveFile()->close(); } }
int DownloadChild::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: finished(); break; case 1: download(); break; case 2: setURL((*reinterpret_cast< QString*(*)>(_a[1]))); break; case 3: { QString* _r = getURL(); if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; } break; case 4: setSaveFile((*reinterpret_cast< QString*(*)>(_a[1]))); break; case 5: { QString* _r = getSaveFile(); if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; } break; case 6: setOpt((*reinterpret_cast< QString*(*)>(_a[1]))); break; case 7: { QString* _r = getOpt(); if (_a[0]) *reinterpret_cast< QString**>(_a[0]) = _r; } break; default: ; } _id -= 8; } return _id; }
void Save::writeLine(string key, string value) { *getSaveFile() << "[" + key + "]=[" + value + "]\n"; }
///sprawdza sygnały z myszy i klawiatury i wykonuje odpowiednie rzeczy bool checkInputs() { bool quit = false; auto effectInstanceList=getEffectInstanceList(); auto controllerInstanceList=getControllerInstanceList(); while (SDL_PollEvent(&event)) { const Uint8 *state = SDL_GetKeyboardState(NULL); switch(event.type) { case SDL_QUIT: quit = true; break; case SDL_MOUSEBUTTONDOWN: { int x=event.button.x; int y=event.button.y; if(event.button.button==SDL_BUTTON_LEFT && !(state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]) && !(state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL])) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { if(it->second->receiveClick(x, y, ME_PRESS))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { if(it->second->receiveClick(x, y, ME_PRESS))break; } } else if(event.button.button==SDL_BUTTON_RIGHT || (event.button.button==SDL_BUTTON_LEFT && (state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { if(it->second->receiveSecondClick(x, y, ME_PRESS))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { if(it->second->receiveSecondClick(x, y, ME_PRESS))break; } } else if(event.button.button==SDL_BUTTON_MIDDLE || (event.button.button==SDL_BUTTON_LEFT && (state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();) { auto it2=it; ++it; if(it2->second->receiveThridClick(x, y, ME_PRESS))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { auto it2=it; ++it; if(it2->second->receiveThridClick(x, y, ME_PRESS))break; } } } break; case SDL_MOUSEBUTTONUP: { int x=event.button.x; int y=event.button.y; if(event.button.button==SDL_BUTTON_LEFT && !(state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]) && !(state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL])) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { it->second->receiveClick(x, y, ME_RELEASE); } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { it->second->receiveClick(x, y, ME_RELEASE); } } else if(event.button.button==SDL_BUTTON_RIGHT || (event.button.button==SDL_BUTTON_LEFT && (state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { it->second->receiveSecondClick(x, y, ME_RELEASE); } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { it->second->receiveSecondClick(x, y, ME_RELEASE); } } else if(event.button.button==SDL_BUTTON_MIDDLE || (event.button.button==SDL_BUTTON_LEFT && (state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();) { auto it2=it; ++it; it2->second->receiveThridClick(x, y, ME_RELEASE); } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { auto it2=it; ++it; it2->second->receiveThridClick(x, y, ME_RELEASE); } } } break; case SDL_MOUSEMOTION: { int x=event.button.x; int y=event.button.y; if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT) && !(state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]) && !(state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL])) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { if(it->second->receiveClick(x, y, ME_REPEAT))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { if(it->second->receiveClick(x, y, ME_REPEAT))break; } } else if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT) || (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT) && (state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();++it) { if(it->second->receiveSecondClick(x, y, ME_REPEAT))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { if(it->second->receiveSecondClick(x, y, ME_REPEAT))break; } } else if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_MIDDLE) || (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT) && (state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]))) { for(auto it=effectInstanceList->rbegin();it!=effectInstanceList->rend();) { auto it2=it; ++it; if(it2->second->receiveThridClick(x, y, ME_REPEAT))break; } for(auto it=controllerInstanceList->rbegin();it!=controllerInstanceList->rend();++it) { auto it2=it; ++it; if(it2->second->receiveThridClick(x, y, ME_REPEAT))break; } } } break; case SDL_KEYDOWN: auto it=effectInstanceList->begin(); for(;it!=effectInstanceList->end();++it) { if(it->second->receiveKeyboardEvent(event.key.keysym.scancode))break; } if(it==effectInstanceList->end()) effectCreator.receiveKeyboardEvent(event.key.keysym.scancode); if((state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]) && state[SDL_SCANCODE_S]) { getSaveFile(fileStr, MAX_PATH); Effect::saveToFile(fileStr); } else if((state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]) && state[SDL_SCANCODE_L]) { Effect::saveToFile("session_before_load.cello"); Effect::clearAll(); getOpenFile(fileStr, MAX_PATH); Effect::loadFromFile(fileStr); } else if((state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]) && (state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]) && state[SDL_SCANCODE_E]) { Effect::saveToFile("session_before_erase.cello"); Effect::clearAll(); } else if((state[SDL_SCANCODE_LALT] || state[SDL_SCANCODE_RALT]) && state[SDL_SCANCODE_R]) { OSCConn::recordToFile(); } else if(!(state[SDL_SCANCODE_LSHIFT] || state[SDL_SCANCODE_RSHIFT]) && (state[SDL_SCANCODE_LCTRL] || state[SDL_SCANCODE_RCTRL]) && state[SDL_SCANCODE_R]) { OSCConn::startRecord(); } else if((state[SDL_SCANCODE_LSHIFT] || state[SDL_SCANCODE_RSHIFT]) && state[SDL_SCANCODE_R]) { OSCConn::stopRecord(); } break; } } return quit; }
/*! \brief Destructor */ MyLocalDirPanel::~MyLocalDirPanel() { // qDebug() << Q_FUNC_INFO; QFile file(getSaveFile()); saveToFile( file ); }