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_MOVETOOBJECTMAMENUCONTROLLER_H_ 23 #define _U2_MOVETOOBJECTMAMENUCONTROLLER_H_ 24 25 #include <QAction> 26 #include <QMenu> 27 28 #include <U2Core/Task.h> 29 30 #include <U2View/MaEditorContext.h> 31 32 namespace U2 { 33 34 class MaEditorContext; 35 class GObjectView; 36 37 /** Implements set of actions to move data between different MA objects in project. */ 38 class MoveToObjectMaController : public QObject, public MaEditorContext { 39 Q_OBJECT 40 public: 41 MoveToObjectMaController(MaEditor *maEditor); 42 43 private slots: 44 /** Shows moveSelectionToAnotherObject at cursor position. */ 45 void showMoveSelectedRowsToAnotherObjectMenu(); 46 47 /** Shows new MSA file selection dialog, creates a new file with an alignment and runs a task to move selected sequences into that alignment. */ 48 void runMoveSelectedRowsToNewFileDialog(); 49 50 /** Adds 'moveSelectionToAnotherObjectAction' to the export menu. */ 51 void buildMenu(GObjectView *view, QMenu *menu, const QString &menuType); 52 53 /** Updates all si_updateActions from MaEditor. */ 54 void updateActions(); 55 56 private: 57 /** Builds a new 'Move selection to another object' sub-menu. */ 58 QMenu *buildMoveSelectionToAnotherObjectMenu() const; 59 60 /** Moves selected rows into another MSA object. */ 61 QAction *moveSelectionToAnotherObjectAction = nullptr; 62 63 /** Moves selected rows into a new file. Opens file selector dialog to select the file to move. */ 64 QAction *moveSelectionToNewFileAction = nullptr; 65 }; 66 67 /** Removes set of rows from the MSA object. */ 68 class RemoveRowsFromMaObjectTask : public Task { 69 Q_OBJECT 70 public: 71 RemoveRowsFromMaObjectTask(MaEditor *maEditor, const QList<qint64> &rowIds); 72 73 void run() override; 74 75 private: 76 const QPointer<MaEditor> maEditor; 77 const QList<qint64> rowIds; 78 }; 79 80 } // namespace U2 81 82 #endif // _U2_MOVETOOBJECTMAMENUCONTROLLER_H_ 83