HideBlock::HideBlock(QString title, QWidget *parent) : QFrame(parent) { QGridLayout *mainLayout = new QGridLayout; mainLayout->setContentsMargins(0,0,0,0); mainLayout->setSpacing(0); setLayout(mainLayout); this->setStyleSheet("QFrame {margin-bottom: 30px;}"); btnTitle = new QToolButton; btnTitle->setText(title); btnTitle->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); btnTitle->setStyleSheet("QToolButton {border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.1);} QToolButton:hover {border: 1px solid white; background: rgba(255,255,255,.3);}"); btnTitle->setIcon(QIcon(":/img/down.png")); btnTitle->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); mainLayout->addWidget(btnTitle); connect(btnTitle,SIGNAL(clicked()),this,SLOT(showBlock())); block = new QFrame; block->hide(); block->setStyleSheet("QFrame {border: 1px solid rgba(255,255,255,.5); border-top: none;} QLabel {border: none; margin: 0px;} QToolButton {border: 1px solid rgba(255,255,255,.5); border-radius: 5px;}"); mainLayout->addWidget(block); }
int main(int argc, char** argv) { // save argv, argc for initialization of GLUT char** orig_argv = argv; int orig_argc = argc; bool configured = false; bool graphics = true; char* port = "5000"; --argc; progname = *argv++; while (argc > 0 && (argv[0][0] == '-')) { switch (argv[0][1]) { case 'c': if (configured) help(); configFile = argv[1]; argc--; argv++; configured = true; break; case 'p': port = argv[1]; argc--; argv++; break; case 'i': stopwhenidle = atoi(argv[1]); argc--; argv++; break; case 'd': debug = true; break; case 't': graphics = false; testfile = argv[1]; argc--; argv++; break; case 'n': graphics = false; break; case 'D': vmUseThreads = false; break; case 'r': if (configured) help(); configCount = 0; configured = true; break; case 'R': if (configured) help(); configCount = atoi(argv[1]); argc--; argv++; configured = true; break; default: help(); } argc--; argv++; } if (debug) fprintf(stdout, "initial configuration\n"); // start timer initTimeKeeping(); // vm initialization vmInit(port); fprintf(stderr, "Listening on %s\n", port); if (vmUseThreads) msg2vm(NULL, CMD_MODE_ND, 0); // create blocklist and initialize mutex initBlockList(); // see if we are running a test if (testfile) configured = configtest(testfile); if (!configured) { help(); } else { if (configFile != NULL) readConfig(configFile); else randomConfig(configCount); } if (graphics) { // initialize viewer viewer_init(orig_argc, orig_argv); // GL loop indefinitely event_loop(); } else { fprintf(stderr, "Running without graphics\n"); int idle = 0; while (1) { Block *block; sleep(1); int changes = 0; ForEachBlock(block) { if (block->msgTargetsDelta > 0) changes++; } if (changes == 0) { idle++; if ((stopwhenidle > 0) && (idle > stopwhenidle)) { printf("All Done\n"); msg2vm(NULL, STOP, 0); } continue; } idle = 0; fprintf(stderr, "\n---- %d\n", changes); // something changed ForEachBlock(block) { if (block->msgTargetsDelta > 0) { block->msgTargets += block->msgTargetsDelta; block->msgTargetsDelta = 0; showBlock(stderr, block); } if (checkTest(0)) { msg2vm(NULL, STOP, 0); } } fprintf(stderr, "\n"); } } // we are all done return 0; }