1 /** 2 * UGENE - Integrated Bioinformatics Tools. 3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru> 4 * http://ugene.net 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301, USA. 20 */ 21 22 #ifndef _U2_GUI_TASK_TREE_VIEW_UTILS_H_ 23 #define _U2_GUI_TASK_TREE_VIEW_UTILS_H_ 24 25 #include "GTGlobals.h" 26 27 class QTreeWidget; 28 class QTreeWidgetItem; 29 30 namespace U2 { 31 class Task; 32 33 class SchedulerListener : public QObject { 34 Q_OBJECT 35 public: 36 SchedulerListener(); 37 38 int getRegisteredTaskCount() const; 39 void reset(); 40 41 private slots: 42 void sl_taskRegistered(); 43 44 private: 45 int registeredTaskCount; 46 }; 47 48 class GTUtilsTaskTreeView { 49 public: 50 static void waitTaskFinished(HI::GUITestOpStatus &os, long timeoutMillis = 180000); 51 static void click(HI::GUITestOpStatus &os, const QString &itemName, Qt::MouseButton b = Qt::LeftButton); 52 static void openView(HI::GUITestOpStatus &os); 53 static void toggleView(HI::GUITestOpStatus &os); 54 static void cancelTask(HI::GUITestOpStatus &os, const QString &itemName); 55 static QTreeWidgetItem *getTreeWidgetItem(HI::GUITestOpStatus &os, const QString &itemName, bool failOnNull = true); 56 static QTreeWidget *getTreeWidget(HI::GUITestOpStatus &os); 57 static void moveToOpenedView(HI::GUITestOpStatus &os, const QString &itemName); 58 static QPoint getTreeViewItemPosition(HI::GUITestOpStatus &os, const QString &itemName); 59 static void moveTo(HI::GUITestOpStatus &os, const QString &itemName); 60 static int getTopLevelTasksCount(HI::GUITestOpStatus &os); 61 static bool checkTask(HI::GUITestOpStatus &os, const QString &itemName); 62 static int countTasks(HI::GUITestOpStatus &os, const QString &itemName); 63 static QString getTaskStatus(HI::GUITestOpStatus &os, const QString &itemName); 64 65 static const QString widgetName; 66 67 private: 68 static QTreeWidgetItem *getTreeWidgetItem(QTreeWidget *tree, const QString &itemName); 69 static QList<QTreeWidgetItem *> getTaskTreeViewItems(QTreeWidgetItem *root, bool recursively = true); 70 static QString getTasksInfo(QList<U2::Task *> tasks, int level); 71 }; 72 73 } // namespace U2 74 75 #endif 76