int testView(int argc, char *argv[]) { // Yui's tester for the window. you can mimic the way to call thing from here bool r = false; QApplication app(argc, argv); View window(1000); BitRep bitr(15,15); //window.refresh(); for(int x = 0; x < 15; x++) { for(int y = 0; y<15; y++) { bitr.setBit(x,y,r); r = !r; } } window.load(bitr); window.show(); return app.exec(); }
/////////////////////////////////////////////// // // // 初期設定 // // // /////////////////////////////////////////////// void init(void){ int i; St=log((double)FFT_SIZE)/log(2.0)+0.5; // FFTアルゴリズムの段数の算出 +0.5はintへの対応 omega=2.0*M_PI/FFT_SIZE; bitr();Wnk(); }
void MainWindow::populateNodeMenu(QMenu* menu, bool recenter, Viewport* v) { QDirIterator bitr(App::instance()->bundledNodePath(), QDirIterator::Subdirectories); QDirIterator uitr(App::instance()->userNodePath(), QDirIterator::Subdirectories); QList<QRegExp> title_regexs= {QRegExp(".*title\\('+([^']+)'+\\).*"), QRegExp(".*title\\(\"+([^\"]+)\"+\\).*")}; // Extract all of valid filenames into a QStringList. QStringList node_filenames; for (auto itr : {&bitr, &uitr}) { while (itr->hasNext()) { auto n = itr->next(); if (n.endsWith(".node")) node_filenames.append(n); } } // Sort the list, then populate menus. QMap<QString, QPair<QStringList, NodeConstructorFunction>> nodes; QStringList node_titles; for (auto n : node_filenames) { QFile file(n); if (!file.open(QIODevice::ReadOnly)) continue; QTextStream in(&file); QString txt = in.readAll(); // Find the menu structure for this node auto split = n.split('/'); while (split.first() != "nodes") split.removeFirst(); split.removeFirst(); // Attempt to extract the title with a regex; // falling back to the node's filename otherwise. QString title = split.last().replace(".node",""); split.removeLast(); for (auto& regex : title_regexs) if (regex.exactMatch(txt)) title = regex.capturedTexts()[1]; QString name = "n*"; if (title.size() > 0 && title.at(0).isLetter()) name = title.at(0).toLower() + QString("*"); NodeConstructorFunction constructor = [=](Graph *r){ return new Node(name.toStdString(), txt.toStdString(), r); }; nodes[title] = QPair<QStringList, NodeConstructorFunction>( split, constructor); node_titles.append(title); } // Put all of the nodes into the Add menu, deferring Export nodes // until the end (after a separator). node_titles.sort(); QStringList deferred; for (auto title : node_titles) if (nodes[title].first.contains("Export")) deferred << title; else addNodeToMenu(nodes[title].first, title, menu, recenter, nodes[title].second, v); menu->addSeparator(); for (auto title : deferred) addNodeToMenu(nodes[title].first, title, menu, recenter, nodes[title].second, v); }