| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef FRMPRINCIPAL_H |
| 20 |
#define FRMPRINCIPAL_H |
| 21 |
|
| 22 |
#include <QtGui> |
| 23 |
#include <QtWidgets/QTreeWidget> |
| 24 |
#include <QtWidgets/QTreeWidgetItem> |
| 25 |
#include <QtWidgets/QTabWidget> |
| 26 |
#include <QtWidgets/QUndoStack> |
| 27 |
#include <QtWidgets/QMenu> |
| 28 |
#include <QtWidgets/QActionGroup> |
| 29 |
#include <QtWidgets/QToolBar> |
| 30 |
#include <QtWidgets/QMainWindow> |
| 31 |
#include <QTranslator> |
| 32 |
#include <QtWidgets/QProgressDialog> |
| 33 |
|
| 34 |
#include "frmprincipal.h" |
| 35 |
#include "tauler.h" |
| 36 |
#include "rellotge.h" |
| 37 |
|
| 38 |
class frmPrincipal : public QMainWindow |
| 39 |
{ |
| 40 |
Q_OBJECT |
| 41 |
|
| 42 |
public: |
| 43 |
frmPrincipal(); |
| 44 |
|
| 45 |
QFrame *jocFram; |
| 46 |
|
| 47 |
QTreeWidget *arbreModalitatsJocTreeWidget; |
| 48 |
QTreeWidget *arbreModalitatsJocPersonalitzatsTreeWidget; |
| 49 |
|
| 50 |
QList<QString> dadesArxiuData; |
| 51 |
|
| 52 |
|
| 53 |
QTabWidget *tabArbres; |
| 54 |
|
| 55 |
Tauler *taulerJoc; |
| 56 |
|
| 57 |
QUndoStack* movimentsUndoStack; |
| 58 |
|
| 59 |
Rellotge *rellotgeLabel; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
void llegeixArxiuData(); |
| 66 |
void carregaArbreModalitatsJoc(); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
QString afageixTipusMovimentNomJoc(QString tipus); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
bool llegeixArxiuDataPersonalitzats(); |
| 77 |
|
| 78 |
|
| 79 |
void carregaArbreModalitatsJocPersonalitzats(); |
| 80 |
i |
| 81 |
|
| 82 |
|
| 83 |
QString posaIconeOK(QString codiJoc); |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
QString hihaRecordJoc(QString codiJoc); |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
QStringList solucionaJocActual_movimentsEliminats; |
| 92 |
QStringList solucionaJocActual_movimentsJaRealitzats; |
| 93 |
QStringList solucionaJocActual_movimentsPosiblesActuals; |
| 94 |
QStringList solucioJocActual_configuracionsEliminades; |
| 95 |
QStringList solucioJocActual_configuracionsEliminadesPerDesar; |
| 96 |
QString solucioJocActual_configuracioInicial; |
| 97 |
QString jocActual_configuracioInicialFitxesMarcades; |
| 98 |
QString solucionaJocActual_darrerMoviment; |
| 99 |
void actualitzaConfiguracionsInicials(); |
| 100 |
|
| 101 |
QStringList solucionsTrobades; |
| 102 |
|
| 103 |
QAction *iniciSolucioAction; |
| 104 |
|
| 105 |
int retrocedeixMoviment=0; |
| 106 |
|
| 107 |
|
| 108 |
void desaSolucions(); |
| 109 |
k |
| 110 |
void desaSolucions1(); |
| 111 |
|
| 112 |
|
| 113 |
void veureSolucionsSlot(); |
| 114 |
|
| 115 |
void comprovaArxiuSolucions(); |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
/ |
| 120 |
bool comprovaDadesSolucions(); |
| 121 |
|
| 122 |
QString missatgeNumeroMoviments(int maxim=0); |
| 123 |
|
| 124 |
|
| 125 |
QTreeWidget *arbreSolucionsTreeWidget; |
| 126 |
|
| 127 |
|
| 128 |
void mostraMissatge(int codi); |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
o |
| 133 |
|
| 134 |
|
| 135 |
bool solitariAtzar_esAtzar(QString joc); |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
void solitariPersonalitzat_dadesFitxes(); |
| 141 |
o |
| 142 |
|
| 143 |
|
| 144 |
bool solitariPersonalitzat_esPersonalitzat(QString joc); |
| 145 |
|
| 146 |
|
| 147 |
it) |
| 148 |
|
| 149 |
void solitariPersonalitzat_desarSolitari(); |
| 150 |
|
| 151 |
t |
| 152 |
|
| 153 |
|
| 154 |
void solitariPersonalitzat_eliminaArxiuSolucio(); |
| 155 |
|
| 156 |
) |
| 157 |
|
| 158 |
|
| 159 |
int tipusJocActual; |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
u |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
void setArbreJocsActual(int valor); |
| 168 |
int arbreJocsActual() const{ |
| 169 |
return p_arbreJocsActual;} |
| 170 |
|
| 171 |
QString nomArxiuJoc(int tipus); |
| 172 |
private slots: |
| 173 |
|
| 174 |
void closeEvent(QCloseEvent* event); |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
void gestioTipusDeJocASeleccionar(); |
| 181 |
|
| 182 |
c |
| 183 |
s |
| 184 |
|
| 185 |
void seleccioModalitatJoc(); |
| 186 |
|
| 187 |
r |
| 188 |
r |
| 189 |
a |
| 190 |
r |
| 191 |
|
| 192 |
void canviItemArbreJoc(QTreeWidgetItem *actual, QTreeWidgetItem *anterior); |
| 193 |
|
| 194 |
ó |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
void canviTabSeleccionat( int tabSeleccionat); |
| 199 |
|
| 200 |
QString movimentACoordenades(QString inici,QString final); |
| 201 |
QString coordenadesAMoviment(QString coordenades); |
| 202 |
|
| 203 |
void veureRecordsPersonals(); |
| 204 |
void eliminaRecordsPersonals(); |
| 205 |
|
| 206 |
void canviaIdioma(QAction *action); |
| 207 |
|
| 208 |
void creditsProgramaSlot(); |
| 209 |
void webProgramaSlot(); |
| 210 |
void webProgramaPecesSlot(); |
| 211 |
|
| 212 |
void ajudaSlot(); |
| 213 |
void agraimentSlot(); |
| 214 |
|
| 215 |
/ |
| 216 |
void solucionaJocRapid(); |
| 217 |
bool comprovaExisteixenMovimentsPossibles(); |
| 218 |
void solucionaJocActual_carregaSolucio(); |
| 219 |
void solucionaJocActual_carregaSolucio1(); |
| 220 |
int solucionaJocActual_numeroDeFitxesDelJoc(); |
| 221 |
void solucionaJocActual_Inicia(); |
| 222 |
void solucionaJocActual_ControlJocPersonalitzatModificat(); |
| 223 |
void solucionaJocActual_CarregaMovimentsInicialsArbre(); |
| 224 |
void solucionaJocActual_comencaRecerca(); |
| 225 |
void solucionaJocActual_eliminaMovimentsPosteriors(); |
| 226 |
void solucionaJocActual_eliminaConfiguracionsPosteriors(QString config); |
| 227 |
void solucionaJocActual_RecercaIterativa_ExhaustivaInici(int numFitxesInicialsJoc, int mantenirMoviment=0); |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
void solucionaJocActual_RecercaIterativa_Exhaustiva1(QProgressDialog *progres, int numeroFitxesJoc); |
| 232 |
|
| 233 |
|
| 234 |
/ |
| 235 |
void solucionaJoc_ForcaBruta(); |
| 236 |
void solucioJocActual_RecercaIterativa_escriuDesaMovimentRealitzat(int tabulacio,QString cadenaMoviment); |
| 237 |
|
| 238 |
|
| 239 |
void solucioJocActual_desarJocPersonalitzat(); |
| 240 |
r |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
void desaConfiguracionsEliminades(int tipus=0); |
| 245 |
void carregaConfiguracionsEliminades(); |
| 246 |
void eliminaArxiuConfgEliminades(); |
| 247 |
|
| 248 |
|
| 249 |
s |
| 250 |
/ |
| 251 |
void desaMovimentsJoc(QString moviment); |
| 252 |
c |
| 253 |
/ |
| 254 |
int numeroFitxesConfiguracioActualJoc(QString configuracioActual); |
| 255 |
|
| 256 |
|
| 257 |
. |
| 258 |
|
| 259 |
void eliminaArxiuMovimentsJoc(); |
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
void eliminaArxiu(int codi); |
| 267 |
|
| 268 |
void carregaSolucions(); |
| 269 |
bool comprovaArxiuDeSolucions(); |
| 270 |
|
| 271 |
l |
| 272 |
void carregaSolucio(QTreeWidgetItem*, int); |
| 273 |
ó |
| 274 |
void carregaSolucio1(); |
| 275 |
|
| 276 |
void iniciSolucioSlot(int pmoviment=0); |
| 277 |
void iniciSolucioSlotIndex(int index=0); |
| 278 |
ó |
| 279 |
void finalSolucioSlot(bool marcaFinal=false); |
| 280 |
|
| 281 |
|
| 282 |
void pausaJocSlot(); |
| 283 |
|
| 284 |
i |
| 285 |
void sugereixMovimentSlot(); |
| 286 |
|
| 287 |
c |
| 288 |
|
| 289 |
|
| 290 |
ó |
| 291 |
|
| 292 |
|
| 293 |
void dobleClickArbreJoc(QTreeWidgetItem *item, int columne); |
| 294 |
|
| 295 |
s |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
void seleccioModalitatJocPersonalitzat(); |
| 300 |
|
| 301 |
private: |
| 302 |
|
| 303 |
void creaAcccions(); |
| 304 |
void creaMenus(); |
| 305 |
void creaIdiomaMenu(); |
| 306 |
void creaBarraTasques(); |
| 307 |
|
| 308 |
void comprovaDirectoriHome(); |
| 309 |
|
| 310 |
void comprovaRegistre(); |
| 311 |
|
| 312 |
void tradueixGUI(); |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
void solitariAtzar_generaJoc(); |
| 317 |
int solitariAtzar_tipusMovimentGenerador(int tipusMoviementGenerat, |
| 318 |
QString &tipusFitxa); |
| 319 |
void solitariAtzar_carregaDadesArbreJoc(QString codi,QString FilesColumnes, |
| 320 |
QString dadesFitxes); |
| 321 |
QString solitariAtzar_inverteixSolucioJocGenerat(); |
| 322 |
QString solitariAtzar_coordenadesAMoviment(QString coordenades); |
| 323 |
i |
| 324 |
|
| 325 |
|
| 326 |
void solitariAtzar_desaSolucio(); |
| 327 |
void solitariAtzar_generaImatge(); |
| 328 |
void solitariAtzar_eliminaArxiuSolucio(); |
| 329 |
ó |
| 330 |
QString solitariAtzar_solucio; |
| 331 |
|
| 332 |
bool solitariAtzar_CarregaSolucio(); |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
à |
| 338 |
|
| 339 |
|
| 340 |
void solitariPersonalitzat_comprovaArbre(); |
| 341 |
|
| 342 |
|
| 343 |
QString solitariPersonalitzat_afegeixJoc(QStringList dadesJocList); |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
void solitariPersonalitzat_desaJocArxiu(QString codi,QStringList dadesFitxes, |
| 348 |
QString codiNom); |
| 349 |
|
| 350 |
|
| 351 |
QString solitariPersonalitzat_nouCodiJoc(bool nou); |
| 352 |
|
| 353 |
c |
| 354 |
t |
| 355 |
|
| 356 |
QString seguentCodiSolitariPersonalitzat; |
| 357 |
|
| 358 |
i |
| 359 |
|
| 360 |
|
| 361 |
void solitariPersonalitzat_renomenaArxiuSolucio(QString nouCodi); |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
bool esSolitariAmbFinalMarcat(QString dadesFitxes); |
| 369 |
|
| 370 |
e |
| 371 |
|
| 372 |
|
| 373 |
bool noHiHaSolucionsArbreSolucions(); |
| 374 |
|
| 375 |
|
| 376 |
) |
| 377 |
|
| 378 |
QString nomDelJoc(QString codi, bool complet=true); |
| 379 |
|
| 380 |
int p_arbreJocsActual; |
| 381 |
|
| 382 |
|
| 383 |
QAction *surtAction; |
| 384 |
|
| 385 |
QAction *veureRecordsPersonalsAction; |
| 386 |
QAction *eliminaRecordsPersonalsAction; |
| 387 |
|
| 388 |
QAction *reiniciaJocActual; |
| 389 |
|
| 390 |
QAction *undoAction; |
| 391 |
QAction *redoAction; |
| 392 |
|
| 393 |
QAction *pausaAction; |
| 394 |
QAction *sugereixMovimentAction; |
| 395 |
|
| 396 |
|
| 397 |
QAction *ajudaAction; |
| 398 |
QAction *colaboraPrograma; |
| 399 |
QAction *creditsPrograma; |
| 400 |
QAction *agraiment; |
| 401 |
QAction *webProgramaAction; |
| 402 |
QAction *webProgramaPecesAction; |
| 403 |
|
| 404 |
QAction *solucionaJocActual; |
| 405 |
|
| 406 |
QAction *solucionaJocActualForcaBruta; |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
QTranslator *frm_qt_translator; |
| 414 |
QTranslator *frm_Translator; |
| 415 |
|
| 416 |
|
| 417 |
QMenu *aplicacioMenu; |
| 418 |
QMenu *movimentsMenu; |
| 419 |
QMenu *idiomaMenu; |
| 420 |
QActionGroup *idiomaActionGroup; |
| 421 |
QMenu *ajudaMenu; |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
QToolBar *aplicacioToolBar; |
| 426 |
QToolBar *veureSolucionsToolBar; |
| 427 |
|
| 428 |
QTime rellotgeQTime; |
| 429 |
|
| 430 |
void actualitzaCodisArxiusDeSolucio(); |
| 431 |
|
| 432 |
protected: |
| 433 |
|
| 434 |
void resizeEvent ( QResizeEvent * event ); |
| 435 |
|
| 436 |
|
| 437 |
}; |
| 438 |
|
| 439 |
#endif |